1 /////////////////////////////////////////////////////////////////////////////// 
   2 // Name:        tests/controls/choicebooktest.cpp 
   3 // Purpose:     wxChoicebook unit test 
   4 // Author:      Steven Lamerton 
   6 // Copyright:   (c) 2010 Steven Lamerton 
   7 /////////////////////////////////////////////////////////////////////////////// 
  22 #include "wx/choicebk.h" 
  23 #include "bookctrlbasetest.h" 
  25 class ChoicebookTestCase 
: public BookCtrlBaseTestCase
, public CppUnit::TestCase
 
  28     ChoicebookTestCase() { } 
  31     virtual void tearDown(); 
  34     virtual wxBookCtrlBase 
*GetBase() const { return m_choicebook
; } 
  36     virtual wxEventType 
GetChangedEvent() const 
  37     { return wxEVT_CHOICEBOOK_PAGE_CHANGED
; } 
  39     virtual wxEventType 
GetChangingEvent() const 
  40     { return wxEVT_CHOICEBOOK_PAGE_CHANGING
; } 
  42     CPPUNIT_TEST_SUITE( ChoicebookTestCase 
); 
  43         wxBOOK_CTRL_BASE_TESTS(); 
  44         CPPUNIT_TEST( Choice 
); 
  45     CPPUNIT_TEST_SUITE_END(); 
  49     wxChoicebook 
*m_choicebook
; 
  51     DECLARE_NO_COPY_CLASS(ChoicebookTestCase
) 
  54 // register in the unnamed registry so that these tests are run by default 
  55 CPPUNIT_TEST_SUITE_REGISTRATION( ChoicebookTestCase 
); 
  57 // also include in its own registry so that these tests can be run alone 
  58 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ChoicebookTestCase
, "ChoicebookTestCase" ); 
  60 void ChoicebookTestCase::setUp() 
  62     m_choicebook 
= new wxChoicebook(wxTheApp
->GetTopWindow(), wxID_ANY
); 
  66 void ChoicebookTestCase::tearDown() 
  68     wxDELETE(m_choicebook
); 
  71 void ChoicebookTestCase::Choice() 
  73     wxChoice
* choice 
= m_choicebook
->GetChoiceCtrl(); 
  75     CPPUNIT_ASSERT(choice
); 
  76     CPPUNIT_ASSERT_EQUAL(3, choice
->GetCount()); 
  77     CPPUNIT_ASSERT_EQUAL("Panel 1", choice
->GetString(0)); 
  80 #endif //wxUSE_CHOICEBOOK