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