1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/notebooktest.cpp
3 // Purpose: wxNotebook unit test
4 // Author: Steven Lamerton
7 // Copyright: (c) 2010 Steven Lamerton
8 ///////////////////////////////////////////////////////////////////////////////
23 #include "wx/notebook.h"
24 #include "bookctrlbasetest.h"
26 class NotebookTestCase
: public BookCtrlBaseTestCase
, public CppUnit::TestCase
29 NotebookTestCase() { }
32 virtual void tearDown();
35 virtual wxBookCtrlBase
*GetBase() const { return m_notebook
; }
37 virtual wxEventType
GetChangedEvent() const
38 { return wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
; }
40 virtual wxEventType
GetChangingEvent() const
41 { return wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
; }
44 CPPUNIT_TEST_SUITE( NotebookTestCase
);
45 wxBOOK_CTRL_BASE_TESTS();
46 CPPUNIT_TEST( Image
);
47 CPPUNIT_TEST( RowCount
);
48 CPPUNIT_TEST_SUITE_END();
52 wxNotebook
*m_notebook
;
54 DECLARE_NO_COPY_CLASS(NotebookTestCase
)
57 // register in the unnamed registry so that these tests are run by default
58 CPPUNIT_TEST_SUITE_REGISTRATION( NotebookTestCase
);
60 // also include in it's own registry so that these tests can be run alone
61 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( NotebookTestCase
, "NotebookTestCase" );
63 void NotebookTestCase::setUp()
65 m_notebook
= new wxNotebook(wxTheApp
->GetTopWindow(), wxID_ANY
,
66 wxDefaultPosition
, wxSize(400, 200));
70 void NotebookTestCase::tearDown()
75 void NotebookTestCase::RowCount()
77 CPPUNIT_ASSERT_EQUAL(1, m_notebook
->GetRowCount());
81 m_notebook
= new wxNotebook(wxTheApp
->GetTopWindow(), wxID_ANY
,
82 wxDefaultPosition
, wxSize(400, 200),
85 for( unsigned int i
= 0; i
< 10; i
++ )
87 m_notebook
->AddPage(new wxPanel(m_notebook
), "Panel", false, 0);
90 CPPUNIT_ASSERT( m_notebook
->GetRowCount() != 1 );
94 #endif //wxUSE_NOTEBOOK