]>
git.saurik.com Git - wxWidgets.git/blob - tests/window/setsize.cpp
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 inline std::ostream
& operator<<(std::ostream
& o
, const wxSize
& s
)
27 return o
<< s
.x
<< 'x' << s
.y
;
30 // ----------------------------------------------------------------------------
32 // ----------------------------------------------------------------------------
34 class SetSizeTestCase
: public CppUnit::TestCase
40 virtual void tearDown();
43 CPPUNIT_TEST_SUITE( SetSizeTestCase
);
44 CPPUNIT_TEST( SetSize
);
45 CPPUNIT_TEST( SetSizeLessThanMinSize
);
46 CPPUNIT_TEST_SUITE_END();
49 void SetSizeLessThanMinSize();
53 DECLARE_NO_COPY_CLASS(SetSizeTestCase
)
56 // register in the unnamed registry so that these tests are run by default
57 CPPUNIT_TEST_SUITE_REGISTRATION( SetSizeTestCase
);
59 // also include in it's own registry so that these tests can be run alone
60 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SetSizeTestCase
, "SetSizeTestCase" );
62 // ----------------------------------------------------------------------------
63 // test initialization
64 // ----------------------------------------------------------------------------
66 void SetSizeTestCase::setUp()
68 m_win
= new wxWindow(wxTheApp
->GetTopWindow(), wxID_ANY
);
71 void SetSizeTestCase::tearDown()
77 // ----------------------------------------------------------------------------
79 // ----------------------------------------------------------------------------
81 void SetSizeTestCase::SetSize()
83 const wxSize
size(127, 35);
85 CPPUNIT_ASSERT_EQUAL( size
, m_win
->GetSize() );
88 void SetSizeTestCase::SetSizeLessThanMinSize()
90 m_win
->SetMinSize(wxSize(100, 100));
92 const wxSize
size(200, 50);
94 CPPUNIT_ASSERT_EQUAL( size
, m_win
->GetSize() );