Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/ActionSequenceTest.cpp

    r2efa90 rec149d  
    1717#include "Actions/ActionRegistry.hpp"
    1818
     19#include "DummyUI.hpp"
     20
    1921#ifdef HAVE_TESTRUNNER
    2022#include "UnitTestMain.hpp"
     
    3335  virtual ~canUndoActionStub(){}
    3436
     37  virtual Dialog* fillDialog(Dialog *dialog){
     38    ASSERT(dialog,"No Dialog given when filling action dialog");
     39    return dialog;
     40  }
     41
    3542  virtual Action::state_ptr performCall(){
    3643    return Action::success;
     
    5562  cannotUndoActionStub() : Action("cannotUndoActionStub",false){}
    5663  virtual ~cannotUndoActionStub(){}
     64
     65  virtual Dialog* fillDialog(Dialog *dialog){
     66    ASSERT(dialog,"No Dialog given when filling action dialog");
     67    return dialog;
     68  }
    5769
    5870  virtual Action::state_ptr performCall(){
     
    8294  virtual ~wasCalledActionStub(){}
    8395
     96  virtual Dialog* fillDialog(Dialog *dialog){
     97    return dialog;
     98  }
    8499  virtual Action::state_ptr performCall(){
    85100    called = true;
     
    108123
    109124void ActionSequenceTest::setUp(){
     125  static bool hasDescriptor = false;
    110126  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");
    111133  // create some necessary stubs used in this test
    112134  positive1 = new canUndoActionStub();
     
    135157  ActionHistory::purgeInstance();
    136158  ActionRegistry::purgeInstance();
     159  UIFactory::purgeInstance();
    137160}
    138161
     
    220243
    221244  CPPUNIT_ASSERT_EQUAL(true,wasCalled1->wasCalled());
    222   CPPUNIT_ASSERT_EQUAL(true,wasCalled1->wasCalled());
     245  CPPUNIT_ASSERT_EQUAL(true,wasCalled2->wasCalled());
    223246
    224247  ActionHistory::getInstance().undoLast();
    225248
    226249  CPPUNIT_ASSERT_EQUAL(false,wasCalled1->wasCalled());
    227   CPPUNIT_ASSERT_EQUAL(false,wasCalled1->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.