]>
git.saurik.com Git - wxWidgets.git/blob - tests/controls/textentrytest.h
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 // ----------------------------------------------------------------------------
14 // abstract base class testing wxTextEntry methods
15 // ----------------------------------------------------------------------------
17 class TextEntryTestCase
: public CppUnit::TestCase
20 TextEntryTestCase() { }
23 // this function must be overridden by the derived classes to return the
24 // text entry object we're testing, typically this is done by creating a
25 // control implementing wxTextEntry interface in setUp() virtual method and
26 // just returning it from here
27 virtual wxTextEntry
*GetTestEntry() const = 0;
29 // and this one must be overridden to return the window which implements
30 // wxTextEntry interface -- usually it will return the same pointer as
31 // GetTestEntry(), just as a different type
32 virtual wxWindow
*GetTestWindow() const = 0;
34 // this should be inserted in the derived class CPPUNIT_TEST_SUITE
35 // definition to run all wxTextEntry tests as part of it
36 #define wxTEXT_ENTRY_TESTS() \
37 CPPUNIT_TEST( SetValue ); \
38 CPPUNIT_TEST( TextChangeEvents ); \
39 CPPUNIT_TEST( Selection ); \
40 CPPUNIT_TEST( InsertionPoint ); \
41 CPPUNIT_TEST( Replace )
44 void TextChangeEvents();
46 void InsertionPoint();
50 // Selection() test helper: verify that selection is as described by the
51 // function parameters
52 void AssertSelection(int from
, int to
, const char *sel
);
54 // helper of AssertSelection(): check that the text selected in the control
57 // this is necessary to disable testing this in wxComboBox test as it
58 // doesn't provide any way to access the string selection directly, its
59 // GetStringSelection() method returns the currently selected string in the
60 // wxChoice part of the control, not the selected text
61 virtual void CheckStringSelection(const char *sel
);
63 DECLARE_NO_COPY_CLASS(TextEntryTestCase
)
66 #endif // _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_