1 /////////////////////////////////////////////////////////////////////////////// 2 // Name: tests/controls/simplebooktest.cpp 3 // Purpose: wxSimplebook unit test 4 // Author: Vadim Zeitlin 5 // Created: 2013-06-23 6 // Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org> 7 /////////////////////////////////////////////////////////////////////////////// 8 9 #include "testprec.h" 10 11 #if wxUSE_BOOKCTRL 12 13 14 #ifndef WX_PRECOMP 15 #include "wx/app.h" 16 #include "wx/panel.h" 17 #endif // WX_PRECOMP 18 19 #include "wx/simplebook.h" 20 #include "bookctrlbasetest.h" 21 22 class SimplebookTestCase : public BookCtrlBaseTestCase, public CppUnit::TestCase 23 { 24 public: SimplebookTestCase()25 SimplebookTestCase() { } 26 27 virtual void setUp() wxOVERRIDE; 28 virtual void tearDown() wxOVERRIDE; 29 30 private: GetBase() const31 virtual wxBookCtrlBase *GetBase() const wxOVERRIDE { return m_simplebook; } 32 GetChangedEvent() const33 virtual wxEventType GetChangedEvent() const wxOVERRIDE 34 { return wxEVT_BOOKCTRL_PAGE_CHANGED; } 35 GetChangingEvent() const36 virtual wxEventType GetChangingEvent() const wxOVERRIDE 37 { return wxEVT_BOOKCTRL_PAGE_CHANGING; } 38 39 CPPUNIT_TEST_SUITE( SimplebookTestCase ); 40 wxBOOK_CTRL_BASE_TESTS(); 41 CPPUNIT_TEST_SUITE_END(); 42 43 wxSimplebook *m_simplebook; 44 45 wxDECLARE_NO_COPY_CLASS(SimplebookTestCase); 46 }; 47 48 // register in the unnamed registry so that these tests are run by default 49 CPPUNIT_TEST_SUITE_REGISTRATION( SimplebookTestCase ); 50 51 // also include in its own registry so that these tests can be run alone 52 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SimplebookTestCase, "SimplebookTestCase" ); 53 setUp()54void SimplebookTestCase::setUp() 55 { 56 m_simplebook = new wxSimplebook(wxTheApp->GetTopWindow(), wxID_ANY); 57 AddPanels(); 58 } 59 tearDown()60void SimplebookTestCase::tearDown() 61 { 62 wxDELETE(m_simplebook); 63 } 64 65 #endif // wxUSE_BOOKCTRL 66 67