]> git.saurik.com Git - wxWidgets.git/blob - tests/controls/textentrytest.h
Use "C" locale for locale-dependent part of TextCtrlTestCase.
[wxWidgets.git] / 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)
6 // RCS-ID: $Id$
7 // Copyright: (c) 2007, 2008 Vadim Zeitlin <vadim@wxwidgets.org>
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_
11 #define _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_
12
13 // ----------------------------------------------------------------------------
14 // abstract base class testing wxTextEntry methods
15 // ----------------------------------------------------------------------------
16
17 class TextEntryTestCase
18 {
19 public:
20 TextEntryTestCase() { }
21 virtual ~TextEntryTestCase() { }
22
23 protected:
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;
29
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;
34
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 )
47
48 void SetValue();
49 void TextChangeEvents();
50 void Selection();
51 void InsertionPoint();
52 void Replace();
53 void Editable();
54 void Hint();
55 void CopyPaste();
56 void UndoRedo();
57
58 private:
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);
62
63 // helper of AssertSelection(): check that the text selected in the control
64 // is the given one
65 //
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);
71
72 wxDECLARE_NO_COPY_CLASS(TextEntryTestCase);
73 };
74
75 #endif // _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_