Lumiera
0.pre.03
»edit your freedom«
|
This test documents a generic interaction protocol supported by all "tangible" elements of the Lumiera GTK UI. This works by connecting any such element to a messaging backbone, the UI-Bus. By sending messages according to this protocol, typical state changes can be detected and later be replayed on elements addressed by ID. Moreover, the preconfigured commands offered by the session can be invoked via bus message, and it is possible to populate and change UI elements by sending a tree diff message
Definition at line 173 of file abstract-tangible-test.cpp.
Private Member Functions | |
void | invokeCommand () |
void | markState () |
void | mutate () |
void | notify () |
void | revealer () |
virtual void | run (Arg) |
void | verify_mockManipulation () |
Static Private Member Functions | |
static string | memLocation (Tangible &uiElm) |
|
inlineprivate |
The generic backbone of the Lumiera UI offers a mock UI element, with the ability to stand-in for actual elements present in the real GUI. This allows us to rig an emulated test user interface to cover interactions involving some communication from or to interface elements. After setting up a mock UI-element with a suitable name / ID, we're able to operate this element programmatically and to send messages and responses from the core "up" to this mocked interface. And since this mock element embodies an event log, the unit test code can verify the occurrence of expected events, invocations and responses.
Definition at line 211 of file abstract-tangible-test.cpp.
References EventMatch::arg(), EventMatch::before(), MARK_TEST_FUN, and EventLog::verify().
|
inlineprivate |
This test case performs an elementary UI operation, namely to expand / collapse an element, to verify both directions of state marking. Here »state marking« is a mechanism, where UI state changes get recorded at some central StateManager, to be able to restore interface state later. Thus, when we'll expand and collapse the mock, we expect the corresponding "state mark" notifications to appear at the UI-Bus.
The second part of this test replays such a state mark, which causes thedoMark()
operation on the UI element to be invoked.
Definition at line 371 of file abstract-tangible-test.cpp.
References EventMatch::arg(), EventMatch::beforeCall(), EventMatch::beforeEvent(), MARK_TEST_FUN, Tangible::slotCollapse(), Tangible::slotExpand(), Nexus::testUI(), and MockElm::verifyMark().
|
inlineprivate |
We install a lambda to supply the actual implementation action, which can then either be triggered by a signal/slot invocation, or by sending a "state mark".
Definition at line 478 of file abstract-tangible-test.cpp.
References EventMatch::afterCall(), EventMatch::arg(), EventMatch::beforeCall(), EventMatch::beforeEvent(), Tangible::installRevealer(), MARK_TEST_FUN, Tangible::slotExpand(), Tangible::slotReveal(), Nexus::testUI(), and MockElm::verifyMark().
|
inlineprivate |
Send message, error and flash messages via Bus to the element and verify the doMsg, doErr or doFlash handlers were invoked.
Definition at line 562 of file abstract-tangible-test.cpp.
References MARK_TEST_FUN, and Nexus::testUI().
|
inlineprivate |
This is done by sending a MutationMessage via UI-Bus, which is handled and applied to the receiver by Lumiera's diff framework.
This test uses the MockElem to simulate real UI elements; to be able to verify the diff application, MockElm is already preconfigured with a diff binding, and it exposes a set of attributes and a collection of child mock elements. Basically, the diff mechanism allows to effect structural changes within an otherwise opaque implementation data structure. For this to work, the receiver needs to create a custom diff binding. Thus, each subclass of Tangible has to implement the virtual function Tangible::buildMutator() and hook up those internal structures, which are exposed to changes via diff message. This is what we then call a "diff binding" (and MockElement is already outfitted this way). Note especially how child UI elements can be added recursively, allowing gradually to populate the contents of the UI.
The diff itself is an iterable sequence of diff verbs. Typically, such a diff is generated as the result of some operation in the Session core, or it is created by comparing two versions of an abstracted object description (e.g. session snapshot).
Here in this test case, we use a hard wired diff sequence, so we can check the expected structural changes actually took place.
Definition at line 660 of file abstract-tangible-test.cpp.
References MARK_TEST_FUN.