]>
Commit | Line | Data |
---|---|---|
09ca8913 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: tests/controls/searchctrltest.cpp | |
3 | // Purpose: wxSearchCtrl unit test | |
4 | // Author: Vadim Zeitlin | |
5 | // Created: 2013-01-20 | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org> | |
8 | /////////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #include "testprec.h" | |
11 | ||
12 | #if wxUSE_SEARCHCTRL | |
13 | ||
14 | #ifdef __BORLANDC__ | |
15 | #pragma hdrstop | |
16 | #endif | |
17 | ||
18 | #ifndef WX_PRECOMP | |
19 | #include "wx/app.h" | |
20 | #endif // WX_PRECOMP | |
21 | ||
22 | #include "wx/srchctrl.h" | |
23 | ||
24 | class SearchCtrlTestCase : public CppUnit::TestCase | |
25 | { | |
26 | public: | |
27 | SearchCtrlTestCase() { } | |
28 | ||
29 | virtual void setUp(); | |
30 | virtual void tearDown(); | |
31 | ||
32 | private: | |
33 | CPPUNIT_TEST_SUITE( SearchCtrlTestCase ); | |
34 | CPPUNIT_TEST( Focus ); | |
35 | CPPUNIT_TEST_SUITE_END(); | |
36 | ||
37 | void Focus(); | |
38 | ||
39 | wxSearchCtrl* m_search; | |
40 | ||
41 | DECLARE_NO_COPY_CLASS(SearchCtrlTestCase) | |
42 | }; | |
43 | ||
44 | // register in the unnamed registry so that these tests are run by default | |
45 | CPPUNIT_TEST_SUITE_REGISTRATION( SearchCtrlTestCase ); | |
46 | ||
47 | // also include in its own registry so that these tests can be run alone | |
48 | CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SearchCtrlTestCase, "SearchCtrlTestCase" ); | |
49 | ||
50 | void SearchCtrlTestCase::setUp() | |
51 | { | |
52 | m_search = new wxSearchCtrl(wxTheApp->GetTopWindow(), wxID_ANY); | |
53 | } | |
54 | ||
55 | void SearchCtrlTestCase::tearDown() | |
56 | { | |
57 | delete m_search; | |
58 | m_search = NULL; | |
59 | } | |
60 | ||
61 | void SearchCtrlTestCase::Focus() | |
62 | { | |
e1004654 SC |
63 | // TODO OS X test only passes when run solo ... |
64 | #ifndef __WXOSX__ | |
09ca8913 VZ |
65 | m_search->SetFocus(); |
66 | CPPUNIT_ASSERT( m_search->HasFocus() ); | |
e1004654 | 67 | #endif |
09ca8913 VZ |
68 | } |
69 | ||
70 | #endif // wxUSE_SEARCHCTRL |