]> git.saurik.com Git - wxWidgets.git/blob - tests/controls/pickertest.cpp
No real changes, just simplify wxBookCtrlBase unit test a little.
[wxWidgets.git] / tests / controls / pickertest.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/pickertest.cpp
3 // Purpose: Tests for various wxPickerBase based classes
4 // Author: Steven Lamerton
5 // Created: 2010-08-07
6 // RCS-ID: $Id$
7 // Copyright: (c) 2010 Steven Lamerton
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #include "testprec.h"
11
12 #ifdef __BORLANDC__
13 #pragma hdrstop
14 #endif
15
16 #ifndef WX_PRECOMP
17 #include "wx/app.h"
18 #endif // WX_PRECOMP
19
20 #include "wx/clrpicker.h"
21 #include "wx/filepicker.h"
22 #include "wx/fontpicker.h"
23 #include "pickerbasetest.h"
24
25 #if wxUSE_COLOURPICKERCTRL
26
27 class ColourPickerCtrlTestCase : public PickerBaseTestCase,
28 public CppUnit::TestCase
29 {
30 public:
31 ColourPickerCtrlTestCase() { }
32
33 virtual void setUp();
34 virtual void tearDown();
35
36 private:
37 virtual wxPickerBase *GetBase() const { return m_colour; }
38
39 CPPUNIT_TEST_SUITE( ColourPickerCtrlTestCase );
40 wxPICKER_BASE_TESTS();
41 CPPUNIT_TEST_SUITE_END();
42
43 wxColourPickerCtrl *m_colour;
44
45 DECLARE_NO_COPY_CLASS(ColourPickerCtrlTestCase)
46 };
47
48 // register in the unnamed registry so that these tests are run by default
49 CPPUNIT_TEST_SUITE_REGISTRATION( ColourPickerCtrlTestCase );
50
51 // also include in its own registry so that these tests can be run alone
52 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ColourPickerCtrlTestCase,
53 "ColourPickerCtrlTestCase" );
54
55 void ColourPickerCtrlTestCase::setUp()
56 {
57 m_colour = new wxColourPickerCtrl(wxTheApp->GetTopWindow(), wxID_ANY,
58 *wxBLACK, wxDefaultPosition,
59 wxDefaultSize, wxCLRP_USE_TEXTCTRL);
60 }
61
62 void ColourPickerCtrlTestCase::tearDown()
63 {
64 wxDELETE(m_colour);
65 }
66
67 #endif //wxUSE_COLOURPICKERCTRL
68
69 #if wxUSE_DIRPICKERCTRL
70
71 class DirPickerCtrlTestCase : public PickerBaseTestCase,
72 public CppUnit::TestCase
73 {
74 public:
75 DirPickerCtrlTestCase() { }
76
77 virtual void setUp();
78 virtual void tearDown();
79
80 private:
81 virtual wxPickerBase *GetBase() const { return m_dir; }
82
83 CPPUNIT_TEST_SUITE( DirPickerCtrlTestCase );
84 wxPICKER_BASE_TESTS();
85 CPPUNIT_TEST_SUITE_END();
86
87 wxDirPickerCtrl *m_dir;
88
89 DECLARE_NO_COPY_CLASS(DirPickerCtrlTestCase)
90 };
91
92 // register in the unnamed registry so that these tests are run by default
93 CPPUNIT_TEST_SUITE_REGISTRATION( DirPickerCtrlTestCase );
94
95 // also include in its own registry so that these tests can be run alone
96 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( DirPickerCtrlTestCase,
97 "DirPickerCtrlTestCase" );
98
99 void DirPickerCtrlTestCase::setUp()
100 {
101 m_dir = new wxDirPickerCtrl(wxTheApp->GetTopWindow(), wxID_ANY,
102 wxEmptyString, wxDirSelectorPromptStr,
103 wxDefaultPosition, wxDefaultSize,
104 wxDIRP_USE_TEXTCTRL);
105 }
106
107 void DirPickerCtrlTestCase::tearDown()
108 {
109 wxDELETE(m_dir);
110 }
111
112 #endif //wxUSE_DIRPICKERCTRL
113
114 #if wxUSE_FILEPICKERCTRL
115
116 class FilePickerCtrlTestCase : public PickerBaseTestCase,
117 public CppUnit::TestCase
118 {
119 public:
120 FilePickerCtrlTestCase() { }
121
122 virtual void setUp();
123 virtual void tearDown();
124
125 private:
126 virtual wxPickerBase *GetBase() const { return m_file; }
127
128 CPPUNIT_TEST_SUITE( FilePickerCtrlTestCase );
129 wxPICKER_BASE_TESTS();
130 CPPUNIT_TEST_SUITE_END();
131
132 wxFilePickerCtrl *m_file;
133
134 DECLARE_NO_COPY_CLASS(FilePickerCtrlTestCase)
135 };
136
137 // register in the unnamed registry so that these tests are run by default
138 CPPUNIT_TEST_SUITE_REGISTRATION( FilePickerCtrlTestCase );
139
140 // also include in its own registry so that these tests can be run alone
141 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FilePickerCtrlTestCase,
142 "FilePickerCtrlTestCase" );
143
144 void FilePickerCtrlTestCase::setUp()
145 {
146 m_file = new wxFilePickerCtrl(wxTheApp->GetTopWindow(), wxID_ANY,
147 wxEmptyString, wxFileSelectorPromptStr,
148 wxFileSelectorDefaultWildcardStr,
149 wxDefaultPosition, wxDefaultSize,
150 wxFLP_USE_TEXTCTRL);
151 }
152
153 void FilePickerCtrlTestCase::tearDown()
154 {
155 wxDELETE(m_file);
156 }
157
158 #endif //wxUSE_FILEPICKERCTRL
159
160 #if wxUSE_FONTPICKERCTRL
161
162 class FontPickerCtrlTestCase : public PickerBaseTestCase,
163 public CppUnit::TestCase
164 {
165 public:
166 FontPickerCtrlTestCase() { }
167
168 virtual void setUp();
169 virtual void tearDown();
170
171 private:
172 virtual wxPickerBase *GetBase() const { return m_font; }
173
174 CPPUNIT_TEST_SUITE( FontPickerCtrlTestCase );
175 wxPICKER_BASE_TESTS();
176 CPPUNIT_TEST_SUITE_END();
177
178 wxFontPickerCtrl *m_font;
179
180 DECLARE_NO_COPY_CLASS(FontPickerCtrlTestCase)
181 };
182
183 // register in the unnamed registry so that these tests are run by default
184 CPPUNIT_TEST_SUITE_REGISTRATION( FontPickerCtrlTestCase );
185
186 // also include in its own registry so that these tests can be run alone
187 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FontPickerCtrlTestCase,
188 "FontPickerCtrlTestCase" );
189
190 void FontPickerCtrlTestCase::setUp()
191 {
192 m_font = new wxFontPickerCtrl(wxTheApp->GetTopWindow(), wxID_ANY,
193 wxNullFont, wxDefaultPosition, wxDefaultSize,
194 wxFNTP_USE_TEXTCTRL);
195 }
196
197 void FontPickerCtrlTestCase::tearDown()
198 {
199 wxDELETE(m_font);
200 }
201
202 #endif //wxUSE_FONTPICKERCTRL