1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/toolbooktest.cpp
3 // Purpose: wxToolbook unit test
4 // Author: Steven Lamerton
6 // Copyright: (c) 2010 Steven Lamerton
7 ///////////////////////////////////////////////////////////////////////////////
22 #include "wx/toolbook.h"
23 #include "wx/toolbar.h"
24 #include "bookctrlbasetest.h"
26 class ToolbookTestCase
: public BookCtrlBaseTestCase
, public CppUnit::TestCase
29 ToolbookTestCase() { }
32 virtual void tearDown();
35 virtual wxBookCtrlBase
*GetBase() const { return m_toolbook
; }
37 virtual wxEventType
GetChangedEvent() const
38 { return wxEVT_TOOLBOOK_PAGE_CHANGED
; }
40 virtual wxEventType
GetChangingEvent() const
41 { return wxEVT_TOOLBOOK_PAGE_CHANGING
; }
43 virtual void Realize() { m_toolbook
->GetToolBar()->Realize(); }
45 CPPUNIT_TEST_SUITE( ToolbookTestCase
);
46 wxBOOK_CTRL_BASE_TESTS();
47 CPPUNIT_TEST( ToolBar
);
48 CPPUNIT_TEST_SUITE_END();
52 wxToolbook
*m_toolbook
;
54 DECLARE_NO_COPY_CLASS(ToolbookTestCase
)
57 // register in the unnamed registry so that these tests are run by default
58 CPPUNIT_TEST_SUITE_REGISTRATION( ToolbookTestCase
);
60 // also include in its own registry so that these tests can be run alone
61 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ToolbookTestCase
, "ToolbookTestCase" );
63 void ToolbookTestCase::setUp()
65 m_toolbook
= new wxToolbook(wxTheApp
->GetTopWindow(), wxID_ANY
, wxDefaultPosition
, wxSize(400, 200));
69 void ToolbookTestCase::tearDown()
74 void ToolbookTestCase::ToolBar()
76 wxToolBar
* toolbar
= static_cast<wxToolBar
*>(m_toolbook
->GetToolBar());
78 CPPUNIT_ASSERT(toolbar
);
79 CPPUNIT_ASSERT_EQUAL(3, toolbar
->GetToolsCount());
82 #endif //wxUSE_TOOLBOOK