simplebooktest.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. #include "testprec.h"
  9. #if wxUSE_BOOKCTRL
  10. #ifdef __BORLANDC__
  11. #pragma hdrstop
  12. #endif
  13. #ifndef WX_PRECOMP
  14. #include "wx/app.h"
  15. #include "wx/panel.h"
  16. #endif // WX_PRECOMP
  17. #include "wx/simplebook.h"
  18. #include "bookctrlbasetest.h"
  19. class SimplebookTestCase : public BookCtrlBaseTestCase, public CppUnit::TestCase
  20. {
  21. public:
  22. SimplebookTestCase() { }
  23. virtual void setUp();
  24. virtual void tearDown();
  25. private:
  26. virtual wxBookCtrlBase *GetBase() const { return m_simplebook; }
  27. virtual wxEventType GetChangedEvent() const
  28. { return wxEVT_BOOKCTRL_PAGE_CHANGED; }
  29. virtual wxEventType GetChangingEvent() const
  30. { return wxEVT_BOOKCTRL_PAGE_CHANGING; }
  31. CPPUNIT_TEST_SUITE( SimplebookTestCase );
  32. wxBOOK_CTRL_BASE_TESTS();
  33. CPPUNIT_TEST_SUITE_END();
  34. wxSimplebook *m_simplebook;
  35. DECLARE_NO_COPY_CLASS(SimplebookTestCase)
  36. };
  37. // register in the unnamed registry so that these tests are run by default
  38. CPPUNIT_TEST_SUITE_REGISTRATION( SimplebookTestCase );
  39. // also include in its own registry so that these tests can be run alone
  40. CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SimplebookTestCase, "SimplebookTestCase" );
  41. void SimplebookTestCase::setUp()
  42. {
  43. m_simplebook = new wxSimplebook(wxTheApp->GetTopWindow(), wxID_ANY);
  44. AddPanels();
  45. }
  46. void SimplebookTestCase::tearDown()
  47. {
  48. wxDELETE(m_simplebook);
  49. }
  50. #endif // wxUSE_BOOKCTRL