52 string TEST_CMD =
"test.command1.handling";
53 HandlingPattern::ID TEST_PATTERN = HandlingPattern::DUMMY;
68 log_.
call (TEST_CMD,
"exec");
69 command.invokeCapture();
70 command.invokeOperation();
76 log_.call (TEST_CMD,
"undo");
81 isValid()
const override 91 return log_.verifyCall(
"exec").on(TEST_CMD);
97 return log_.verifyCall(
"undo").on(TEST_CMD)
134 cnt_inst = registry.instance_count();
137 PCommandImpl pCom = buildTestCommand(registry);
141 useCustomHandler (pCom);
144 CHECK (cnt_inst == registry.instance_count());
157 typedef void Sig_oper(
int);
158 typedef long Sig_capt(
int);
159 typedef void Sig_undo(
int,
long);
161 function<Sig_oper> o_Fun (command1::operate);
162 function<Sig_capt> c_Fun (command1::capture);
163 function<Sig_undo> u_Fun (command1::undoIt);
165 CHECK (o_Fun && c_Fun && u_Fun);
182 CHECK (!com->canExec());
185 const int ARGR (1 + rand() % 1000);
188 com->setArguments(arg);
190 CHECK (com->canExec());
191 CHECK (!com->canUndo());
192 command1::check_ = 0;
198 CHECK (ARGR == command1::check_);
199 CHECK (com->canUndo());
208 CHECK (com->canExec());
209 CHECK (com->canUndo());
211 CHECK (command1::check_ > 0);
217 CHECK (command1::check_ == 0);
227 CustomHandler specialHandler;
229 CHECK (com->canExec());
230 CHECK (not specialHandler.invokedExec());
232 specialHandler.exec (*com, TEST_CMD);
233 CHECK ( specialHandler.invokedExec());
234 CHECK (not specialHandler.invokedUndo());
236 specialHandler.undo (*com, TEST_CMD);
237 CHECK ( specialHandler.invokedExec());
typename BuildTupleType< TYPES >::Type Tuple
Build a std::tuple from types given as type sequence.
Support for verifying the occurrence of events from unit tests.
Implementation helper to bind Steam-Layer commands with arbitrary argument tuples.
shared_ptr< CommandImpl > newCommandImpl(function< SIG_OPER > &operFunctor, function< SIG_CAPT > &captFunctor, function< SIG_UNDO > &undoFunctor)
set up a new command implementation frame
Top level of the command implementation.
Helper to log and verify the occurrence of events.
Managing command definitions and the storage of individual command objects.
Registry managing command implementation objects (Singleton).
Steam-Layer implementation namespace root.
PCommandImpl buildTestCommand(CommandRegistry ®istry)
create a command implementation frame usable for tests.
Simple test class runner.
Result (Status) of command execution.
EventLog & call(string target, string function)
Log occurrence of a function call with no arguments.
Steam-Layer command frontend.
void useCustomHandler(PCommandImpl com)
Pre-defined command execution skeletons.
Some dummy command functions used for building unit test cases.
Steam-Layer Command implementation.
static HandlingPattern const & get(ID id)
retrieve the pre-configured pattern
void checkUndo(PCommandImpl com)
void checkExec(PCommandImpl com)
Interface: Operation Skeleton how to invoke or undo a command.
static lib::Depend< CommandRegistry > instance
storage for the singleton factory used to access CommandRegistry