]>
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 )
43 void TextChangeEvents();
45 void InsertionPoint();
48 // Selection() test helper: verify that selection is as described by the
49 // function parameters
50 void AssertSelection(int from
, int to
, const char *sel
);
52 // helper of AssertSelection(): check that the text selected in the control
55 // this is necessary to disable testing this in wxComboBox test as it
56 // doesn't provide any way to access the string selection directly, its
57 // GetStringSelection() method returns the currently selected string in the
58 // wxChoice part of the control, not the selected text
59 virtual void CheckStringSelection(const char *sel
);
61 DECLARE_NO_COPY_CLASS(TextEntryTestCase
)
64 #endif // _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_