Disable more tests in wxOSX/PPC build.
[wxWidgets.git] / tests / controls / listbooktest.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/listbooktest.cpp
3 // Purpose: wxListbook 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_LISTBOOK
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/listbook.h"
24 #include "wx/listctrl.h"
25 #include "bookctrlbasetest.h"
26
27 class ListbookTestCase : public BookCtrlBaseTestCase, public CppUnit::TestCase
28 {
29 public:
30 ListbookTestCase() { }
31
32 virtual void setUp();
33 virtual void tearDown();
34
35 private:
36 virtual wxBookCtrlBase *GetBase() const { return m_listbook; }
37
38 virtual wxEventType GetChangedEvent() const
39 { return wxEVT_LISTBOOK_PAGE_CHANGED; }
40
41 virtual wxEventType GetChangingEvent() const
42 { return wxEVT_LISTBOOK_PAGE_CHANGING; }
43
44 CPPUNIT_TEST_SUITE( ListbookTestCase );
45 wxBOOK_CTRL_BASE_TESTS();
46 CPPUNIT_TEST( ListView );
47 CPPUNIT_TEST_SUITE_END();
48
49 void ListView();
50
51 wxListbook *m_listbook;
52
53 DECLARE_NO_COPY_CLASS(ListbookTestCase)
54 };
55
56 // register in the unnamed registry so that these tests are run by default
57 CPPUNIT_TEST_SUITE_REGISTRATION( ListbookTestCase );
58
59 // also include in its own registry so that these tests can be run alone
60 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ListbookTestCase, "ListbookTestCase" );
61
62 void ListbookTestCase::setUp()
63 {
64 m_listbook = new wxListbook(wxTheApp->GetTopWindow(), wxID_ANY,
65 wxDefaultPosition, wxSize(400, 300));
66 AddPanels();
67 }
68
69 void ListbookTestCase::tearDown()
70 {
71 wxDELETE(m_listbook);
72 }
73
74 void ListbookTestCase::ListView()
75 {
76 wxListView* listview = m_listbook->GetListView();
77
78 CPPUNIT_ASSERT(listview);
79 CPPUNIT_ASSERT_EQUAL(3, listview->GetItemCount());
80 CPPUNIT_ASSERT_EQUAL("Panel 1", listview->GetItemText(0));
81 }
82
83 #endif //wxUSE_LISTBOOK