compilation fix for PCH-less build
[wxWidgets.git] / tests / misc / guifuncs.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/misc/misctests.cpp
3 // Purpose: test miscellaneous GUI functions
4 // Author: Vadim Zeitlin
5 // Created: 2008-09-22
6 // RCS-ID: $Id$
7 // Copyright: (c) 2008 Vadim Zeitlin
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/gdicmn.h"
22 #endif // !PCH
23
24 #include "wx/defs.h"
25
26 // ----------------------------------------------------------------------------
27 // test class
28 // ----------------------------------------------------------------------------
29
30 class MiscGUIFuncsTestCase : public CppUnit::TestCase
31 {
32 public:
33 MiscGUIFuncsTestCase() { }
34
35 private:
36 CPPUNIT_TEST_SUITE( MiscGUIFuncsTestCase );
37 CPPUNIT_TEST( DisplaySize );
38 CPPUNIT_TEST_SUITE_END();
39
40 void DisplaySize();
41
42 DECLARE_NO_COPY_CLASS(MiscGUIFuncsTestCase)
43 };
44
45 // register in the unnamed registry so that these tests are run by default
46 CPPUNIT_TEST_SUITE_REGISTRATION( MiscGUIFuncsTestCase );
47
48 // also include in it's own registry so that these tests can be run alone
49 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MiscGUIFuncsTestCase, "MiscGUIFuncsTestCase" );
50
51 void MiscGUIFuncsTestCase::DisplaySize()
52 {
53 // test that different (almost) overloads return the same results
54 int w, h;
55 wxDisplaySize(&w, &h);
56 wxSize sz = wxGetDisplaySize();
57
58 CPPUNIT_ASSERT_EQUAL( w, sz.x );
59 CPPUNIT_ASSERT_EQUAL( h, sz.y );
60
61 // test that passing NULL works as expected, e.g. doesn't crash
62 wxDisplaySize(NULL, NULL);
63 wxDisplaySize(&w, NULL);
64 wxDisplaySize(NULL, &h);
65
66 CPPUNIT_ASSERT_EQUAL( w, sz.x );
67 CPPUNIT_ASSERT_EQUAL( h, sz.y );
68
69 // test that display PPI is something reasonable
70 sz = wxGetDisplayPPI();
71 CPPUNIT_ASSERT( sz.x < 1000 && sz.y < 1000 );
72 }
73