SessionCommand: define function test for message based invocation
the intention is to cover more of the full invocation path, without running all of the application infrastructure. So this second test cases simulates how messages are handled in CoreService, where the CommandHandler (visitor) actually invokes the SessionCommand facade
This commit is contained in:
parent
2d5ef968a8
commit
b52ab62caf
3 changed files with 31 additions and 8 deletions
|
|
@ -109,7 +109,7 @@ namespace ctrl{
|
|||
* @note this is a pragmatic guess, based on the actual usage pattern within Lumiera.
|
||||
* This determines the size of the inline buffer within MutationMessage.
|
||||
* You'll get an static assertion failure when creating a MutationMessage
|
||||
* from a concrete diff representation requiring more size...
|
||||
* from a concrete diff representation requires more storage space...
|
||||
*/
|
||||
enum { SIZE_OF_DIFF_REPRESENTATION = sizeof(std::vector<string>)
|
||||
+ sizeof(size_t)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
** actual values is tracked by an [InvocationTrail] handle. When
|
||||
** ready, finally this handle can be issued on any [BusTerm].
|
||||
**
|
||||
** @todo as of 11/2015 this is complete WIP-WIP-WIP
|
||||
** @todo as of 11/2015 this is more of a concept draft
|
||||
**
|
||||
** @see ////TODO_test usage example
|
||||
**
|
||||
|
|
@ -86,6 +86,7 @@ namespace interact {
|
|||
* exist somewhere in the system and IDs to be sent over the bus, without the certainty
|
||||
* of a real invocation site and a matching command operation to exist somewhere else
|
||||
* within the system.
|
||||
* @todo do we need an alternative ctor based on plain command-ID? ///////////////////////////TICKET #1060 : create a dedicated command-ID type?
|
||||
*/
|
||||
InvocationTrail(proc::control::Command prototype)
|
||||
: cmdID_(prototype.getID())
|
||||
|
|
|
|||
|
|
@ -30,9 +30,7 @@ extern "C" {
|
|||
#include "proc/control/proc-dispatcher.hpp"
|
||||
#include "proc/control/command-def.hpp"
|
||||
#include "gui/ctrl/command-handler.hpp"
|
||||
#include "proc/asset/meta/time-grid.hpp"
|
||||
#include "lib/time/timequant.hpp"
|
||||
#include "lib/time/timecode.hpp"
|
||||
#include "gui/interact/invocation-trail.hpp"
|
||||
#include "lib/format-obj.hpp"
|
||||
#include "lib/format-cout.hpp" //////////TODO
|
||||
#include "lib/symbol.hpp"
|
||||
|
|
@ -50,7 +48,9 @@ namespace test {
|
|||
// using std::function;
|
||||
// using std::rand;
|
||||
using lib::test::randTime;
|
||||
using gui::interact::InvocationTrail;
|
||||
using gui::ctrl::CommandHandler;
|
||||
using lib::diff::GenNode;
|
||||
using lib::diff::Rec;
|
||||
using lib::time::Time;
|
||||
using lib::time::TimeVar;
|
||||
|
|
@ -86,7 +86,7 @@ namespace test {
|
|||
void
|
||||
undoIt (Duration, Offset, int, Time oldState)
|
||||
{
|
||||
// dummyState = oldState;
|
||||
testCommandState = oldState;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -200,7 +200,7 @@ namespace test {
|
|||
SessionCommand::facade().invoke(cmdID);
|
||||
|
||||
__DELAY__
|
||||
CHECK (testCommandState - prevState == Time(0, 1));
|
||||
CHECK (testCommandState - prevState == Time(0, 1)); // execution added 1500ms -1*500ms == 1sec
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -214,7 +214,29 @@ namespace test {
|
|||
void
|
||||
perform_messageInvocation()
|
||||
{
|
||||
UNIMPLEMENTED ("invoke via message");
|
||||
// this happens "somewhere" in the UI interaction control framework
|
||||
InvocationTrail invoTrail{Command(COMMAND_ID)};
|
||||
|
||||
// this happens within some tangible UI element (widget / controller)
|
||||
GenNode argumentBindingMessage = invoTrail.bindMsg (Rec{Duration(25,10), Time(500,0), -2});
|
||||
GenNode commandTriggerMessage = invoTrail.bangMsg ();
|
||||
CHECK (argumentBindingMessage.idi == commandTriggerMessage.idi);
|
||||
|
||||
// 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));
|
||||
Time prevState = testCommandState;
|
||||
|
||||
// now handling the message to trigger execution
|
||||
CommandHandler handler2{commandTriggerMessage};
|
||||
commandTriggerMessage.data.accept(handler2);
|
||||
|
||||
__DELAY__
|
||||
CHECK (Command::canUndo(COMMAND_ID));
|
||||
CHECK (testCommandState - prevState == Time(500, 1)); // execution added 2500ms -2*500ms == 1.5sec
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue