1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/listbooktest.cpp
3 // Purpose: wxListbook unit test
4 // Author: Steven Lamerton
6 // Copyright: (c) 2010 Steven Lamerton
7 ///////////////////////////////////////////////////////////////////////////////
22 #include "wx/listbook.h"
23 #include "wx/listctrl.h"
24 #include "bookctrlbasetest.h"
26 class ListbookTestCase
: public BookCtrlBaseTestCase
, public CppUnit::TestCase
29 ListbookTestCase() { }
32 virtual void tearDown();
35 virtual wxBookCtrlBase
*GetBase() const { return m_listbook
; }
37 virtual wxEventType
GetChangedEvent() const
38 { return wxEVT_LISTBOOK_PAGE_CHANGED
; }
40 virtual wxEventType
GetChangingEvent() const
41 { return wxEVT_LISTBOOK_PAGE_CHANGING
; }
43 CPPUNIT_TEST_SUITE( ListbookTestCase
);
44 wxBOOK_CTRL_BASE_TESTS();
45 CPPUNIT_TEST( ListView
);
46 CPPUNIT_TEST_SUITE_END();
50 wxListbook
*m_listbook
;
52 DECLARE_NO_COPY_CLASS(ListbookTestCase
)
55 // register in the unnamed registry so that these tests are run by default
56 CPPUNIT_TEST_SUITE_REGISTRATION( ListbookTestCase
);
58 // also include in its own registry so that these tests can be run alone
59 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ListbookTestCase
, "ListbookTestCase" );
61 void ListbookTestCase::setUp()
63 m_listbook
= new wxListbook(wxTheApp
->GetTopWindow(), wxID_ANY
,
64 wxDefaultPosition
, wxSize(400, 300));
68 void ListbookTestCase::tearDown()
73 void ListbookTestCase::ListView()
75 wxListView
* listview
= m_listbook
->GetListView();
77 CPPUNIT_ASSERT(listview
);
78 CPPUNIT_ASSERT_EQUAL(3, listview
->GetItemCount());
79 CPPUNIT_ASSERT_EQUAL("Panel 1", listview
->GetItemText(0));
82 #endif //wxUSE_LISTBOOK