1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/choicebooktest.cpp
3 // Purpose: wxChoicebook unit test
4 // Author: Steven Lamerton
7 // Copyright: (c) 2010 Steven Lamerton
8 ///////////////////////////////////////////////////////////////////////////////
23 #include "wx/choicebk.h"
24 #include "bookctrlbasetest.h"
26 class ChoicebookTestCase
: public BookCtrlBaseTestCase
, public CppUnit::TestCase
29 ChoicebookTestCase() { }
32 virtual void tearDown();
35 virtual wxBookCtrlBase
*GetBase() const { return m_choicebook
; }
37 virtual wxEventType
GetChangedEvent() const
38 { return wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED
; }
40 virtual wxEventType
GetChangingEvent() const
41 { return wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING
; }
43 CPPUNIT_TEST_SUITE( ChoicebookTestCase
);
44 wxBOOK_CTRL_BASE_TESTS();
45 CPPUNIT_TEST( Choice
);
46 CPPUNIT_TEST_SUITE_END();
50 wxChoicebook
*m_choicebook
;
52 DECLARE_NO_COPY_CLASS(ChoicebookTestCase
)
55 // register in the unnamed registry so that these tests are run by default
56 CPPUNIT_TEST_SUITE_REGISTRATION( ChoicebookTestCase
);
58 // also include in it's own registry so that these tests can be run alone
59 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ChoicebookTestCase
, "ChoicebookTestCase" );
61 void ChoicebookTestCase::setUp()
63 m_choicebook
= new wxChoicebook(wxTheApp
->GetTopWindow(), wxID_ANY
);
67 void ChoicebookTestCase::tearDown()
69 wxDELETE(m_choicebook
);
72 void ChoicebookTestCase::Choice()
74 wxChoice
* choice
= m_choicebook
->GetChoiceCtrl();
76 CPPUNIT_ASSERT(choice
);
77 CPPUNIT_ASSERT_EQUAL(3, choice
->GetCount());
78 CPPUNIT_ASSERT_EQUAL("Panel 1", choice
->GetString(0));
81 #endif //wxUSE_CHOICEBOOK