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)
7 // Copyright: (c) 2007, 2008 Vadim Zeitlin <vadim@wxwidgets.org>
8 ///////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_
11 #define _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_
13 class WXDLLIMPEXP_FWD_CORE wxTextEntry
;
15 // ----------------------------------------------------------------------------
16 // abstract base class testing wxTextEntry methods
17 // ----------------------------------------------------------------------------
19 class TextEntryTestCase
22 TextEntryTestCase() { }
23 virtual ~TextEntryTestCase() { }
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;
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;
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 ); \
43 CPPUNIT_TEST( InsertionPoint ); \
44 CPPUNIT_TEST( Replace ); \
45 WXUISIM_TEST( Editable ); \
46 CPPUNIT_TEST( Hint ); \
47 CPPUNIT_TEST( CopyPaste ); \
48 CPPUNIT_TEST( UndoRedo )
51 void TextChangeEvents();
53 void InsertionPoint();
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
);
65 // helper of AssertSelection(): check that the text selected in the control
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
);
74 wxDECLARE_NO_COPY_CLASS(TextEntryTestCase
);
77 #endif // _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_