1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/toolbooktest.cpp
3 // Purpose: wxToolbook unit test
4 // Author: Steven Lamerton
7 // Copyright: (c) 2010 Steven Lamerton
8 ///////////////////////////////////////////////////////////////////////////////
23 #include "wx/toolbook.h"
24 #include "wx/toolbar.h"
25 #include "bookctrlbasetest.h"
27 class ToolbookTestCase
: public BookCtrlBaseTestCase
, public CppUnit::TestCase
30 ToolbookTestCase() { }
33 virtual void tearDown();
36 virtual wxBookCtrlBase
*GetBase() const { return m_toolbook
; }
38 virtual wxEventType
GetChangedEvent() const
39 { return wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED
; }
41 virtual wxEventType
GetChangingEvent() const
42 { return wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING
; }
44 CPPUNIT_TEST_SUITE( ToolbookTestCase
);
45 wxBOOK_CTRL_BASE_TESTS();
46 CPPUNIT_TEST( ToolBar
);
47 CPPUNIT_TEST_SUITE_END();
51 wxToolbook
*m_toolbook
;
53 DECLARE_NO_COPY_CLASS(ToolbookTestCase
)
56 // register in the unnamed registry so that these tests are run by default
57 CPPUNIT_TEST_SUITE_REGISTRATION( ToolbookTestCase
);
59 // also include in it's own registry so that these tests can be run alone
60 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ToolbookTestCase
, "ToolbookTestCase" );
62 void ToolbookTestCase::setUp()
64 m_toolbook
= new wxToolbook(wxTheApp
->GetTopWindow(), wxID_ANY
, wxDefaultPosition
, wxSize(400, 200));
68 void ToolbookTestCase::tearDown()
73 void ToolbookTestCase::ToolBar()
75 wxToolBar
* toolbar
= static_cast<wxToolBar
*>(m_toolbook
->GetToolBar());
77 CPPUNIT_ASSERT(toolbar
);
78 CPPUNIT_ASSERT_EQUAL(3, toolbar
->GetToolsCount());
81 #endif //wxUSE_TOOLBOOK