]> git.saurik.com Git - wxWidgets.git/blame - tests/misc/guifuncs.cpp
fix wxTextCtrl::Replace() under wxGTK; added unit test for it and describe its effect...
[wxWidgets.git] / tests / misc / guifuncs.cpp
CommitLineData
841a25bb
VZ
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
fbfd8b1a
VZ
20#ifndef WX_PRECOMP
21 #include "wx/gdicmn.h"
22#endif // !PCH
23
841a25bb
VZ
24#include "wx/defs.h"
25
26// ----------------------------------------------------------------------------
27// test class
28// ----------------------------------------------------------------------------
29
30class MiscGUIFuncsTestCase : public CppUnit::TestCase
31{
32public:
33 MiscGUIFuncsTestCase() { }
34
35private:
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
46CPPUNIT_TEST_SUITE_REGISTRATION( MiscGUIFuncsTestCase );
47
48// also include in it's own registry so that these tests can be run alone
49CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MiscGUIFuncsTestCase, "MiscGUIFuncsTestCase" );
50
51void 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