extend unit test verification on UI command invocation
This commit is contained in:
parent
5a5beebd15
commit
0b21eeae2f
2 changed files with 16 additions and 1 deletions
|
|
@ -60,6 +60,7 @@
|
||||||
|
|
||||||
|
|
||||||
using lib::Symbol;
|
using lib::Symbol;
|
||||||
|
using util::toString;
|
||||||
using gui::test::MockElm;
|
using gui::test::MockElm;
|
||||||
using lib::test::EventLog;
|
using lib::test::EventLog;
|
||||||
using lib::idi::EntryID;
|
using lib::idi::EntryID;
|
||||||
|
|
@ -325,15 +326,27 @@ namespace test {
|
||||||
int prevState = dummyState;
|
int prevState = dummyState;
|
||||||
int concreteParam = 1 +rand() % 100;
|
int concreteParam = 1 +rand() % 100;
|
||||||
|
|
||||||
|
// on bus no traces from this command yet...
|
||||||
|
CHECK (nexusLog.ensureNot(string(DUMMY_CMD_ID)));
|
||||||
|
|
||||||
|
|
||||||
// now the ongoing interaction picks up parameter data
|
// now the ongoing interaction picks up parameter data
|
||||||
mock.prepareCommand (invTrail, lib::diff::Rec({concreteParam}));
|
mock.prepareCommand (invTrail, lib::diff::Rec({concreteParam}));
|
||||||
|
CHECK (nexusLog.verifyCall("act").arg("«int»|" +toString(concreteParam))
|
||||||
|
.beforeEvent("binding for command \""+DUMMY_CMD_ID));
|
||||||
|
|
||||||
CHECK (dummyState == prevState); // command was not yet invoked
|
CHECK (dummyState == prevState); // command was not yet invoked
|
||||||
|
CHECK (nexusLog.ensureNot("invoke command \""+DUMMY_CMD_ID));
|
||||||
|
|
||||||
|
|
||||||
// finally the command gets triggered
|
// finally the command gets triggered
|
||||||
mock.issueCommand (invTrail);
|
mock.issueCommand (invTrail);
|
||||||
|
|
||||||
CHECK (dummyState == concreteParam); // command was indeed invoked
|
CHECK (dummyState == concreteParam); // command was indeed invoked
|
||||||
|
CHECK (nexusLog.verifyCall("act").arg("«int»|" +toString(concreteParam))
|
||||||
|
.beforeCall("act").arg("DataCap|«int»|"));
|
||||||
|
CHECK (nexusLog.verifyEvent("binding for command \""+DUMMY_CMD_ID)
|
||||||
|
.beforeEvent("invoke command \""+DUMMY_CMD_ID));
|
||||||
|
|
||||||
|
|
||||||
// verify proper binding, including UNDO state capture
|
// verify proper binding, including UNDO state capture
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "lib/test/run.hpp"
|
#include "lib/test/run.hpp"
|
||||||
|
#include "lib/test/test-helper.hpp"
|
||||||
#include "test/test-nexus.hpp"
|
#include "test/test-nexus.hpp"
|
||||||
#include "test/mock-elm.hpp"
|
#include "test/mock-elm.hpp"
|
||||||
#include "lib/idi/entry-id.hpp"
|
#include "lib/idi/entry-id.hpp"
|
||||||
|
|
@ -103,6 +104,7 @@ namespace test {
|
||||||
void
|
void
|
||||||
attachNewBusTerm ()
|
attachNewBusTerm ()
|
||||||
{
|
{
|
||||||
|
MARK_TEST_FUN;
|
||||||
// our dummy will be linked with this identity
|
// our dummy will be linked with this identity
|
||||||
BareEntryID elmID = EntryID<MockElm>{"zeitgeist"};
|
BareEntryID elmID = EntryID<MockElm>{"zeitgeist"};
|
||||||
|
|
||||||
|
|
@ -128,7 +130,7 @@ namespace test {
|
||||||
// invoke action on element to cause upstream message (with a "state mark")
|
// invoke action on element to cause upstream message (with a "state mark")
|
||||||
mock.slotCollapse();
|
mock.slotCollapse();
|
||||||
CHECK (elmLog.verifyEvent("collapsed"));
|
CHECK (elmLog.verifyEvent("collapsed"));
|
||||||
CHECK (nexusLog.verifyCall("note").on("TestNexus").arg(elmID, "GenNode-ID(\"expand\")-DataCap|«bool»|0"));
|
CHECK (nexusLog.verifyCall("note").on("TestNexus").arg(elmID, "GenNode-ID(\"expand\")-DataCap|«bool»|false"));
|
||||||
|
|
||||||
// send a state mark down to the mock element
|
// send a state mark down to the mock element
|
||||||
gui::test::Nexus::testUI().mark (elmID, GenNode("Flash", 23));
|
gui::test::Nexus::testUI().mark (elmID, GenNode("Flash", 23));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue