]> git.saurik.com Git - wxWidgets.git/blob - tests/controls/textentrytest.h
extact common GAddress declarations to the common header instead of duplicating them...
[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 : public CppUnit::TestCase
18 {
19 public:
20 TextEntryTestCase() { }
21
22 protected:
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;
28
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;
33
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
42 void SetValue();
43 void TextChangeEvents();
44 void Selection();
45 void InsertionPoint();
46
47 private:
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);
51
52 // helper of AssertSelection(): check that the text selected in the control
53 // is the given one
54 //
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);
60
61 DECLARE_NO_COPY_CLASS(TextEntryTestCase)
62 };
63
64 #endif // _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_