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