From a91d03b60a79223e9aa1a59b945d823b192919f2 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 31 Mar 2017 21:12:12 +0200 Subject: [PATCH] Commands: draft usage of CommandInstanceManager (#1089) --- src/proc/control/command-instance-manager.hpp | 2 +- tests/45controller.tests | 5 + .../control/command-instance-manager-test.cpp | 130 ++++++++++++++++++ .../core/proc/control/command-setup-test.cpp | 2 +- wiki/thinkPad.ichthyo.mm | 94 +++++++++++-- 5 files changed, 221 insertions(+), 12 deletions(-) create mode 100644 tests/core/proc/control/command-instance-manager-test.cpp diff --git a/src/proc/control/command-instance-manager.hpp b/src/proc/control/command-instance-manager.hpp index 0075a2cd8..71e6e4d8f 100644 --- a/src/proc/control/command-instance-manager.hpp +++ b/src/proc/control/command-instance-manager.hpp @@ -28,7 +28,7 @@ ** This creates the specific twist that possible command instances for invocation can and will ** be formed during an extended time period, non-deterministically -- since the actual context ** depends on the user interactions. Within the UI, there is a dedicated mechanism to form such - ** command invocation similar to forming sentences of a language (with subject, predication and + ** command invocations similar to forming sentences of a language (with subject, predication and ** possibly some further objects). The UI manages several InteractionStateManager instances to ** observe and pick up contextual state, finally leading to a complete parametrisation of a command. ** The CommandInstanceManager is a service to support this process; it prepares command instances diff --git a/tests/45controller.tests b/tests/45controller.tests index ce01bc4ae..b3121d233 100644 --- a/tests/45controller.tests +++ b/tests/45controller.tests @@ -122,6 +122,11 @@ return: 0 END +PLANNED "Command instance management" CommandInstanceManager_test < + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + +/** @file command-instance-manager-test.cpp + ** unit test \ref CommandInstanceManager_test + */ + + +#include "lib/test/run.hpp" +#include "proc/control/command-instance-manager.hpp" +#include "proc/control/command-dispatch.hpp" +//#include "proc/control/command-def.hpp" +#include "lib/format-string.hpp" +#include "lib/format-cout.hpp" +#include "lib/util.hpp" + +#include +#include + + +namespace proc { +namespace control { +namespace test { + + using lib::Literal; + using std::string; + using std::regex; + using std::regex_replace; + using util::isnil; + using util::_Fmt; + + + + + + namespace { // Test fixture.... + + struct Fixture + : CommandDispatch + { + bool has_commands_in_queue = false; + + + /* == Interface: CommandDispatch == */ + + void + clear() override + { + UNIMPLEMENTED("DummyDispatch-Interface: clear"); + } + + void + enqueue (Command) override + { + UNIMPLEMENTED("DummyDispatch-Interface: enqueue"); + } + }; + + } + + + + /***********************************************************************//** + * @test CommandInstanceManager is responsible for providing individual + * clone copies from a basic command definition, to be bound with + * actual arguments and finally handed over to the ProcDispatcher + * for invocation. + * + * @see proc::control::CommandInstanceManager + */ + class CommandInstanceManager_test : public Test + { + + virtual void + run (Arg) + { + verify_standardUsage(); + } + + + /** @test demonstrate the standard usage pattern of... + */ + void + verify_standardUsage() + { + UNIMPLEMENTED("standard usage cycle"); +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1089 + Fixture fixture; + CommandInstanceManager iManager{fixture}; + Symbol instanceID = iManager.newInstance(COMMAND_PROTOTYPE, INVOCATION_ID); + CHECK (Command::defined(instanceID)); + CHECK (not Command::canExec(instanceID)); + + Command cmd{instanceID}; + ///TODO bind arguments + CHECK (Command::canExec(instanceID)); + + iManager.dispatch (instanceID); + CHECK (not iManager.contains (instanceID)); + CHECK (fixture.contains (instanceID)); + CHECK (Command::canExec(instanceID)); +#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1089 + } + }; + + + /** Register this test class... */ + LAUNCHER (CommandInstanceManager_test, "unit controller"); + + +}}} // namespace proc::control::test diff --git a/tests/core/proc/control/command-setup-test.cpp b/tests/core/proc/control/command-setup-test.cpp index 08926d118..9bd692f3f 100644 --- a/tests/core/proc/control/command-setup-test.cpp +++ b/tests/core/proc/control/command-setup-test.cpp @@ -280,4 +280,4 @@ namespace test { LAUNCHER (CommandSetup_test, "unit controller"); -}}} // namespace proc::control::test +}}} // namespace proc::cmd::test diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index cee8883b4..834e1b898 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -788,7 +788,7 @@ - + @@ -1272,7 +1272,7 @@ - + @@ -1542,7 +1542,7 @@ - + @@ -1915,7 +1915,7 @@ - + @@ -11669,10 +11669,14 @@ - - - - + + + + + + + + @@ -11685,6 +11689,23 @@ + + + + + + + + + + + + + + + + + @@ -11904,12 +11925,13 @@ - + + - + @@ -12029,6 +12051,58 @@ + + + + + + + + + + + + + +

+ ...also ist eine Instanz durchaus noch am Leben, +

+

+ während bereits die nächste Instanz für das GUI ausgegeben wurde. +

+ + +
+ +
+ + + + + + + + + +

+ ...damit die Nummer erhalten bleibt +

+ + +
+
+
+ + + + + + + + + + +