]> git.saurik.com Git - wxWidgets.git/blob - tests/controls/textentrytest.h
added wxProtocolLog class for logging network requests/responses (closes #7464)
[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 CPPUNIT_TEST( Replace )
42
43 void SetValue();
44 void TextChangeEvents();
45 void Selection();
46 void InsertionPoint();
47 void Replace();
48
49 private:
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);
53
54 // helper of AssertSelection(): check that the text selected in the control
55 // is the given one
56 //
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);
62
63 DECLARE_NO_COPY_CLASS(TextEntryTestCase)
64 };
65
66 #endif // _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_