From effbb49afba11a865bfa07cc36eaf9fb77418b23 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 1 Oct 2009 01:51:47 +0200 Subject: [PATCH] Dummy HandingPattern implementation for unit tests --- src/proc/control/handling-patterns.hpp | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/proc/control/handling-patterns.hpp b/src/proc/control/handling-patterns.hpp index a5ee4486e..d8da74f5f 100644 --- a/src/proc/control/handling-patterns.hpp +++ b/src/proc/control/handling-patterns.hpp @@ -151,6 +151,37 @@ namespace control { + /** + * Handling Pattern: invoke command directly and without any integration + * with other facilities. This pattern is intended to be used for unit tests. + */ + class InvokeDirectly + : public HandlingPattern + { + void + perform (CommandImpl& command) const + { + REQUIRE (command.canExec()); + command.invokeCapture(); + command.invokeOperation(); + } + + void + revert(CommandImpl& command) const + { + REQUIRE (command.canUndo()); + command.invokeUndo(); + } + + bool + isValid() const + { + return true; + } + }; + + +