]>
git.saurik.com Git - wxWidgets.git/blob - tests/window/setsize.cpp
16468d22bcf862766aef45d22ec9bc2ab3402c1f
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/window/setsize.cpp
3 // Purpose: Tests for SetSize() and related wxWindow methods
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
8 ///////////////////////////////////////////////////////////////////////////////
10 // ----------------------------------------------------------------------------
12 // ----------------------------------------------------------------------------
22 #include "wx/window.h"
25 #include "asserthelper.h"
27 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
31 class SetSizeTestCase
: public CppUnit::TestCase
37 virtual void tearDown();
40 CPPUNIT_TEST_SUITE( SetSizeTestCase
);
41 CPPUNIT_TEST( SetSize
);
42 CPPUNIT_TEST( SetSizeLessThanMinSize
);
43 CPPUNIT_TEST_SUITE_END();
46 void SetSizeLessThanMinSize();
50 DECLARE_NO_COPY_CLASS(SetSizeTestCase
)
53 // register in the unnamed registry so that these tests are run by default
54 CPPUNIT_TEST_SUITE_REGISTRATION( SetSizeTestCase
);
56 // also include in it's own registry so that these tests can be run alone
57 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SetSizeTestCase
, "SetSizeTestCase" );
59 // ----------------------------------------------------------------------------
60 // test initialization
61 // ----------------------------------------------------------------------------
63 void SetSizeTestCase::setUp()
65 m_win
= new wxWindow(wxTheApp
->GetTopWindow(), wxID_ANY
);
68 void SetSizeTestCase::tearDown()
74 // ----------------------------------------------------------------------------
76 // ----------------------------------------------------------------------------
78 void SetSizeTestCase::SetSize()
80 const wxSize
size(127, 35);
82 CPPUNIT_ASSERT_EQUAL( size
, m_win
->GetSize() );
85 void SetSizeTestCase::SetSizeLessThanMinSize()
87 m_win
->SetMinSize(wxSize(100, 100));
89 const wxSize
size(200, 50);
91 CPPUNIT_ASSERT_EQUAL( size
, m_win
->GetSize() );