]> git.saurik.com Git - wxWidgets.git/blame_incremental - tests/controls/simplebooktest.cpp
Add a minimal unit test for wxSimplebook.
[wxWidgets.git] / tests / controls / simplebooktest.cpp
... / ...
CommitLineData
1///////////////////////////////////////////////////////////////////////////////
2// Name: tests/controls/simplebooktest.cpp
3// Purpose: wxSimplebook unit test
4// Author: Vadim Zeitlin
5// Created: 2013-06-23
6// RCS-ID: $Id$
7// Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org>
8///////////////////////////////////////////////////////////////////////////////
9
10#include "testprec.h"
11
12#if wxUSE_BOOKCTRL
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/simplebook.h"
24#include "bookctrlbasetest.h"
25
26class SimplebookTestCase : public BookCtrlBaseTestCase, public CppUnit::TestCase
27{
28public:
29 SimplebookTestCase() { }
30
31 virtual void setUp();
32 virtual void tearDown();
33
34private:
35 virtual wxBookCtrlBase *GetBase() const { return m_simplebook; }
36
37 virtual wxEventType GetChangedEvent() const
38 { return wxEVT_BOOKCTRL_PAGE_CHANGED; }
39
40 virtual wxEventType GetChangingEvent() const
41 { return wxEVT_BOOKCTRL_PAGE_CHANGING; }
42
43 CPPUNIT_TEST_SUITE( SimplebookTestCase );
44 wxBOOK_CTRL_BASE_TESTS();
45 CPPUNIT_TEST_SUITE_END();
46
47 wxSimplebook *m_simplebook;
48
49 DECLARE_NO_COPY_CLASS(SimplebookTestCase)
50};
51
52// register in the unnamed registry so that these tests are run by default
53CPPUNIT_TEST_SUITE_REGISTRATION( SimplebookTestCase );
54
55// also include in its own registry so that these tests can be run alone
56CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SimplebookTestCase, "SimplebookTestCase" );
57
58void SimplebookTestCase::setUp()
59{
60 m_simplebook = new wxSimplebook(wxTheApp->GetTopWindow(), wxID_ANY);
61 AddPanels();
62}
63
64void SimplebookTestCase::tearDown()
65{
66 wxDELETE(m_simplebook);
67}
68
69#endif // wxUSE_BOOKCTRL
70