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_TOOLBOOK_PAGE_CHANGED
; }
41 virtual wxEventType
GetChangingEvent() const
42 { return wxEVT_TOOLBOOK_PAGE_CHANGING
; }
44 virtual void Realize() { m_toolbook
->GetToolBar()->Realize(); }
46 CPPUNIT_TEST_SUITE( ToolbookTestCase
);
47 wxBOOK_CTRL_BASE_TESTS();
48 CPPUNIT_TEST( ToolBar
);
49 CPPUNIT_TEST_SUITE_END();
53 wxToolbook
*m_toolbook
;
55 DECLARE_NO_COPY_CLASS(ToolbookTestCase
)
58 // register in the unnamed registry so that these tests are run by default
59 CPPUNIT_TEST_SUITE_REGISTRATION( ToolbookTestCase
);
61 // also include in its own registry so that these tests can be run alone
62 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ToolbookTestCase
, "ToolbookTestCase" );
64 void ToolbookTestCase::setUp()
66 m_toolbook
= new wxToolbook(wxTheApp
->GetTopWindow(), wxID_ANY
, wxDefaultPosition
, wxSize(400, 200));
70 void ToolbookTestCase::tearDown()
75 void ToolbookTestCase::ToolBar()
77 wxToolBar
* toolbar
= static_cast<wxToolBar
*>(m_toolbook
->GetToolBar());
79 CPPUNIT_ASSERT(toolbar
);
80 CPPUNIT_ASSERT_EQUAL(3, toolbar
->GetToolsCount());
83 #endif //wxUSE_TOOLBOOK