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