Lumiera
0.pre.03
»edit your freedom«
|
#include "/Werk/devel/lumi/tests/stage/test/test-nexus.hpp"
Mock UI backbone for unit testing.
In the absence of a real UI, this simulated UI-Bus can be used to wire a test probe and address it in unit testing.
Definition at line 67 of file test-nexus.hpp.
Public Types | |
using | CommandHandler = std::function< void(lib::diff::GenNode const &)> |
using | StateMarkHandler = std::function< void(lib::idi::BareEntryID const &, lib::diff::GenNode const &)> |
Static Public Member Functions | |
static lib::test::EventLog const & | getLog () |
static ctrl::StateManager & | getMockStateManager () |
template<typename... ARGS> | |
static Symbol | prepareMockCmd () |
Setup of test fixture: prepare a mocked Steam-Layer command, which accepts arguments with the denoted types. More... | |
static void | setCommandHandler (CommandHandler=CommandHandler()) |
install a closure (custom handler function) to deal with any command invocations encountered in the test-UI-Bus. More... | |
static void | setStateMarkHandler (StateMarkHandler=StateMarkHandler()) |
similar to the custom command handler this hook allows to install a closure to intercept any "state mark" messages passed over the test-UI-Bus | |
static size_t | size () |
static lib::test::EventLog const & | startNewLog () |
static ctrl::BusTerm & | testUI () |
get a connection point to a UI backbone faked for test More... | |
static ctrl::StateManager & | useMockStateManager () |
install a standard handler for state mark messages, which is actually backed by a mock implementation of the PresentationStateManager interface. More... | |
template<typename... ARGS> | |
static bool | wasBound (Symbol, ARGS const &...args) |
Test predicate: verify by string match that the denoted command was actually bound against the given concrete arguments. More... | |
static bool | wasInvoked (Symbol) |
Test predicate: verify at least one actual invocation happened for the given commend, without matching any concrete arguments. | |
template<typename... ARGS> | |
static bool | wasInvoked (Symbol, ARGS const &...args) |
Test predicate: verify actual command invocation by string match on test log. More... | |
static void | zombificate (ctrl::BusTerm &) |
kill the given [BusTerm] and implant a dead terminal in place More... | |
Static Private Member Functions | |
static void | prepareDiagnosticCommandHandler () |
Additional Inherited Members | |
Private Member Functions inherited from NonCopyable | |
NonCopyable (NonCopyable const &)=delete | |
NonCopyable & | operator= (NonCopyable const &)=delete |
|
static |
get a connection point to a UI backbone faked for test
Definition at line 366 of file test-nexus.cpp.
References stage::test::anonymous_namespace{test-nexus.cpp}::testNexus.
Referenced by BusTerm_test::attachNewBusTerm(), MockElm::buildMutator(), BusTerm_test::clearStates(), AbstractTangible_test::markState(), AbstractTangible_test::notify(), AbstractTangible_test::revealer(), and BusTerm_test::verifyNotifications().
|
static |
kill the given [BusTerm] and implant a dead terminal in place
Definition at line 584 of file test-nexus.cpp.
References stage::test::anonymous_namespace{test-nexus.cpp}::testNexus, and BusTerm::~BusTerm().
Referenced by MockElm::kill().
|
static |
install a closure (custom handler function) to deal with any command invocations encountered in the test-UI-Bus.
In the real Lumiera-UI, the UI-Bus is wired with a core service handler, which processes command messages by actually triggering command invocation on the Session within Steam-Layer
Definition at line 408 of file test-nexus.cpp.
References stage::test::anonymous_namespace{test-nexus.cpp}::testNexus.
|
static |
install a standard handler for state mark messages, which is actually backed by a mock implementation of the PresentationStateManager interface.
This mock is based on the same implementation techniques as the full fledged state manager in the Lumiera GTK UI; any state mark notification messages appearing after that point at the test-UI-Bus will be accounted for.
Definition at line 553 of file test-nexus.cpp.
|
inlinestatic |
Setup of test fixture: prepare a mocked Steam-Layer command, which accepts arguments with the denoted types.
Definition at line 126 of file test-nexus.hpp.
|
inlinestatic |
Test predicate: verify by string match that the denoted command was actually bound against the given concrete arguments.
Actually, we'll match against the Test-Nexus log, where the processing of the corresponding "bind" message should have logged all parameter values
operator string()
, so we can at least match with the transport format of the Data. A precise and complete matching would only possible after actually invoking our probe-command, since we're controlling the implementation of that probe-command. Right now (2016) this implementation was deemed adequate Definition at line 150 of file test-nexus.hpp.
References EventMatch::arg(), EventMatch::beforeCall(), EventMatch::on(), and EventLog::verifyMatch().
|
inlinestatic |
Test predicate: verify actual command invocation by string match on test log.
This match ensures that
act
' messageoperate
function. These may differ from the transport values, which are used to initialise the concrete arguments. Definition at line 173 of file test-nexus.hpp.
References EventMatch::arg(), EventMatch::beforeCall(), EventMatch::beforeEvent(), EventMatch::on(), and EventLog::verifyMatch().