1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/pickertest.cpp
3 // Purpose: Tests for various wxPickerBase based classes
4 // Author: Steven Lamerton
7 // Copyright: (c) 2010 Steven Lamerton
8 ///////////////////////////////////////////////////////////////////////////////
20 #include "wx/clrpicker.h"
21 #include "wx/filepicker.h"
22 #include "wx/fontpicker.h"
23 #include "pickerbasetest.h"
25 #if wxUSE_COLOURPICKERCTRL
27 class ColourPickerCtrlTestCase
: public PickerBaseTestCase
,
28 public CppUnit::TestCase
31 ColourPickerCtrlTestCase() { }
34 virtual void tearDown();
37 virtual wxPickerBase
*GetBase() const { return m_colour
; }
39 CPPUNIT_TEST_SUITE( ColourPickerCtrlTestCase
);
40 wxPICKER_BASE_TESTS();
41 CPPUNIT_TEST_SUITE_END();
43 wxColourPickerCtrl
*m_colour
;
45 DECLARE_NO_COPY_CLASS(ColourPickerCtrlTestCase
)
48 // register in the unnamed registry so that these tests are run by default
49 CPPUNIT_TEST_SUITE_REGISTRATION( ColourPickerCtrlTestCase
);
51 // also include in it's own registry so that these tests can be run alone
52 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ColourPickerCtrlTestCase
,
53 "ColourPickerCtrlTestCase" );
55 void ColourPickerCtrlTestCase::setUp()
57 m_colour
= new wxColourPickerCtrl(wxTheApp
->GetTopWindow(), wxID_ANY
,
58 *wxBLACK
, wxDefaultPosition
,
59 wxDefaultSize
, wxCLRP_USE_TEXTCTRL
);
62 void ColourPickerCtrlTestCase::tearDown()
67 #endif //wxUSE_COLOURPICKERCTRL
69 #if wxUSE_DIRPICKERCTRL
71 class DirPickerCtrlTestCase
: public PickerBaseTestCase
,
72 public CppUnit::TestCase
75 DirPickerCtrlTestCase() { }
78 virtual void tearDown();
81 virtual wxPickerBase
*GetBase() const { return m_dir
; }
83 CPPUNIT_TEST_SUITE( DirPickerCtrlTestCase
);
84 wxPICKER_BASE_TESTS();
85 CPPUNIT_TEST_SUITE_END();
87 wxDirPickerCtrl
*m_dir
;
89 DECLARE_NO_COPY_CLASS(DirPickerCtrlTestCase
)
92 // register in the unnamed registry so that these tests are run by default
93 CPPUNIT_TEST_SUITE_REGISTRATION( DirPickerCtrlTestCase
);
95 // also include in it's own registry so that these tests can be run alone
96 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( DirPickerCtrlTestCase
,
97 "DirPickerCtrlTestCase" );
99 void DirPickerCtrlTestCase::setUp()
101 m_dir
= new wxDirPickerCtrl(wxTheApp
->GetTopWindow(), wxID_ANY
,
102 wxEmptyString
, wxDirSelectorPromptStr
,
103 wxDefaultPosition
, wxDefaultSize
,
104 wxDIRP_USE_TEXTCTRL
);
107 void DirPickerCtrlTestCase::tearDown()
112 #endif //wxUSE_DIRPICKERCTRL
114 #if wxUSE_FILEPICKERCTRL
116 class FilePickerCtrlTestCase
: public PickerBaseTestCase
,
117 public CppUnit::TestCase
120 FilePickerCtrlTestCase() { }
122 virtual void setUp();
123 virtual void tearDown();
126 virtual wxPickerBase
*GetBase() const { return m_file
; }
128 CPPUNIT_TEST_SUITE( FilePickerCtrlTestCase
);
129 wxPICKER_BASE_TESTS();
130 CPPUNIT_TEST_SUITE_END();
132 wxFilePickerCtrl
*m_file
;
134 DECLARE_NO_COPY_CLASS(FilePickerCtrlTestCase
)
137 // register in the unnamed registry so that these tests are run by default
138 CPPUNIT_TEST_SUITE_REGISTRATION( FilePickerCtrlTestCase
);
140 // also include in it's own registry so that these tests can be run alone
141 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FilePickerCtrlTestCase
,
142 "FilePickerCtrlTestCase" );
144 void FilePickerCtrlTestCase::setUp()
146 m_file
= new wxFilePickerCtrl(wxTheApp
->GetTopWindow(), wxID_ANY
,
147 wxEmptyString
, wxFileSelectorPromptStr
,
148 wxFileSelectorDefaultWildcardStr
,
149 wxDefaultPosition
, wxDefaultSize
,
153 void FilePickerCtrlTestCase::tearDown()
158 #endif //wxUSE_FILEPICKERCTRL
160 #if wxUSE_FONTPICKERCTRL
162 class FontPickerCtrlTestCase
: public PickerBaseTestCase
,
163 public CppUnit::TestCase
166 FontPickerCtrlTestCase() { }
168 virtual void setUp();
169 virtual void tearDown();
172 virtual wxPickerBase
*GetBase() const { return m_font
; }
174 CPPUNIT_TEST_SUITE( FontPickerCtrlTestCase
);
175 wxPICKER_BASE_TESTS();
176 CPPUNIT_TEST_SUITE_END();
178 wxFontPickerCtrl
*m_font
;
180 DECLARE_NO_COPY_CLASS(FontPickerCtrlTestCase
)
183 // register in the unnamed registry so that these tests are run by default
184 CPPUNIT_TEST_SUITE_REGISTRATION( FontPickerCtrlTestCase
);
186 // also include in it's own registry so that these tests can be run alone
187 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FontPickerCtrlTestCase
,
188 "FontPickerCtrlTestCase" );
190 void FontPickerCtrlTestCase::setUp()
192 m_font
= new wxFontPickerCtrl(wxTheApp
->GetTopWindow(), wxID_ANY
,
193 wxNullFont
, wxDefaultPosition
, wxDefaultSize
,
194 wxFNTP_USE_TEXTCTRL
);
197 void FontPickerCtrlTestCase::tearDown()
202 #endif //wxUSE_FONTPICKERCTRL