]> git.saurik.com Git - wxWidgets.git/blame - tests/controls/choicebooktest.cpp
Make wxMSW wxSpinCtrl "not enough space" messages more helpful.
[wxWidgets.git] / tests / controls / choicebooktest.cpp
CommitLineData
232fdc63
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: tests/controls/choicebooktest.cpp
3// Purpose: wxChoicebook unit test
4// Author: Steven Lamerton
5// Created: 2010-07-02
6// RCS-ID: $Id$
7// Copyright: (c) 2010 Steven Lamerton
8///////////////////////////////////////////////////////////////////////////////
9
10#include "testprec.h"
11
12#if wxUSE_CHOICEBOOK
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/choicebk.h"
24#include "bookctrlbasetest.h"
25
26class ChoicebookTestCase : public BookCtrlBaseTestCase, public CppUnit::TestCase
27{
28public:
29 ChoicebookTestCase() { }
30
31 virtual void setUp();
32 virtual void tearDown();
33
34private:
35 virtual wxBookCtrlBase *GetBase() const { return m_choicebook; }
36
37 virtual wxEventType GetChangedEvent() const
ce7fe42e 38 { return wxEVT_CHOICEBOOK_PAGE_CHANGED; }
232fdc63
VZ
39
40 virtual wxEventType GetChangingEvent() const
ce7fe42e 41 { return wxEVT_CHOICEBOOK_PAGE_CHANGING; }
232fdc63
VZ
42
43 CPPUNIT_TEST_SUITE( ChoicebookTestCase );
44 wxBOOK_CTRL_BASE_TESTS();
45 CPPUNIT_TEST( Choice );
46 CPPUNIT_TEST_SUITE_END();
47
48 void Choice();
49
50 wxChoicebook *m_choicebook;
51
52 DECLARE_NO_COPY_CLASS(ChoicebookTestCase)
53};
54
55// register in the unnamed registry so that these tests are run by default
56CPPUNIT_TEST_SUITE_REGISTRATION( ChoicebookTestCase );
57
e3778b4d 58// also include in its own registry so that these tests can be run alone
232fdc63
VZ
59CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ChoicebookTestCase, "ChoicebookTestCase" );
60
61void ChoicebookTestCase::setUp()
62{
63 m_choicebook = new wxChoicebook(wxTheApp->GetTopWindow(), wxID_ANY);
64 AddPanels();
65}
66
67void ChoicebookTestCase::tearDown()
68{
69 wxDELETE(m_choicebook);
70}
71
72void ChoicebookTestCase::Choice()
73{
74 wxChoice* choice = m_choicebook->GetChoiceCtrl();
75
76 CPPUNIT_ASSERT(choice);
77 CPPUNIT_ASSERT_EQUAL(3, choice->GetCount());
78 CPPUNIT_ASSERT_EQUAL("Panel 1", choice->GetString(0));
79}
80
81#endif //wxUSE_CHOICEBOOK