]>
git.saurik.com Git - wxWidgets.git/blob - tests/misc/guifuncs.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/misc/misctests.cpp
3 // Purpose: test miscellaneous GUI functions
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2008 Vadim Zeitlin
8 ///////////////////////////////////////////////////////////////////////////////
10 // ----------------------------------------------------------------------------
12 // ----------------------------------------------------------------------------
21 #include "wx/gdicmn.h"
26 // ----------------------------------------------------------------------------
28 // ----------------------------------------------------------------------------
30 class MiscGUIFuncsTestCase
: public CppUnit::TestCase
33 MiscGUIFuncsTestCase() { }
36 CPPUNIT_TEST_SUITE( MiscGUIFuncsTestCase
);
37 CPPUNIT_TEST( DisplaySize
);
38 CPPUNIT_TEST_SUITE_END();
42 DECLARE_NO_COPY_CLASS(MiscGUIFuncsTestCase
)
45 // register in the unnamed registry so that these tests are run by default
46 CPPUNIT_TEST_SUITE_REGISTRATION( MiscGUIFuncsTestCase
);
48 // also include in it's own registry so that these tests can be run alone
49 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MiscGUIFuncsTestCase
, "MiscGUIFuncsTestCase" );
51 void MiscGUIFuncsTestCase::DisplaySize()
53 // test that different (almost) overloads return the same results
55 wxDisplaySize(&w
, &h
);
56 wxSize sz
= wxGetDisplaySize();
58 CPPUNIT_ASSERT_EQUAL( w
, sz
.x
);
59 CPPUNIT_ASSERT_EQUAL( h
, sz
.y
);
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
);
66 CPPUNIT_ASSERT_EQUAL( w
, sz
.x
);
67 CPPUNIT_ASSERT_EQUAL( h
, sz
.y
);
69 // test that display PPI is something reasonable
70 sz
= wxGetDisplayPPI();
71 CPPUNIT_ASSERT( sz
.x
< 1000 && sz
.y
< 1000 );