Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/ActionSequenceTest.cpp

    r80951de rec149d  
    1717#include "Actions/ActionRegistry.hpp"
    1818
     19#include "DummyUI.hpp"
     20
    1921#ifdef HAVE_TESTRUNNER
    2022#include "UnitTestMain.hpp"
     
    3335  virtual ~canUndoActionStub(){}
    3436
    35   virtual Dialog* createDialog(){
    36     return NULL;
     37  virtual Dialog* fillDialog(Dialog *dialog){
     38    ASSERT(dialog,"No Dialog given when filling action dialog");
     39    return dialog;
    3740  }
    3841
     
    6063  virtual ~cannotUndoActionStub(){}
    6164
    62   virtual Dialog* createDialog(){
    63     return NULL;
     65  virtual Dialog* fillDialog(Dialog *dialog){
     66    ASSERT(dialog,"No Dialog given when filling action dialog");
     67    return dialog;
    6468  }
    6569
     
    9094  virtual ~wasCalledActionStub(){}
    9195
    92   virtual Dialog* createDialog(){
    93     return NULL;
     96  virtual Dialog* fillDialog(Dialog *dialog){
     97    return dialog;
    9498  }
    9599  virtual Action::state_ptr performCall(){
     
    119123
    120124void ActionSequenceTest::setUp(){
     125  static bool hasDescriptor = false;
    121126  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");
    122133  // create some necessary stubs used in this test
    123134  positive1 = new canUndoActionStub();
     
    146157  ActionHistory::purgeInstance();
    147158  ActionRegistry::purgeInstance();
     159  UIFactory::purgeInstance();
    148160}
    149161
     
    231243
    232244  CPPUNIT_ASSERT_EQUAL(true,wasCalled1->wasCalled());
    233   CPPUNIT_ASSERT_EQUAL(true,wasCalled1->wasCalled());
     245  CPPUNIT_ASSERT_EQUAL(true,wasCalled2->wasCalled());
    234246
    235247  ActionHistory::getInstance().undoLast();
    236248
    237249  CPPUNIT_ASSERT_EQUAL(false,wasCalled1->wasCalled());
    238   CPPUNIT_ASSERT_EQUAL(false,wasCalled1->wasCalled());
    239 
    240 }
    241 
    242 
     250  CPPUNIT_ASSERT_EQUAL(false,wasCalled2->wasCalled());
     251
     252}
     253
     254
Note: See TracChangeset for help on using the changeset viewer.