Lumiera  0.pre.03
»edityourfreedom«
BusTerm_test Class Reference

Description

Test:
cover the standard node element (terminal element) within the UI-Bus, with the help of an attached mock UI element.

Contrary to the related [ui-element test](AbstractTangible_test), here we focus on the bus side of the standard interactions.

This test enacts the fundamental generic communication patterns to verify the messaging behaviour

  • attaching a BusTerm
  • detaching on element destruction
  • generate a command invocation
  • argument passing
  • capture a state mark
  • replay a state mark
  • cast messages and error states downstream
  • generic operating of interface states
  • multithreaded integration test of diff mutation
See also
AbstractTangible_test
gui::model::Tangible
gui::ctrl::BusTerm

Definition at line 134 of file bus-term-test.cpp.

Private Member Functions

void attachNewBusTerm ()
 
void captureStateMark ()
 
void clearStates ()
 
void commandInvocation ()
 
void pushDiff ()
 
void replayStateMark ()
 
virtual void run (Arg)
 
void verifyNotifications ()
 

Static Private Member Functions

static string memLocation (Tangible &uiElm)
 

Member Function Documentation

◆ run()

virtual void run ( Arg  )
inlineprivatevirtual

Definition at line 138 of file bus-term-test.cpp.

References BusTerm_test::attachNewBusTerm(), BusTerm_test::captureStateMark(), BusTerm_test::clearStates(), BusTerm_test::commandInvocation(), BusTerm_test::pushDiff(), BusTerm_test::replayStateMark(), and BusTerm_test::verifyNotifications().

+ Here is the call graph for this function:

◆ attachNewBusTerm()

void attachNewBusTerm ( )
inlineprivate
Test:
build a new BusTerm and verify connectivity.

Every tangible UI-element bears an embedded BusTerm member. Since the latter requires another, up-link BusTerm on construction, connection to the UI-Bus is structurally ensured. Moreover, when hooking up a new UI-element, the initialisation of the embedded BusTerm will cause a down-link connection to be installed into the central routing table within the Nexus, the hub of the UI-Bus. Routing and addressing is based on the UI-element's unique EntryID, destruction of the element, through invocation of BusTerm's dtor, will ensure deregistration from the Hub.

Definition at line 162 of file bus-term-test.cpp.

References EventMatch::arg(), EventMatch::beforeCall(), EventMatch::beforeEvent(), EventLog::ensureNot(), Nexus::getLog(), util::join(), BusTerm::mark(), MARK_TEST_FUN, EventMatch::on(), Nexus::startNewLog(), Nexus::testUI(), EventLog::verify(), and EventLog::verifyCall().

Referenced by BusTerm_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ commandInvocation()

void commandInvocation ( )
inlineprivate
Test:
perform the full command binding and invocation protocol

Definition at line 225 of file bus-term-test.cpp.

References Command::canExec(), Nexus::getLog(), util::join(), MARK_TEST_FUN, lib::test::randStr(), lib::test::randTime(), Nexus::setCommandHandler(), Nexus::startNewLog(), VERIFY_ERROR, Nexus::wasBound(), and Nexus::wasInvoked().

Referenced by BusTerm_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ captureStateMark()

void captureStateMark ( )
inlineprivate
Test:
collect state mark notifications from bus We use a test version of the PresentationStateManager, based on the same building blocks as the real thing

Definition at line 279 of file bus-term-test.cpp.

References StateManager::currentState(), MockElm::getID(), Nexus::getLog(), util::join(), MARK_TEST_FUN, Tangible::markErr(), Ref::NO, Tangible::reset(), Tangible::slotCollapse(), Tangible::slotExpand(), Nexus::startNewLog(), and Nexus::useMockStateManager().

Referenced by BusTerm_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ replayStateMark()

void replayStateMark ( )
inlineprivate
Test:
replay previously captured state information"

Definition at line 323 of file bus-term-test.cpp.

References MockElm::getID(), Nexus::getMockStateManager(), MockElm::isExpanded(), MockElm::isTouched(), MARK_TEST_FUN, and Nexus::testUI().

Referenced by BusTerm_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ verifyNotifications()

void verifyNotifications ( )
inlineprivate
Test:
send notifications to a distinct element, or as broadcast.

Definition at line 355 of file bus-term-test.cpp.

References MockElm::getError(), MockElm::getID(), MockElm::getMessage(), MockElm::isError(), MockElm::isTouched(), util::join(), MockElm::joinLog(), MARK_TEST_FUN, Nexus::startNewLog(), and Nexus::testUI().

Referenced by BusTerm_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearStates()

void clearStates ( )
inlineprivate
Test:
broadcast various degrees of state reset

Definition at line 460 of file bus-term-test.cpp.

References MockElm::getError(), MockElm::getID(), MockElm::getMessage(), Nexus::getMockStateManager(), MockElm::isError(), MockElm::isExpanded(), util::isnil(), MockElm::isTouched(), util::join(), MockElm::joinLog(), MARK_TEST_FUN, Ref::NO, Nexus::setStateMarkHandler(), Tangible::slotCollapse(), Tangible::slotExpand(), Nexus::startNewLog(), and Nexus::testUI().

Referenced by BusTerm_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pushDiff()

void pushDiff ( )
inlineprivate
Test:
integration test of mutation by diff message Since this test focuses on the bus side of standard interactions, it seems indicated to emulate the complete invocation situation, which involves passing thread boundraries.

The main thread running this test shall enact the role of the UI event thread (since the UI-Bus in the real application is confined to this UI thread). Thus we'll start another thread to enact the role of the Session, to produce diff messages and "cast" them towards the UI.

Note
a defining property of this whole interaction is the fact that the diff is pulled asynchronously, which means the actual diff generation happens on callback from the UI. Access to any "session" data needs to be protected by lock in such a situation.

Independent heap allocated diff generator. Implements the IterSource<DiffStep> interface and will be pulled from the GUI-Thread for actually generating the diff. At this point, it needs to access the shared session data with proper locking, and derive a representation of the "changes" in diff format

launch the Session Thread and start injecting Borg

Definition at line 562 of file bus-term-test.cpp.

References EventMatch::arg(), EventMatch::argMatch(), MockElm::attrib, Ref::ATTRIBS, util::contains(), delay, lib::iter_stl::dischargeToSnapshot(), Ref::END, CallQueue::feed(), Record< VAL >::Mutator::genNode(), MockElm::getID(), MockElm::getLog(), CallQueue::invoke(), util::isnil(), util::join(), MARK_TEST_FUN, lib::meta::max(), BusTerm_test::memLocation(), NULL, IterStack< TY >::push(), MockElm::scope, Nexus::size(), Nexus::startNewLog(), Nexus::testUI(), and EventLog::verifyCall().

Referenced by BusTerm_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ memLocation()

static string memLocation ( Tangible uiElm)
inlinestaticprivate

Definition at line 782 of file bus-term-test.cpp.

References lib::idi::instanceTypeID(), and gui::model::test::LAUNCHER().

Referenced by BusTerm_test::pushDiff().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
+ Inheritance diagram for BusTerm_test:
+ Collaboration diagram for BusTerm_test:

The documentation for this class was generated from the following file: