]>
git.saurik.com Git - wxWidgets.git/blob - tests/controls/clientsize.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/clientsize.cpp
3 // Purpose: Client vs. window size handling unit test
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2008 Vaclav Slavik <vslavik@fastmail.fm>
8 ///////////////////////////////////////////////////////////////////////////////
10 // ----------------------------------------------------------------------------
12 // ----------------------------------------------------------------------------
22 #include "wx/window.h"
25 // ----------------------------------------------------------------------------
27 // ----------------------------------------------------------------------------
29 class ClientSizeTestCase
: public CppUnit::TestCase
32 ClientSizeTestCase() { }
35 virtual void tearDown();
38 CPPUNIT_TEST_SUITE( ClientSizeTestCase
);
39 CPPUNIT_TEST( ClientToWindow
);
40 CPPUNIT_TEST( WindowToClient
);
41 CPPUNIT_TEST_SUITE_END();
43 void ClientToWindow();
44 void WindowToClient();
48 DECLARE_NO_COPY_CLASS(ClientSizeTestCase
)
51 // register in the unnamed registry so that these tests are run by default
52 CPPUNIT_TEST_SUITE_REGISTRATION( ClientSizeTestCase
);
54 // also include in it's own registry so that these tests can be run alone
55 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ClientSizeTestCase
, "ClientSizeTestCase" );
57 // ----------------------------------------------------------------------------
58 // test initialization
59 // ----------------------------------------------------------------------------
61 void ClientSizeTestCase::setUp()
63 m_win
= wxTheApp
->GetTopWindow();
66 void ClientSizeTestCase::tearDown()
71 // ----------------------------------------------------------------------------
73 // ----------------------------------------------------------------------------
75 void ClientSizeTestCase::ClientToWindow()
77 CPPUNIT_ASSERT(m_win
->GetSize() ==
78 m_win
->ClientToWindowSize(m_win
->GetClientSize()));
81 void ClientSizeTestCase::WindowToClient()
83 CPPUNIT_ASSERT(m_win
->GetClientSize() ==
84 m_win
->WindowToClientSize(m_win
->GetSize()));