]> git.saurik.com Git - wxWidgets.git/blob - tests/controls/toolbooktest.cpp
Minor fixes to allow web sample to compile
[wxWidgets.git] / tests / controls / toolbooktest.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/toolbooktest.cpp
3 // Purpose: wxToolbook unit test
4 // Author: Steven Lamerton
5 // Created: 2010-07-02
6 // RCS-ID: $Id$
7 // Copyright: (c) 2010 Steven Lamerton
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #include "testprec.h"
11
12 #if wxUSE_TOOLBOOK
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #ifndef WX_PRECOMP
19 #include "wx/app.h"
20 #include "wx/panel.h"
21 #endif // WX_PRECOMP
22
23 #include "wx/toolbook.h"
24 #include "wx/toolbar.h"
25 #include "bookctrlbasetest.h"
26
27 class ToolbookTestCase : public BookCtrlBaseTestCase, public CppUnit::TestCase
28 {
29 public:
30 ToolbookTestCase() { }
31
32 virtual void setUp();
33 virtual void tearDown();
34
35 private:
36 virtual wxBookCtrlBase *GetBase() const { return m_toolbook; }
37
38 virtual wxEventType GetChangedEvent() const
39 { return wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED; }
40
41 virtual wxEventType GetChangingEvent() const
42 { return wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING; }
43
44 CPPUNIT_TEST_SUITE( ToolbookTestCase );
45 wxBOOK_CTRL_BASE_TESTS();
46 CPPUNIT_TEST( ToolBar );
47 CPPUNIT_TEST_SUITE_END();
48
49 void ToolBar();
50
51 wxToolbook *m_toolbook;
52
53 DECLARE_NO_COPY_CLASS(ToolbookTestCase)
54 };
55
56 // register in the unnamed registry so that these tests are run by default
57 CPPUNIT_TEST_SUITE_REGISTRATION( ToolbookTestCase );
58
59 // also include in its own registry so that these tests can be run alone
60 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ToolbookTestCase, "ToolbookTestCase" );
61
62 void ToolbookTestCase::setUp()
63 {
64 m_toolbook = new wxToolbook(wxTheApp->GetTopWindow(), wxID_ANY, wxDefaultPosition, wxSize(400, 200));
65 AddPanels();
66 }
67
68 void ToolbookTestCase::tearDown()
69 {
70 wxDELETE(m_toolbook);
71 }
72
73 void ToolbookTestCase::ToolBar()
74 {
75 wxToolBar* toolbar = static_cast<wxToolBar*>(m_toolbook->GetToolBar());
76
77 CPPUNIT_ASSERT(toolbar);
78 CPPUNIT_ASSERT_EQUAL(3, toolbar->GetToolsCount());
79 }
80
81 #endif //wxUSE_TOOLBOOK