SessionCommand: second function test PASS
This commit is contained in:
parent
b52ab62caf
commit
0b0575050d
4 changed files with 32 additions and 19 deletions
|
|
@ -100,7 +100,7 @@ namespace ctrl{
|
|||
bool
|
||||
handle (Rec const& bindingArgs) override
|
||||
{
|
||||
SessionCommand::facade().bindArg (commandID_, bindingArgs);
|
||||
SessionCommand::facade().bindArg (commandID_.getSym(), bindingArgs);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ namespace ctrl{
|
|||
bool
|
||||
handle (int const&) override ///< the "bang!" message (command invocation)
|
||||
{
|
||||
SessionCommand::facade().invoke (commandID_);
|
||||
SessionCommand::facade().invoke (commandID_.getSym());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ namespace control {
|
|||
}
|
||||
if (cmd)
|
||||
{
|
||||
TODO ("+++ dispatch %s", util::cStr(cmd));
|
||||
INFO (command, "+++ dispatch %s", util::cStr(cmd));
|
||||
|
||||
//////////////////////////////////////////////////////TODO : magic to invoke commands from unit tests
|
||||
if (util::startsWith (string(cmd.getID()), "test."))
|
||||
|
|
|
|||
|
|
@ -31,12 +31,10 @@ extern "C" {
|
|||
#include "proc/control/command-def.hpp"
|
||||
#include "gui/ctrl/command-handler.hpp"
|
||||
#include "gui/interact/invocation-trail.hpp"
|
||||
#include "lib/format-obj.hpp"
|
||||
#include "lib/format-cout.hpp" //////////TODO
|
||||
//#include "lib/format-cout.hpp" //////////TODO
|
||||
#include "lib/symbol.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
//#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
|
||||
|
|
@ -56,10 +54,8 @@ namespace test {
|
|||
using lib::time::TimeVar;
|
||||
using lib::time::Duration;
|
||||
using lib::time::Offset;
|
||||
using lib::time::FSecs;
|
||||
using lib::Symbol;
|
||||
using util::isnil;
|
||||
using util::toString;
|
||||
using std::string;
|
||||
|
||||
|
||||
|
|
@ -68,6 +64,8 @@ namespace test {
|
|||
/* === mock operation to be dispatched as command === */
|
||||
|
||||
const Symbol COMMAND_ID{"test.dispatch.function.command"};
|
||||
const Symbol COMMAND_I1{"test.dispatch.function.command.instance-1"};
|
||||
const Symbol COMMAND_I2{"test.dispatch.function.command.instance-2"};
|
||||
|
||||
TimeVar testCommandState = randTime();
|
||||
|
||||
|
|
@ -127,10 +125,14 @@ namespace test {
|
|||
.captureUndo (capture)
|
||||
.undoOperation (undoIt)
|
||||
;
|
||||
Command(COMMAND_ID).storeDef(COMMAND_I1);
|
||||
Command(COMMAND_ID).storeDef(COMMAND_I2);
|
||||
}
|
||||
~SessionCommandFunction_test()
|
||||
{
|
||||
Command::remove (COMMAND_ID);
|
||||
Command::remove (COMMAND_I1);
|
||||
Command::remove (COMMAND_I2);
|
||||
}
|
||||
//-------------(End)FIXTURE
|
||||
|
||||
|
|
@ -143,7 +145,7 @@ namespace test {
|
|||
|
||||
startDispatcher();
|
||||
perform_simpleInvocation();
|
||||
// perform_messageInvocation();
|
||||
perform_messageInvocation();
|
||||
// perform_massivelyParallel();
|
||||
stopDispatcher();
|
||||
|
||||
|
|
@ -188,12 +190,12 @@ namespace test {
|
|||
void
|
||||
perform_simpleInvocation()
|
||||
{
|
||||
string cmdID {COMMAND_ID};
|
||||
string cmdID {COMMAND_I1};
|
||||
Rec arguments {Duration(15,10), Time(500,0), -1};
|
||||
|
||||
CHECK (not Command(COMMAND_ID).canExec());
|
||||
CHECK (not Command(COMMAND_I1).canExec());
|
||||
SessionCommand::facade().bindArg (cmdID, arguments);
|
||||
CHECK (Command(COMMAND_ID).canExec());
|
||||
CHECK (Command(COMMAND_I1).canExec());
|
||||
|
||||
|
||||
Time prevState = testCommandState;
|
||||
|
|
@ -215,19 +217,21 @@ namespace test {
|
|||
perform_messageInvocation()
|
||||
{
|
||||
// this happens "somewhere" in the UI interaction control framework
|
||||
InvocationTrail invoTrail{Command(COMMAND_ID)};
|
||||
InvocationTrail invoTrail{Command(COMMAND_I2)};
|
||||
|
||||
// this happens within some tangible UI element (widget / controller)
|
||||
GenNode argumentBindingMessage = invoTrail.bindMsg (Rec{Duration(25,10), Time(500,0), -2});
|
||||
GenNode argumentBindingMessage = invoTrail.bindMsg (Rec {Duration(25,10), Time(500,0), -2});
|
||||
GenNode commandTriggerMessage = invoTrail.bangMsg ();
|
||||
CHECK (argumentBindingMessage.idi == commandTriggerMessage.idi);
|
||||
CHECK (argumentBindingMessage.idi.getSym() == string{COMMAND_I2});
|
||||
CHECK (commandTriggerMessage.idi.getSym() == string{COMMAND_I2});
|
||||
CHECK (not Command::canExec(COMMAND_I2));
|
||||
|
||||
// this happens, when CoreService receives command messages from UI-Bus
|
||||
CommandHandler handler1{argumentBindingMessage};
|
||||
argumentBindingMessage.data.accept(handler1); // handler is a visitor for the message payload
|
||||
|
||||
CHECK (Command::canExec(COMMAND_ID));
|
||||
CHECK (not Command::canUndo(COMMAND_ID));
|
||||
CHECK (Command::canExec(COMMAND_I2));
|
||||
CHECK (not Command::canUndo(COMMAND_I2));
|
||||
Time prevState = testCommandState;
|
||||
|
||||
// now handling the message to trigger execution
|
||||
|
|
@ -235,7 +239,7 @@ namespace test {
|
|||
commandTriggerMessage.data.accept(handler2);
|
||||
|
||||
__DELAY__
|
||||
CHECK (Command::canUndo(COMMAND_ID));
|
||||
CHECK (Command::canUndo(COMMAND_I2));
|
||||
CHECK (testCommandState - prevState == Time(500, 1)); // execution added 2500ms -2*500ms == 1.5sec
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -931,10 +931,19 @@
|
|||
<icon BUILTIN="messagebox_warning"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1483927552823" HGAP="-105" ID="ID_458362835" MODIFIED="1483927563707" TEXT="Unit-Test" VSHIFT="12">
|
||||
<node CREATED="1483927552823" HGAP="-105" ID="ID_458362835" MODIFIED="1484294433837" TEXT="Unit-Test" VSHIFT="12">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1484294389310" ID="ID_100306048" MODIFIED="1484294425156" TEXT="direkter Aufruf der Facade">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node CREATED="1484294397597" ID="ID_1461153044" MODIFIED="1484294422192" TEXT="Aufruf über Nachrichten + Visitor">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1484294409827" ID="ID_1014781174" MODIFIED="1484294428426" TEXT="massiv-paralleler Aufruf">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1483748340524" ID="ID_841368846" MODIFIED="1483748346879" TEXT="API-Funktionen aufrufen"/>
|
||||
</node>
|
||||
<node CREATED="1482464658193" HGAP="-14" ID="ID_726798260" MODIFIED="1482711954690" TEXT="Ausgestaltung" VSHIFT="29">
|
||||
|
|
|
|||
Loading…
Reference in a new issue