]> git.saurik.com Git - wxWidgets.git/blame_incremental - tests/controls/textentrytest.h
Move wx/msw/gccpriv.h inclusion back to wx/platform.h from wx/compiler.h.
[wxWidgets.git] / tests / controls / textentrytest.h
... / ...
CommitLineData
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
13class WXDLLIMPEXP_FWD_CORE wxTextEntry;
14
15// ----------------------------------------------------------------------------
16// abstract base class testing wxTextEntry methods
17// ----------------------------------------------------------------------------
18
19class TextEntryTestCase
20{
21public:
22 TextEntryTestCase() { }
23 virtual ~TextEntryTestCase() { }
24
25protected:
26 // this function must be overridden by the derived classes to return the
27 // text entry object we're testing, typically this is done by creating a
28 // control implementing wxTextEntry interface in setUp() virtual method and
29 // just returning it from here
30 virtual wxTextEntry *GetTestEntry() const = 0;
31
32 // and this one must be overridden to return the window which implements
33 // wxTextEntry interface -- usually it will return the same pointer as
34 // GetTestEntry(), just as a different type
35 virtual wxWindow *GetTestWindow() const = 0;
36
37 // this should be inserted in the derived class CPPUNIT_TEST_SUITE
38 // definition to run all wxTextEntry tests as part of it
39 #define wxTEXT_ENTRY_TESTS() \
40 CPPUNIT_TEST( SetValue ); \
41 CPPUNIT_TEST( TextChangeEvents ); \
42 CPPUNIT_TEST( Selection ); \
43 CPPUNIT_TEST( InsertionPoint ); \
44 CPPUNIT_TEST( Replace ); \
45 WXUISIM_TEST( Editable ); \
46 CPPUNIT_TEST( Hint ); \
47 CPPUNIT_TEST( CopyPaste ); \
48 CPPUNIT_TEST( UndoRedo )
49
50 void SetValue();
51 void TextChangeEvents();
52 void Selection();
53 void InsertionPoint();
54 void Replace();
55 void Editable();
56 void Hint();
57 void CopyPaste();
58 void UndoRedo();
59
60private:
61 // Selection() test helper: verify that selection is as described by the
62 // function parameters
63 void AssertSelection(int from, int to, const char *sel);
64
65 // helper of AssertSelection(): check that the text selected in the control
66 // is the given one
67 //
68 // this is necessary to disable testing this in wxComboBox test as it
69 // doesn't provide any way to access the string selection directly, its
70 // GetStringSelection() method returns the currently selected string in the
71 // wxChoice part of the control, not the selected text
72 virtual void CheckStringSelection(const char *sel);
73
74 wxDECLARE_NO_COPY_CLASS(TextEntryTestCase);
75};
76
77#endif // _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_