add skeleton of a mock implementation within test::Nexus
This commit is contained in:
parent
f58b2af228
commit
ef04ebfb17
3 changed files with 99 additions and 8 deletions
|
|
@ -83,19 +83,22 @@ namespace interact {
|
|||
|
||||
|
||||
virtual lib::diff::GenNode const&
|
||||
currentState (string elementSymbol, string propertyID) =0;
|
||||
currentState (string elementSymbol, string propertyID) const =0;
|
||||
|
||||
virtual void
|
||||
replayState (string elementSymbol, string propertyID) =0;
|
||||
replayState (string elementSymbol, string propertyID) =0;
|
||||
|
||||
virtual void
|
||||
replayAllState () =0;
|
||||
replayAllState() =0;
|
||||
|
||||
virtual void
|
||||
replayAllState (string propertyID) =0;
|
||||
replayAllState (string propertyID) =0;
|
||||
|
||||
virtual void
|
||||
replayAllProperties (string elementSymbol) =0;
|
||||
replayAllProperties (string elementSymbol) =0;
|
||||
|
||||
virtual void
|
||||
clearState() =0;
|
||||
|
||||
private:
|
||||
};
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ using lib::diff::DataValues;
|
|||
using lib::idi::instanceTypeID;
|
||||
using lib::test::EventLog;
|
||||
using gui::ctrl::BusTerm;
|
||||
using gui::interact::PresentationStateManager;
|
||||
using proc::control::Command;
|
||||
using proc::control::CommandImpl;
|
||||
using proc::control::HandlingPattern;
|
||||
|
|
@ -547,20 +548,107 @@ namespace test{
|
|||
|
||||
|
||||
|
||||
namespace { // install a diagnostic dummy-command-handler
|
||||
|
||||
using ID = lib::idi::BareEntryID;
|
||||
|
||||
class SimulatedStateManager
|
||||
: public PresentationStateManager
|
||||
{
|
||||
|
||||
/* === PresentationStateManager interface === */
|
||||
|
||||
virtual lib::diff::GenNode const&
|
||||
currentState (string elementSymbol, string propertyID) const override
|
||||
{
|
||||
UNIMPLEMENTED ("retrieve captured state");
|
||||
}
|
||||
|
||||
|
||||
virtual void
|
||||
replayState (string elementSymbol, string propertyID) override
|
||||
{
|
||||
UNIMPLEMENTED ("retrieve captured state");
|
||||
}
|
||||
|
||||
|
||||
virtual void
|
||||
replayAllState() override
|
||||
{
|
||||
UNIMPLEMENTED ("retrieve captured state");
|
||||
}
|
||||
|
||||
|
||||
virtual void
|
||||
replayAllState (string propertyID) override
|
||||
{
|
||||
UNIMPLEMENTED ("retrieve captured state");
|
||||
}
|
||||
|
||||
|
||||
virtual void
|
||||
replayAllProperties (string elementSymbol) override
|
||||
{
|
||||
UNIMPLEMENTED ("retrieve captured state");
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
virtual void
|
||||
clearState() override
|
||||
{
|
||||
UNIMPLEMENTED ("discard all stored state information");
|
||||
}
|
||||
|
||||
void
|
||||
record (ID const& elementID, lib::diff::GenNode const& stateMark)
|
||||
{
|
||||
UNIMPLEMENTED ("handle and record a state mark message");
|
||||
}
|
||||
};
|
||||
|
||||
lib::Depend<SimulatedStateManager> stateManager;
|
||||
|
||||
}//(End)diagnostic mock-state-manager
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
interact::PresentationStateManager&
|
||||
Nexus::useMockStateManager()
|
||||
{
|
||||
UNIMPLEMENTED("install a presentation manager mock and state mark handler");
|
||||
// discard possible leftover
|
||||
// from previous test installations
|
||||
stateManager().clearState();
|
||||
|
||||
testNexus().installStateMarkHandler(
|
||||
[&](ID const& elementID, lib::diff::GenNode const& stateMark)
|
||||
{
|
||||
stateManager().record (elementID, stateMark);
|
||||
});
|
||||
|
||||
return getMockStateManager();
|
||||
}
|
||||
|
||||
interact::PresentationStateManager&
|
||||
Nexus::getMockStateManager()
|
||||
{
|
||||
UNIMPLEMENTED("access installed Mock presentation manager");
|
||||
return stateManager();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return a defunct BusTerm with up-link to [ZombieNexus]
|
||||
* @remarks useful to create zombie mock UI-Elements for testing.
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace test{
|
|||
/* == allow to set custom handlers for commands and state changes == */
|
||||
|
||||
using CommandHandler = std::function<void(lib::diff::GenNode const&)>;
|
||||
using StateMarkHandler = std::function<void(lib::idi::BareEntryID, lib::diff::GenNode const&)>;
|
||||
using StateMarkHandler = std::function<void(lib::idi::BareEntryID const&, lib::diff::GenNode const&)>;
|
||||
|
||||
static void setCommandHandler (CommandHandler =CommandHandler());
|
||||
static void setStateMarkHandler (StateMarkHandler =StateMarkHandler());
|
||||
|
|
|
|||
Loading…
Reference in a new issue