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 // Copyright: (c) 2007, 2008 Vadim Zeitlin <vadim@wxwidgets.org>
7 ///////////////////////////////////////////////////////////////////////////////
9 #ifndef _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_
10 #define _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_
12 class WXDLLIMPEXP_FWD_CORE wxTextEntry
;
14 // ----------------------------------------------------------------------------
15 // abstract base class testing wxTextEntry methods
16 // ----------------------------------------------------------------------------
18 class TextEntryTestCase
21 TextEntryTestCase() { }
22 virtual ~TextEntryTestCase() { }
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;
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;
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 ); \
42 CPPUNIT_TEST( InsertionPoint ); \
43 CPPUNIT_TEST( Replace ); \
44 WXUISIM_TEST( Editable ); \
45 CPPUNIT_TEST( Hint ); \
46 CPPUNIT_TEST( CopyPaste ); \
47 CPPUNIT_TEST( UndoRedo )
50 void TextChangeEvents();
52 void InsertionPoint();
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
);
64 // helper of AssertSelection(): check that the text selected in the control
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
);
73 wxDECLARE_NO_COPY_CLASS(TextEntryTestCase
);
76 #endif // _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_