Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
placeholder-command.hpp
Go to the documentation of this file.
1/*
2 PLACEHOLDER-COMMAND.hpp - fake operation to mock command invocation from UI
3
4 Copyright (C)
5 2016, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
14
31#ifndef STAGE_TEST_PLACEHOLDER_COMMAND_H
32#define STAGE_TEST_PLACEHOLDER_COMMAND_H
33
34
35#include "lib/error.hpp"
36#include "lib/symbol.hpp"
37#include "lib/idi/genfunc.hpp"
40#include "lib/format-util.hpp"
41
42#include <vector>
43#include <string>
44
45
46namespace stage {
47namespace test{
48
49 using std::string;
50 using lib::Symbol;
51
52
53
54
67 template<typename...ARGS>
69 {
71
73 static string
75 {
76 return lib::idi::generateExtendedID<PlaceholderCommand>();
77 }
78
79 static string
81 {
82 return lib::idi::typeFullID<PlaceholderCommand>();
83 }
84
85
87 static void
88 operate (ARGS ...args)
89 {
90 log_.call(fullTypeID(), "operate", std::forward<ARGS>(args)...);
91 }
92
93 static string
94 capture (ARGS ...args)
95 {
96 return "Memento⧏" + util::join (util::stringify (args...),"⧓") + "⧐";
97 }
98
99 static void
100 undo (ARGS ..., string memento)
101 {
102 log_.call(fullTypeID(), "undo", memento);
103 }
104
105
106 public:
109 {
110 log_ = invocationLog;
113 .captureUndo(PlaceholderCommand::capture)
114 .undoOperation(PlaceholderCommand::undo);
115
116 }
117 };
118
119
120 template<typename...ARGS>
121 lib::test::EventLog PlaceholderCommand<ARGS...>::log_{"test-dummy-"+fullTypeID()};
122
123
124
125
126}} // namespace stage::test
127#endif /*STAGE_TEST_PLACEHOLDER_COMMAND_H*/
Token or Atom with distinct identity.
Definition symbol.hpp:120
Helper to log and verify the occurrence of events.
EventLog & call(string target, string function)
Log occurrence of a function call with no arguments.
Set of stub command operations.
static void undo(ARGS ..., string memento)
static steam::control::Command fabricateNewInstance(lib::test::EventLog const &invocationLog)
static void operate(ARGS ...args)
a dummy command "operation
static string capture(ARGS ...args)
static lib::test::EventLog log_
Helper class used solely for defining a Command-Object.
Handle object representing a single Command instance to be used by client code.
Definition command.hpp:120
Actually defining a command and binding it to execution parameters.
Lumiera error handling (C++ interface).
Support for verifying the occurrence of events from unit tests.
Collection of small helpers and convenience shortcuts for diagnostics & formatting.
Generic functions to build identification schemes.
Lumiera GTK UI implementation root.
Definition guifacade.cpp:37
Test runner and basic definitions for tests.
vector< string > stringify(ELMS const &...elms)
standard setup: convert to string into a vector
string join(COLL &&coll, string const &delim=", ")
enumerate a collection's contents, separated by delimiter.
Marker types to indicate a literal string and a Symbol.