]>
Commit | Line | Data |
---|---|---|
f0f6a32d VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: tests/controls/textentrytest.h | |
3 | // Purpose: Base class implementing wxTextEntry unit tests | |
4 | // Author: Vadim Zeitlin | |
5 | // Created: 2008-09-19 (extracted from textctrltest.cpp) | |
f0f6a32d VZ |
6 | // Copyright: (c) 2007, 2008 Vadim Zeitlin <vadim@wxwidgets.org> |
7 | /////////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | #ifndef _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_ | |
10 | #define _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_ | |
11 | ||
39f38167 VZ |
12 | class WXDLLIMPEXP_FWD_CORE wxTextEntry; |
13 | ||
f0f6a32d VZ |
14 | // ---------------------------------------------------------------------------- |
15 | // abstract base class testing wxTextEntry methods | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
232fdc63 | 18 | class TextEntryTestCase |
f0f6a32d VZ |
19 | { |
20 | public: | |
21 | TextEntryTestCase() { } | |
232fdc63 | 22 | virtual ~TextEntryTestCase() { } |
f0f6a32d VZ |
23 | |
24 | protected: | |
25 | // this function must be overridden by the derived classes to return the | |
26 | // text entry object we're testing, typically this is done by creating a | |
27 | // control implementing wxTextEntry interface in setUp() virtual method and | |
28 | // just returning it from here | |
29 | virtual wxTextEntry *GetTestEntry() const = 0; | |
30 | ||
31 | // and this one must be overridden to return the window which implements | |
32 | // wxTextEntry interface -- usually it will return the same pointer as | |
33 | // GetTestEntry(), just as a different type | |
34 | virtual wxWindow *GetTestWindow() const = 0; | |
35 | ||
36 | // this should be inserted in the derived class CPPUNIT_TEST_SUITE | |
37 | // definition to run all wxTextEntry tests as part of it | |
38 | #define wxTEXT_ENTRY_TESTS() \ | |
39 | CPPUNIT_TEST( SetValue ); \ | |
40 | CPPUNIT_TEST( TextChangeEvents ); \ | |
41 | CPPUNIT_TEST( Selection ); \ | |
059979d8 | 42 | CPPUNIT_TEST( InsertionPoint ); \ |
232fdc63 VZ |
43 | CPPUNIT_TEST( Replace ); \ |
44 | WXUISIM_TEST( Editable ); \ | |
45 | CPPUNIT_TEST( Hint ); \ | |
46 | CPPUNIT_TEST( CopyPaste ); \ | |
47 | CPPUNIT_TEST( UndoRedo ) | |
f0f6a32d VZ |
48 | |
49 | void SetValue(); | |
50 | void TextChangeEvents(); | |
51 | void Selection(); | |
52 | void InsertionPoint(); | |
059979d8 | 53 | void Replace(); |
232fdc63 VZ |
54 | void Editable(); |
55 | void Hint(); | |
56 | void CopyPaste(); | |
57 | void UndoRedo(); | |
f0f6a32d VZ |
58 | |
59 | private: | |
60 | // Selection() test helper: verify that selection is as described by the | |
61 | // function parameters | |
62 | void AssertSelection(int from, int to, const char *sel); | |
63 | ||
dc7f9c9c VZ |
64 | // helper of AssertSelection(): check that the text selected in the control |
65 | // is the given one | |
66 | // | |
67 | // this is necessary to disable testing this in wxComboBox test as it | |
68 | // doesn't provide any way to access the string selection directly, its | |
69 | // GetStringSelection() method returns the currently selected string in the | |
70 | // wxChoice part of the control, not the selected text | |
71 | virtual void CheckStringSelection(const char *sel); | |
72 | ||
232fdc63 | 73 | wxDECLARE_NO_COPY_CLASS(TextEntryTestCase); |
f0f6a32d VZ |
74 | }; |
75 | ||
76 | #endif // _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_ |