1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/pickertest.cpp
3 // Purpose: Tests for various wxPickerBase based classes
4 // Author: Steven Lamerton
6 // Copyright: (c) 2010 Steven Lamerton
7 ///////////////////////////////////////////////////////////////////////////////
19 #include "wx/clrpicker.h"
20 #include "wx/filepicker.h"
21 #include "wx/fontpicker.h"
22 #include "pickerbasetest.h"
24 #if wxUSE_COLOURPICKERCTRL
26 class ColourPickerCtrlTestCase
: public PickerBaseTestCase
,
27 public CppUnit::TestCase
30 ColourPickerCtrlTestCase() { }
33 virtual void tearDown();
36 virtual wxPickerBase
*GetBase() const { return m_colour
; }
38 CPPUNIT_TEST_SUITE( ColourPickerCtrlTestCase
);
39 wxPICKER_BASE_TESTS();
40 CPPUNIT_TEST_SUITE_END();
42 wxColourPickerCtrl
*m_colour
;
44 DECLARE_NO_COPY_CLASS(ColourPickerCtrlTestCase
)
47 // register in the unnamed registry so that these tests are run by default
48 CPPUNIT_TEST_SUITE_REGISTRATION( ColourPickerCtrlTestCase
);
50 // also include in its own registry so that these tests can be run alone
51 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ColourPickerCtrlTestCase
,
52 "ColourPickerCtrlTestCase" );
54 void ColourPickerCtrlTestCase::setUp()
56 m_colour
= new wxColourPickerCtrl(wxTheApp
->GetTopWindow(), wxID_ANY
,
57 *wxBLACK
, wxDefaultPosition
,
58 wxDefaultSize
, wxCLRP_USE_TEXTCTRL
);
61 void ColourPickerCtrlTestCase::tearDown()
66 #endif //wxUSE_COLOURPICKERCTRL
68 #if wxUSE_DIRPICKERCTRL
70 class DirPickerCtrlTestCase
: public PickerBaseTestCase
,
71 public CppUnit::TestCase
74 DirPickerCtrlTestCase() { }
77 virtual void tearDown();
80 virtual wxPickerBase
*GetBase() const { return m_dir
; }
82 CPPUNIT_TEST_SUITE( DirPickerCtrlTestCase
);
83 wxPICKER_BASE_TESTS();
84 CPPUNIT_TEST_SUITE_END();
86 wxDirPickerCtrl
*m_dir
;
88 DECLARE_NO_COPY_CLASS(DirPickerCtrlTestCase
)
91 // register in the unnamed registry so that these tests are run by default
92 CPPUNIT_TEST_SUITE_REGISTRATION( DirPickerCtrlTestCase
);
94 // also include in its own registry so that these tests can be run alone
95 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( DirPickerCtrlTestCase
,
96 "DirPickerCtrlTestCase" );
98 void DirPickerCtrlTestCase::setUp()
100 m_dir
= new wxDirPickerCtrl(wxTheApp
->GetTopWindow(), wxID_ANY
,
101 wxEmptyString
, wxDirSelectorPromptStr
,
102 wxDefaultPosition
, wxDefaultSize
,
103 wxDIRP_USE_TEXTCTRL
);
106 void DirPickerCtrlTestCase::tearDown()
111 #endif //wxUSE_DIRPICKERCTRL
113 #if wxUSE_FILEPICKERCTRL
115 class FilePickerCtrlTestCase
: public PickerBaseTestCase
,
116 public CppUnit::TestCase
119 FilePickerCtrlTestCase() { }
121 virtual void setUp();
122 virtual void tearDown();
125 virtual wxPickerBase
*GetBase() const { return m_file
; }
127 CPPUNIT_TEST_SUITE( FilePickerCtrlTestCase
);
128 wxPICKER_BASE_TESTS();
129 CPPUNIT_TEST_SUITE_END();
131 wxFilePickerCtrl
*m_file
;
133 DECLARE_NO_COPY_CLASS(FilePickerCtrlTestCase
)
136 // register in the unnamed registry so that these tests are run by default
137 CPPUNIT_TEST_SUITE_REGISTRATION( FilePickerCtrlTestCase
);
139 // also include in its own registry so that these tests can be run alone
140 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FilePickerCtrlTestCase
,
141 "FilePickerCtrlTestCase" );
143 void FilePickerCtrlTestCase::setUp()
145 m_file
= new wxFilePickerCtrl(wxTheApp
->GetTopWindow(), wxID_ANY
,
146 wxEmptyString
, wxFileSelectorPromptStr
,
147 wxFileSelectorDefaultWildcardStr
,
148 wxDefaultPosition
, wxDefaultSize
,
152 void FilePickerCtrlTestCase::tearDown()
157 #endif //wxUSE_FILEPICKERCTRL
159 #if wxUSE_FONTPICKERCTRL
161 class FontPickerCtrlTestCase
: public PickerBaseTestCase
,
162 public CppUnit::TestCase
165 FontPickerCtrlTestCase() { }
167 virtual void setUp();
168 virtual void tearDown();
171 virtual wxPickerBase
*GetBase() const { return m_font
; }
173 CPPUNIT_TEST_SUITE( FontPickerCtrlTestCase
);
174 wxPICKER_BASE_TESTS();
175 CPPUNIT_TEST_SUITE_END();
177 wxFontPickerCtrl
*m_font
;
179 DECLARE_NO_COPY_CLASS(FontPickerCtrlTestCase
)
182 // register in the unnamed registry so that these tests are run by default
183 CPPUNIT_TEST_SUITE_REGISTRATION( FontPickerCtrlTestCase
);
185 // also include in its own registry so that these tests can be run alone
186 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FontPickerCtrlTestCase
,
187 "FontPickerCtrlTestCase" );
189 void FontPickerCtrlTestCase::setUp()
191 m_font
= new wxFontPickerCtrl(wxTheApp
->GetTopWindow(), wxID_ANY
,
192 wxNullFont
, wxDefaultPosition
, wxDefaultSize
,
193 wxFNTP_USE_TEXTCTRL
);
196 void FontPickerCtrlTestCase::tearDown()
201 #endif //wxUSE_FONTPICKERCTRL