]> git.saurik.com Git - wxWidgets.git/blame - tests/window/clientsize.cpp
Document lack of wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK under OS X.
[wxWidgets.git] / tests / window / clientsize.cpp
CommitLineData
301d7a0d
VS
1///////////////////////////////////////////////////////////////////////////////
2// Name: tests/controls/clientsize.cpp
3// Purpose: Client vs. window size handling unit test
4// Author: Vaclav Slavik
5// Created: 2008-02-12
6// RCS-ID: $Id$
7// Copyright: (c) 2008 Vaclav Slavik <vslavik@fastmail.fm>
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// ----------------------------------------------------------------------------
26// test class
27// ----------------------------------------------------------------------------
28
29class ClientSizeTestCase : public CppUnit::TestCase
30{
31public:
32 ClientSizeTestCase() { }
33
34 virtual void setUp();
35 virtual void tearDown();
36
37private:
38 CPPUNIT_TEST_SUITE( ClientSizeTestCase );
39 CPPUNIT_TEST( ClientToWindow );
352a7d6c 40 CPPUNIT_TEST( ClientSizeNotNegative );
301d7a0d
VS
41 CPPUNIT_TEST( WindowToClient );
42 CPPUNIT_TEST_SUITE_END();
43
44 void ClientToWindow();
352a7d6c 45 void ClientSizeNotNegative();
301d7a0d
VS
46 void WindowToClient();
47
48 wxWindow *m_win;
49
50 DECLARE_NO_COPY_CLASS(ClientSizeTestCase)
51};
52
53// register in the unnamed registry so that these tests are run by default
54CPPUNIT_TEST_SUITE_REGISTRATION( ClientSizeTestCase );
55
e3778b4d 56// also include in its own registry so that these tests can be run alone
301d7a0d
VS
57CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ClientSizeTestCase, "ClientSizeTestCase" );
58
59// ----------------------------------------------------------------------------
60// test initialization
61// ----------------------------------------------------------------------------
62
63void ClientSizeTestCase::setUp()
64{
65 m_win = wxTheApp->GetTopWindow();
66}
67
68void ClientSizeTestCase::tearDown()
69{
70 m_win = NULL;
71}
72
73// ----------------------------------------------------------------------------
74// tests themselves
75// ----------------------------------------------------------------------------
76
77void ClientSizeTestCase::ClientToWindow()
78{
79 CPPUNIT_ASSERT(m_win->GetSize() ==
80 m_win->ClientToWindowSize(m_win->GetClientSize()));
81}
82
352a7d6c
VZ
83void ClientSizeTestCase::ClientSizeNotNegative()
84{
85 wxWindow* w = new wxWindow(wxTheApp->GetTopWindow(), -1,
86 wxDefaultPosition, wxDefaultSize,
87 wxBORDER_THEME);
88 w->SetSize(wxSize(1,1));
89 const wxSize szw = w->GetClientSize();
90 CPPUNIT_ASSERT(szw.GetWidth() >= 0);
91 CPPUNIT_ASSERT(szw.GetHeight() >= 0);
92 w->Destroy();
93}
94
301d7a0d
VS
95void ClientSizeTestCase::WindowToClient()
96{
97 CPPUNIT_ASSERT(m_win->GetClientSize() ==
98 m_win->WindowToClientSize(m_win->GetSize()));
99}