]> git.saurik.com Git - wxWidgets.git/blob - tests/controls/textctrltest.cpp
use DispatchTimeout() and/or select() with timeout instead of polling loop in wxSocke...
[wxWidgets.git] / tests / controls / textctrltest.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/textctrltest.cpp
3 // Purpose: wxTextCtrl unit test
4 // Author: Vadim Zeitlin
5 // Created: 2007-09-25
6 // RCS-ID: $Id$
7 // Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org>
8 ///////////////////////////////////////////////////////////////////////////////
9
10 // ----------------------------------------------------------------------------
11 // headers
12 // ----------------------------------------------------------------------------
13
14 #include "testprec.h"
15
16 #ifdef __BORLANDC__
17 #pragma hdrstop
18 #endif
19
20 #ifndef WX_PRECOMP
21 #include "wx/app.h"
22 #include "wx/textctrl.h"
23 #endif // WX_PRECOMP
24
25 #include "textentrytest.h"
26
27 // ----------------------------------------------------------------------------
28 // test class
29 // ----------------------------------------------------------------------------
30
31 class TextCtrlTestCase : public TextEntryTestCase
32 {
33 public:
34 TextCtrlTestCase() { }
35
36 virtual void setUp();
37 virtual void tearDown();
38
39 private:
40 virtual wxTextEntry *GetTestEntry() const { return m_text; }
41 virtual wxWindow *GetTestWindow() const { return m_text; }
42
43 CPPUNIT_TEST_SUITE( TextCtrlTestCase );
44 wxTEXT_ENTRY_TESTS();
45 CPPUNIT_TEST_SUITE_END();
46
47 wxTextCtrl *m_text;
48
49 DECLARE_NO_COPY_CLASS(TextCtrlTestCase)
50 };
51
52 // register in the unnamed registry so that these tests are run by default
53 CPPUNIT_TEST_SUITE_REGISTRATION( TextCtrlTestCase );
54
55 // also include in it's own registry so that these tests can be run alone
56 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TextCtrlTestCase, "TextCtrlTestCase" );
57
58 // ----------------------------------------------------------------------------
59 // test initialization
60 // ----------------------------------------------------------------------------
61
62 void TextCtrlTestCase::setUp()
63 {
64 m_text = new wxTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY);
65 }
66
67 void TextCtrlTestCase::tearDown()
68 {
69 delete m_text;
70 m_text = NULL;
71 }
72
73 // ----------------------------------------------------------------------------
74 // tests themselves
75 // ----------------------------------------------------------------------------
76