1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/notebooktest.cpp
3 // Purpose: wxNotebook unit test
4 // Author: Steven Lamerton
6 // Copyright: (c) 2010 Steven Lamerton
7 ///////////////////////////////////////////////////////////////////////////////
22 #include "wx/notebook.h"
23 #include "bookctrlbasetest.h"
25 class NotebookTestCase
: public BookCtrlBaseTestCase
, public CppUnit::TestCase
28 NotebookTestCase() { }
31 virtual void tearDown();
34 virtual wxBookCtrlBase
*GetBase() const { return m_notebook
; }
36 virtual wxEventType
GetChangedEvent() const
37 { return wxEVT_NOTEBOOK_PAGE_CHANGED
; }
39 virtual wxEventType
GetChangingEvent() const
40 { return wxEVT_NOTEBOOK_PAGE_CHANGING
; }
43 CPPUNIT_TEST_SUITE( NotebookTestCase
);
44 wxBOOK_CTRL_BASE_TESTS();
45 CPPUNIT_TEST( Image
);
46 CPPUNIT_TEST( RowCount
);
47 CPPUNIT_TEST_SUITE_END();
51 wxNotebook
*m_notebook
;
53 DECLARE_NO_COPY_CLASS(NotebookTestCase
)
56 // register in the unnamed registry so that these tests are run by default
57 CPPUNIT_TEST_SUITE_REGISTRATION( NotebookTestCase
);
59 // also include in its own registry so that these tests can be run alone
60 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( NotebookTestCase
, "NotebookTestCase" );
62 void NotebookTestCase::setUp()
64 m_notebook
= new wxNotebook(wxTheApp
->GetTopWindow(), wxID_ANY
,
65 wxDefaultPosition
, wxSize(400, 200));
69 void NotebookTestCase::tearDown()
74 void NotebookTestCase::RowCount()
76 CPPUNIT_ASSERT_EQUAL(1, m_notebook
->GetRowCount());
80 m_notebook
= new wxNotebook(wxTheApp
->GetTopWindow(), wxID_ANY
,
81 wxDefaultPosition
, wxSize(400, 200),
84 for( unsigned int i
= 0; i
< 10; i
++ )
86 m_notebook
->AddPage(new wxPanel(m_notebook
), "Panel", false, 0);
89 CPPUNIT_ASSERT( m_notebook
->GetRowCount() != 1 );
93 #endif //wxUSE_NOTEBOOK