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