diff --git a/tests/gui/bus-term-test.cpp b/tests/gui/bus-term-test.cpp index 8e9fcf41f..ab9d6ee8c 100644 --- a/tests/gui/bus-term-test.cpp +++ b/tests/gui/bus-term-test.cpp @@ -176,10 +176,12 @@ namespace test { } + /** @test perform the full command binding and invocation protocol */ void commandInvocation () { MARK_TEST_FUN + gui::test::Nexus::startNewLog(); auto cmd = gui::test::Nexus::prepareMockCmd(); //TimeSpan /////////////TODO MockElm mock("uiElm"); @@ -203,14 +205,9 @@ namespace test { CHECK (cmd.canExec()); CHECK (gui::test::Nexus::wasBound(cmd, text, luid)); ////////TODO clip, - ////////////////////////////////////////////////////////////////////////////////////////////////////TODO WIP - cout << "____Nexus-Log_________________\n" - << util::join(gui::test::Nexus::getLog(), "\n") - << "\n───╼━━━━━━━━━╾────────────────"< class PlaceholderCommand { static lib::test::EventLog log_; - /** @internal ID-string specific for the instance `ARGS` */ + /** @internal unique ID-string specific for the instance `ARGS` */ static string - thisTypeInstance() + uniqueTypeInstance() { return lib::idi::generateExtendedID(); } + static string + fullTypeID() + { + return lib::idi::typeFullID(); + } + /** a dummy command "operation */ static void operate (ARGS ...args) { - log_.call(thisTypeInstance(), "operate", std::forward(args)...); + log_.call(fullTypeID(), "operate", std::forward(args)...); } static string @@ -110,7 +121,7 @@ namespace test{ static void undo (ARGS ..., string memento) { - log_.call(thisTypeInstance(), "undo", memento); + log_.call(fullTypeID(), "undo", memento); } @@ -119,7 +130,7 @@ namespace test{ fabricateNewInstance (lib::test::EventLog const& invocationLog) { log_ = invocationLog; - return proc::control::CommandDef(internedString (thisTypeInstance())) + return proc::control::CommandDef(internedString (uniqueTypeInstance())) .operation(PlaceholderCommand::operate) .captureUndo(PlaceholderCommand::capture) .undoOperation(PlaceholderCommand::undo); @@ -129,7 +140,7 @@ namespace test{ template - lib::test::EventLog PlaceholderCommand::log_{"test-dummy-"+thisTypeInstance()}; + lib::test::EventLog PlaceholderCommand::log_{"test-dummy-"+fullTypeID()}; diff --git a/tests/gui/test/test-nexus.cpp b/tests/gui/test/test-nexus.cpp index 45a266c38..54a0ba3ef 100644 --- a/tests/gui/test/test-nexus.cpp +++ b/tests/gui/test/test-nexus.cpp @@ -435,6 +435,14 @@ namespace test{ namespace { // install a diagnostic dummy-command-handler + /** + * Compact diagnostic dummy command handler. + * Used as disposable one-way off object. + * Is both a lib::Variant visitor (to receive the + * contents of the "`act`" message, and implements + * the HandlingPattern interface to receive and + * invoke the prepared command closure. + */ class SimulatedCommandHandler : public Variant::Predicate , public HandlingPattern @@ -468,7 +476,7 @@ namespace test{ } - /* ==== CommandHandler ==== */ + /* ==== CommandHandler / Visitor ==== */ /** Case-1: the message provides parameter data to bind to the command */ bool @@ -483,7 +491,7 @@ namespace test{ bool handle (int const&) override { - log_.event("TestNexus", "trigger "+string(command_)); + log_.call ("TestNexus", "exec-command", command_); return command_.exec (*this); } @@ -514,22 +522,11 @@ namespace test{ { log_.event("TestNexus", "HANDLING Command-Message for "+string(command_)); - if (not cmdMsg.data.accept (*this)) + if (cmdMsg.data.accept (*this)) + log_.event("TestNexus", "SUCCESS handling "+command_.getID()); + else log_.warn(_Fmt("FAILED to handle command-message %s in test-mode") % cmdMsg); } - - bool - invokedExec() - { - return log_.verifyCall("exec").on(this); - } - - bool - invokedUndo() - { - return log_.verifyCall("undo").on(this) - .afterCall("exec"); - } }; }//(End)diagnostic dummy-command-handler @@ -547,13 +544,6 @@ namespace test{ - bool - Nexus::wasInvoked (Cmd cmd) - { - UNIMPLEMENTED ("verify the given command was indeed invoked at least once"); - } - - /** diff --git a/tests/gui/test/test-nexus.hpp b/tests/gui/test/test-nexus.hpp index 47556cafd..27ce44cae 100644 --- a/tests/gui/test/test-nexus.hpp +++ b/tests/gui/test/test-nexus.hpp @@ -146,9 +146,9 @@ namespace test{ * is also opaque, to allow to send arbitrary binding data. The remedy * is to rely on diff::DataCap's `operator string()`, so we can at least * match with the transport format of the Data. A precise and complete - * matching is only possible after our probe-command was actually invoked, - * since we're controlling the implementation of that probe-command and - * can thus record arbitrary data embedded therein. + * 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 */ template inline bool @@ -158,14 +158,45 @@ namespace test{ return getLog() .verifyMatch("TestNexus.+HANDLING Command-Message for .+" +cmd.getID()) - .beforeCall("bind-command").on("TestNexus").arg(string(DataCap(args))...); + .beforeCall("bind-command").on("TestNexus") + .arg(string(DataCap(args))...); } + /** + * Test predicate: verify actual command invocation by string match on test log. + * This match ensures that + * - first the installed command handler processed the '`act`' message + * - then the installed (mock) command handling pattern triggered invocation + * - and finally our installed mock command function received the call + * @remarks again arguments are verified by string match; but now we're looking + * on the concrete arguments as seen from within the command `operate` function. + * These may differ from the transport values, which are used to initialise + * the concrete arguments. + */ template inline bool Nexus::wasInvoked (Cmd cmd, ARGS const& ...args) { - UNIMPLEMENTED("verify the denoted command was indeed invoked and received the given concrete Arguments (String-match)"); + return getLog() + .verifyMatch("TestNexus.+HANDLING Command-Message for .+" +cmd.getID()) + .beforeCall("exec-command").on("TestNexus").arg(cmd.getID()) + .beforeCall("exec").on("MockHandlingPattern") + .beforeCall("operate").arg(util::toString(args)...) + .beforeEvent("TestNexus", "SUCCESS handling "+cmd.getID()); + } + + /** + * Test predicate: verify at least one actual invocation happened for the given commend, + * without matching any concrete arguments + */ + inline bool + Nexus::wasInvoked (Cmd cmd) + { + return getLog() + .verifyMatch("TestNexus.+HANDLING Command-Message for .+" +cmd.getID()) + .beforeCall("exec-command").on("TestNexus").arg(cmd.getID()) + .beforeCall("operate") + .beforeEvent("TestNexus", "SUCCESS handling "+cmd.getID()); } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 990212dbc..aad86f4f7 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -694,8 +694,7 @@ - - + @@ -718,16 +717,15 @@ wie Session- und State-Managment, Commands etc.

- - + - - + - + + @@ -762,8 +760,7 @@ Compiler-Bug Gcc-#63723

- - +
@@ -776,8 +773,7 @@ gelöst in GCC-5 -- backport unwahrscheinlich

- - +
@@ -800,8 +796,7 @@ pro möglichem Umwandlungs-Pfad

- - +
@@ -817,8 +812,7 @@ und layern nur die tatsächlich möglichen Umwandlungen drüber

- - +
@@ -831,8 +825,12 @@ - - + + + + + +