]> git.saurik.com Git - wxWidgets.git/blob - tests/window/setsize.cpp
Don't use deprecated NSTableView selectRow:byExtendingSelection: method.
[wxWidgets.git] / tests / window / setsize.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/window/setsize.cpp
3 // Purpose: Tests for SetSize() and related wxWindow methods
4 // Author: Vadim Zeitlin
5 // Created: 2008-05-25
6 // RCS-ID: $Id$
7 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
8 ///////////////////////////////////////////////////////////////////////////////
9
10 // ----------------------------------------------------------------------------
11 // headers
12 // ----------------------------------------------------------------------------
13
14 #include "testprec.h"
15
16 #ifdef __BORLANDC__
17 #pragma hdrstop
18 #endif
19
20 #ifndef WX_PRECOMP
21 #include "wx/app.h"
22 #include "wx/window.h"
23 #endif // WX_PRECOMP
24
25 #include "asserthelper.h"
26
27 // ----------------------------------------------------------------------------
28 // test class
29 // ----------------------------------------------------------------------------
30
31 class SetSizeTestCase : public CppUnit::TestCase
32 {
33 public:
34 SetSizeTestCase() { }
35
36 virtual void setUp();
37 virtual void tearDown();
38
39 private:
40 CPPUNIT_TEST_SUITE( SetSizeTestCase );
41 CPPUNIT_TEST( SetSize );
42 CPPUNIT_TEST( SetSizeLessThanMinSize );
43 CPPUNIT_TEST_SUITE_END();
44
45 void SetSize();
46 void SetSizeLessThanMinSize();
47
48 wxWindow *m_win;
49
50 DECLARE_NO_COPY_CLASS(SetSizeTestCase)
51 };
52
53 // register in the unnamed registry so that these tests are run by default
54 CPPUNIT_TEST_SUITE_REGISTRATION( SetSizeTestCase );
55
56 // also include in it's own registry so that these tests can be run alone
57 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SetSizeTestCase, "SetSizeTestCase" );
58
59 // ----------------------------------------------------------------------------
60 // test initialization
61 // ----------------------------------------------------------------------------
62
63 void SetSizeTestCase::setUp()
64 {
65 m_win = new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY);
66 }
67
68 void SetSizeTestCase::tearDown()
69 {
70 delete m_win;
71 m_win = NULL;
72 }
73
74 // ----------------------------------------------------------------------------
75 // tests themselves
76 // ----------------------------------------------------------------------------
77
78 void SetSizeTestCase::SetSize()
79 {
80 const wxSize size(127, 35);
81 m_win->SetSize(size);
82 CPPUNIT_ASSERT_EQUAL( size, m_win->GetSize() );
83 }
84
85 void SetSizeTestCase::SetSizeLessThanMinSize()
86 {
87 m_win->SetMinSize(wxSize(100, 100));
88
89 const wxSize size(200, 50);
90 m_win->SetSize(size);
91 CPPUNIT_ASSERT_EQUAL( size, m_win->GetSize() );
92 }
93