1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/listbooktest.cpp
3 // Purpose: wxListbook unit test
4 // Author: Steven Lamerton
7 // Copyright: (c) 2010 Steven Lamerton
8 ///////////////////////////////////////////////////////////////////////////////
23 #include "wx/listbook.h"
24 #include "wx/listctrl.h"
25 #include "bookctrlbasetest.h"
27 class ListbookTestCase
: public BookCtrlBaseTestCase
, public CppUnit::TestCase
30 ListbookTestCase() { }
33 virtual void tearDown();
36 virtual wxBookCtrlBase
*GetBase() const { return m_listbook
; }
38 virtual wxEventType
GetChangedEvent() const
39 { return wxEVT_LISTBOOK_PAGE_CHANGED
; }
41 virtual wxEventType
GetChangingEvent() const
42 { return wxEVT_LISTBOOK_PAGE_CHANGING
; }
44 CPPUNIT_TEST_SUITE( ListbookTestCase
);
45 wxBOOK_CTRL_BASE_TESTS();
46 CPPUNIT_TEST( ListView
);
47 CPPUNIT_TEST_SUITE_END();
51 wxListbook
*m_listbook
;
53 DECLARE_NO_COPY_CLASS(ListbookTestCase
)
56 // register in the unnamed registry so that these tests are run by default
57 CPPUNIT_TEST_SUITE_REGISTRATION( ListbookTestCase
);
59 // also include in its own registry so that these tests can be run alone
60 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ListbookTestCase
, "ListbookTestCase" );
62 void ListbookTestCase::setUp()
64 m_listbook
= new wxListbook(wxTheApp
->GetTopWindow(), wxID_ANY
,
65 wxDefaultPosition
, wxSize(400, 300));
69 void ListbookTestCase::tearDown()
74 void ListbookTestCase::ListView()
76 wxListView
* listview
= m_listbook
->GetListView();
78 CPPUNIT_ASSERT(listview
);
79 CPPUNIT_ASSERT_EQUAL(3, listview
->GetItemCount());
80 CPPUNIT_ASSERT_EQUAL("Panel 1", listview
->GetItemText(0));
83 #endif //wxUSE_LISTBOOK