File: pickertest.cpp

package info (click to toggle)
wxwidgets3.0 3.0.5.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 120,464 kB
  • sloc: cpp: 896,633; makefile: 52,303; ansic: 21,971; sh: 5,713; python: 2,940; xml: 1,534; perl: 264; javascript: 33
file content (201 lines) | stat: -rw-r--r-- 5,587 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
///////////////////////////////////////////////////////////////////////////////
// Name:        tests/controls/pickertest.cpp
// Purpose:     Tests for various wxPickerBase based classes
// Author:      Steven Lamerton
// Created:     2010-08-07
// Copyright:   (c) 2010 Steven Lamerton
///////////////////////////////////////////////////////////////////////////////

#include "testprec.h"

#ifdef __BORLANDC__
    #pragma hdrstop
#endif

#ifndef WX_PRECOMP
    #include "wx/app.h"
#endif // WX_PRECOMP

#include "wx/clrpicker.h"
#include "wx/filepicker.h"
#include "wx/fontpicker.h"
#include "pickerbasetest.h"

#if wxUSE_COLOURPICKERCTRL

class ColourPickerCtrlTestCase : public PickerBaseTestCase,
                                 public CppUnit::TestCase
{
public:
    ColourPickerCtrlTestCase() { }

    virtual void setUp();
    virtual void tearDown();

private:
    virtual wxPickerBase *GetBase() const { return m_colour; }

    CPPUNIT_TEST_SUITE( ColourPickerCtrlTestCase );
        wxPICKER_BASE_TESTS();
    CPPUNIT_TEST_SUITE_END();

    wxColourPickerCtrl *m_colour;

    DECLARE_NO_COPY_CLASS(ColourPickerCtrlTestCase)
};

// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( ColourPickerCtrlTestCase );

// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ColourPickerCtrlTestCase,
                                      "ColourPickerCtrlTestCase" );

void ColourPickerCtrlTestCase::setUp()
{
    m_colour = new wxColourPickerCtrl(wxTheApp->GetTopWindow(), wxID_ANY,
                                     *wxBLACK, wxDefaultPosition,
                                      wxDefaultSize, wxCLRP_USE_TEXTCTRL);
}

void ColourPickerCtrlTestCase::tearDown()
{
    wxDELETE(m_colour);
}

#endif //wxUSE_COLOURPICKERCTRL

#if wxUSE_DIRPICKERCTRL

class DirPickerCtrlTestCase : public PickerBaseTestCase,
                              public CppUnit::TestCase
{
public:
    DirPickerCtrlTestCase() { }

    virtual void setUp();
    virtual void tearDown();

private:
    virtual wxPickerBase *GetBase() const { return m_dir; }

    CPPUNIT_TEST_SUITE( DirPickerCtrlTestCase );
        wxPICKER_BASE_TESTS();
    CPPUNIT_TEST_SUITE_END();

    wxDirPickerCtrl *m_dir;

    DECLARE_NO_COPY_CLASS(DirPickerCtrlTestCase)
};

// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( DirPickerCtrlTestCase );

// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( DirPickerCtrlTestCase,
                                      "DirPickerCtrlTestCase" );

void DirPickerCtrlTestCase::setUp()
{
    m_dir = new wxDirPickerCtrl(wxTheApp->GetTopWindow(), wxID_ANY,
                                wxEmptyString, wxDirSelectorPromptStr,
                                wxDefaultPosition, wxDefaultSize,
                                wxDIRP_USE_TEXTCTRL);
}

void DirPickerCtrlTestCase::tearDown()
{
    wxDELETE(m_dir);
}

#endif //wxUSE_DIRPICKERCTRL

#if wxUSE_FILEPICKERCTRL

class FilePickerCtrlTestCase : public PickerBaseTestCase,
                               public CppUnit::TestCase
{
public:
    FilePickerCtrlTestCase() { }

    virtual void setUp();
    virtual void tearDown();

private:
    virtual wxPickerBase *GetBase() const { return m_file; }

    CPPUNIT_TEST_SUITE( FilePickerCtrlTestCase );
        wxPICKER_BASE_TESTS();
    CPPUNIT_TEST_SUITE_END();

    wxFilePickerCtrl *m_file;

    DECLARE_NO_COPY_CLASS(FilePickerCtrlTestCase)
};

// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( FilePickerCtrlTestCase );

// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FilePickerCtrlTestCase,
                                      "FilePickerCtrlTestCase" );

void FilePickerCtrlTestCase::setUp()
{
    m_file = new wxFilePickerCtrl(wxTheApp->GetTopWindow(), wxID_ANY,
                                  wxEmptyString, wxFileSelectorPromptStr,
                                  wxFileSelectorDefaultWildcardStr,
                                  wxDefaultPosition, wxDefaultSize,
                                  wxFLP_USE_TEXTCTRL);
}

void FilePickerCtrlTestCase::tearDown()
{
    wxDELETE(m_file);
}

#endif //wxUSE_FILEPICKERCTRL

#if wxUSE_FONTPICKERCTRL

class FontPickerCtrlTestCase : public PickerBaseTestCase,
                               public CppUnit::TestCase
{
public:
    FontPickerCtrlTestCase() { }

    virtual void setUp();
    virtual void tearDown();

private:
    virtual wxPickerBase *GetBase() const { return m_font; }

    CPPUNIT_TEST_SUITE( FontPickerCtrlTestCase );
        wxPICKER_BASE_TESTS();
    CPPUNIT_TEST_SUITE_END();

    wxFontPickerCtrl *m_font;

    DECLARE_NO_COPY_CLASS(FontPickerCtrlTestCase)
};

// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( FontPickerCtrlTestCase );

// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FontPickerCtrlTestCase,
                                      "FontPickerCtrlTestCase" );

void FontPickerCtrlTestCase::setUp()
{
    m_font = new wxFontPickerCtrl(wxTheApp->GetTopWindow(), wxID_ANY,
                                  wxNullFont, wxDefaultPosition, wxDefaultSize,
                                  wxFNTP_USE_TEXTCTRL);
}

void FontPickerCtrlTestCase::tearDown()
{
    wxDELETE(m_font);
}

#endif //wxUSE_FONTPICKERCTRL