File: textentrytest.h

package info (click to toggle)
wxwidgets3.0 3.0.5.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 120,464 kB
  • sloc: cpp: 896,633; makefile: 52,303; ansic: 21,971; sh: 5,713; python: 2,940; xml: 1,534; perl: 264; javascript: 33
file content (76 lines) | stat: -rw-r--r-- 2,884 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
///////////////////////////////////////////////////////////////////////////////
// Name:        tests/controls/textentrytest.h
// Purpose:     Base class implementing wxTextEntry unit tests
// Author:      Vadim Zeitlin
// Created:     2008-09-19 (extracted from textctrltest.cpp)
// Copyright:   (c) 2007, 2008 Vadim Zeitlin <vadim@wxwidgets.org>
///////////////////////////////////////////////////////////////////////////////

#ifndef _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_
#define _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_

class WXDLLIMPEXP_FWD_CORE wxTextEntry;

// ----------------------------------------------------------------------------
// abstract base class testing wxTextEntry methods
// ----------------------------------------------------------------------------

class TextEntryTestCase
{
public:
    TextEntryTestCase() { }
    virtual ~TextEntryTestCase() { }

protected:
    // this function must be overridden by the derived classes to return the
    // text entry object we're testing, typically this is done by creating a
    // control implementing wxTextEntry interface in setUp() virtual method and
    // just returning it from here
    virtual wxTextEntry *GetTestEntry() const = 0;

    // and this one must be overridden to return the window which implements
    // wxTextEntry interface -- usually it will return the same pointer as
    // GetTestEntry(), just as a different type
    virtual wxWindow *GetTestWindow() const = 0;

    // this should be inserted in the derived class CPPUNIT_TEST_SUITE
    // definition to run all wxTextEntry tests as part of it
    #define wxTEXT_ENTRY_TESTS() \
        CPPUNIT_TEST( SetValue ); \
        CPPUNIT_TEST( TextChangeEvents ); \
        CPPUNIT_TEST( Selection ); \
        CPPUNIT_TEST( InsertionPoint ); \
        CPPUNIT_TEST( Replace ); \
        WXUISIM_TEST( Editable ); \
        CPPUNIT_TEST( Hint ); \
        CPPUNIT_TEST( CopyPaste ); \
        CPPUNIT_TEST( UndoRedo )

    void SetValue();
    void TextChangeEvents();
    void Selection();
    void InsertionPoint();
    void Replace();
    void Editable();
    void Hint();
    void CopyPaste();
    void UndoRedo();

private:
    // Selection() test helper: verify that selection is as described by the
    // function parameters
    void AssertSelection(int from, int to, const char *sel);

    // helper of AssertSelection(): check that the text selected in the control
    // is the given one
    //
    // this is necessary to disable testing this in wxComboBox test as it
    // doesn't provide any way to access the string selection directly, its
    // GetStringSelection() method returns the currently selected string in the
    // wxChoice part of the control, not the selected text
    virtual void CheckStringSelection(const char *sel);

    wxDECLARE_NO_COPY_CLASS(TextEntryTestCase);
};

#endif // _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_