- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/ActionSequenceTest.cpp
r2efa90 rec149d 17 17 #include "Actions/ActionRegistry.hpp" 18 18 19 #include "DummyUI.hpp" 20 19 21 #ifdef HAVE_TESTRUNNER 20 22 #include "UnitTestMain.hpp" … … 33 35 virtual ~canUndoActionStub(){} 34 36 37 virtual Dialog* fillDialog(Dialog *dialog){ 38 ASSERT(dialog,"No Dialog given when filling action dialog"); 39 return dialog; 40 } 41 35 42 virtual Action::state_ptr performCall(){ 36 43 return Action::success; … … 55 62 cannotUndoActionStub() : Action("cannotUndoActionStub",false){} 56 63 virtual ~cannotUndoActionStub(){} 64 65 virtual Dialog* fillDialog(Dialog *dialog){ 66 ASSERT(dialog,"No Dialog given when filling action dialog"); 67 return dialog; 68 } 57 69 58 70 virtual Action::state_ptr performCall(){ … … 82 94 virtual ~wasCalledActionStub(){} 83 95 96 virtual Dialog* fillDialog(Dialog *dialog){ 97 return dialog; 98 } 84 99 virtual Action::state_ptr performCall(){ 85 100 called = true; … … 108 123 109 124 void ActionSequenceTest::setUp(){ 125 static bool hasDescriptor = false; 110 126 ActionHistory::init(); 127 // TODO: find a way to really reset the factory to a clean state in tear-down 128 if(!hasDescriptor){ 129 UIFactory::registerFactory(new DummyUIFactory::description()); 130 hasDescriptor = true; 131 } 132 UIFactory::makeUserInterface("Dummy"); 111 133 // create some necessary stubs used in this test 112 134 positive1 = new canUndoActionStub(); … … 135 157 ActionHistory::purgeInstance(); 136 158 ActionRegistry::purgeInstance(); 159 UIFactory::purgeInstance(); 137 160 } 138 161 … … 220 243 221 244 CPPUNIT_ASSERT_EQUAL(true,wasCalled1->wasCalled()); 222 CPPUNIT_ASSERT_EQUAL(true,wasCalled 1->wasCalled());245 CPPUNIT_ASSERT_EQUAL(true,wasCalled2->wasCalled()); 223 246 224 247 ActionHistory::getInstance().undoLast(); 225 248 226 249 CPPUNIT_ASSERT_EQUAL(false,wasCalled1->wasCalled()); 227 CPPUNIT_ASSERT_EQUAL(false,wasCalled 1->wasCalled());228 229 } 230 231 250 CPPUNIT_ASSERT_EQUAL(false,wasCalled2->wasCalled()); 251 252 } 253 254
Note:
See TracChangeset
for help on using the changeset viewer.