Changeset abd4a1 for molecuilder/src/unittests/ActionSequenceTest.cpp
- Timestamp:
- Apr 8, 2010, 2:00:11 PM (16 years ago)
- Children:
- 91b18cd
- Parents:
- 770138
- File:
-
- 1 edited
-
molecuilder/src/unittests/ActionSequenceTest.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/unittests/ActionSequenceTest.cpp
r770138 rabd4a1 13 13 #include "Actions/Action.hpp" 14 14 #include "Actions/ActionSequence.hpp" 15 #include "Actions/MakroAction.hpp" 16 #include "Actions/ActionHistory.hpp" 17 #include "Actions/ActionRegistry.hpp" 15 18 16 19 #ifdef HAVE_TESTRUNNER … … 22 25 // Registers the fixture into the 'registry' 23 26 CPPUNIT_TEST_SUITE_REGISTRATION( ActionSequenceTest ); 24 25 void setUp();26 void tearDown();27 28 void canUndoTest();29 27 30 28 /* some neccessary stubs for tests */ … … 110 108 111 109 void ActionSequenceTest::setUp(){ 110 ActionHistory::init(); 112 111 // create some necessary stubs used in this test 113 112 positive1 = new canUndoActionStub(); … … 134 133 delete shouldNotCall2; 135 134 135 ActionHistory::purgeInstance(); 136 ActionRegistry::purgeInstance(); 136 137 } 137 138 … … 209 210 void ActionSequenceTest::doesUndoTest(){ 210 211 ActionSequence *sequence = new ActionSequence(); 211 sequence->addAction(shouldNotCall1); 212 sequence->addAction(shouldNotCall2); 213 sequence->addAction(shouldCall1); 214 sequence->addAction(shouldCall2); 215 216 ActionSequence::stateSet states = sequence->callAll(); 217 218 sequence->removeLastAction(); 219 sequence->removeLastAction(); 220 221 sequence->undoAll(states); 222 223 CPPUNIT_ASSERT_EQUAL(true,shouldCall1->wasCalled()); 224 CPPUNIT_ASSERT_EQUAL(true,shouldCall2->wasCalled()); 225 CPPUNIT_ASSERT_EQUAL(false,shouldNotCall1->wasCalled()); 226 CPPUNIT_ASSERT_EQUAL(false,shouldNotCall2->wasCalled()); 227 228 delete sequence; 229 } 230 231 212 wasCalledActionStub *wasCalled1 = new wasCalledActionStub(); 213 wasCalledActionStub *wasCalled2 = new wasCalledActionStub(); 214 sequence->addAction(wasCalled1); 215 sequence->addAction(wasCalled2); 216 217 MakroAction act("Test MakroAction",sequence,false); 218 219 act.call(); 220 221 CPPUNIT_ASSERT_EQUAL(true,wasCalled1->wasCalled()); 222 CPPUNIT_ASSERT_EQUAL(true,wasCalled1->wasCalled()); 223 224 ActionHistory::getInstance().undoLast(); 225 226 CPPUNIT_ASSERT_EQUAL(false,wasCalled1->wasCalled()); 227 CPPUNIT_ASSERT_EQUAL(false,wasCalled1->wasCalled()); 228 229 } 230 231
Note:
See TracChangeset
for help on using the changeset viewer.
