added a simple test for wxGetDisplayXXX() functions
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55796 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -124,6 +124,7 @@ TEST_GUI_OBJECTS = \
|
||||
test_gui_textctrltest.o \
|
||||
test_gui_textentrytest.o \
|
||||
test_gui_rawbmp.o \
|
||||
test_gui_guifuncs.o \
|
||||
test_gui_selstoretest.o \
|
||||
test_gui_clientsize.o \
|
||||
test_gui_setsize.o
|
||||
@@ -531,6 +532,9 @@ test_gui_textentrytest.o: $(srcdir)/controls/textentrytest.cpp $(TEST_GUI_ODEP)
|
||||
test_gui_rawbmp.o: $(srcdir)/image/rawbmp.cpp $(TEST_GUI_ODEP)
|
||||
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/image/rawbmp.cpp
|
||||
|
||||
test_gui_guifuncs.o: $(srcdir)/misc/guifuncs.cpp $(TEST_GUI_ODEP)
|
||||
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/misc/guifuncs.cpp
|
||||
|
||||
test_gui_selstoretest.o: $(srcdir)/misc/selstoretest.cpp $(TEST_GUI_ODEP)
|
||||
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/misc/selstoretest.cpp
|
||||
|
||||
|
@@ -112,6 +112,7 @@ TEST_GUI_OBJECTS = \
|
||||
$(OBJS)\test_gui_textctrltest.obj \
|
||||
$(OBJS)\test_gui_textentrytest.obj \
|
||||
$(OBJS)\test_gui_rawbmp.obj \
|
||||
$(OBJS)\test_gui_guifuncs.obj \
|
||||
$(OBJS)\test_gui_selstoretest.obj \
|
||||
$(OBJS)\test_gui_clientsize.obj \
|
||||
$(OBJS)\test_gui_setsize.obj
|
||||
@@ -572,6 +573,9 @@ $(OBJS)\test_gui_textentrytest.obj: .\controls\textentrytest.cpp
|
||||
$(OBJS)\test_gui_rawbmp.obj: .\image\rawbmp.cpp
|
||||
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\image\rawbmp.cpp
|
||||
|
||||
$(OBJS)\test_gui_guifuncs.obj: .\misc\guifuncs.cpp
|
||||
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\misc\guifuncs.cpp
|
||||
|
||||
$(OBJS)\test_gui_selstoretest.obj: .\misc\selstoretest.cpp
|
||||
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\misc\selstoretest.cpp
|
||||
|
||||
|
@@ -105,6 +105,7 @@ TEST_GUI_OBJECTS = \
|
||||
$(OBJS)\test_gui_textctrltest.o \
|
||||
$(OBJS)\test_gui_textentrytest.o \
|
||||
$(OBJS)\test_gui_rawbmp.o \
|
||||
$(OBJS)\test_gui_guifuncs.o \
|
||||
$(OBJS)\test_gui_selstoretest.o \
|
||||
$(OBJS)\test_gui_clientsize.o \
|
||||
$(OBJS)\test_gui_setsize.o
|
||||
@@ -550,6 +551,9 @@ $(OBJS)\test_gui_textentrytest.o: ./controls/textentrytest.cpp
|
||||
$(OBJS)\test_gui_rawbmp.o: ./image/rawbmp.cpp
|
||||
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\test_gui_guifuncs.o: ./misc/guifuncs.cpp
|
||||
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\test_gui_selstoretest.o: ./misc/selstoretest.cpp
|
||||
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
|
@@ -108,6 +108,7 @@ TEST_GUI_OBJECTS = \
|
||||
$(OBJS)\test_gui_textctrltest.obj \
|
||||
$(OBJS)\test_gui_textentrytest.obj \
|
||||
$(OBJS)\test_gui_rawbmp.obj \
|
||||
$(OBJS)\test_gui_guifuncs.obj \
|
||||
$(OBJS)\test_gui_selstoretest.obj \
|
||||
$(OBJS)\test_gui_clientsize.obj \
|
||||
$(OBJS)\test_gui_setsize.obj
|
||||
@@ -657,6 +658,9 @@ $(OBJS)\test_gui_textentrytest.obj: .\controls\textentrytest.cpp
|
||||
$(OBJS)\test_gui_rawbmp.obj: .\image\rawbmp.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\image\rawbmp.cpp
|
||||
|
||||
$(OBJS)\test_gui_guifuncs.obj: .\misc\guifuncs.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\misc\guifuncs.cpp
|
||||
|
||||
$(OBJS)\test_gui_selstoretest.obj: .\misc\selstoretest.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\misc\selstoretest.cpp
|
||||
|
||||
|
@@ -317,6 +317,7 @@ TEST_GUI_OBJECTS = &
|
||||
$(OBJS)\test_gui_textctrltest.obj &
|
||||
$(OBJS)\test_gui_textentrytest.obj &
|
||||
$(OBJS)\test_gui_rawbmp.obj &
|
||||
$(OBJS)\test_gui_guifuncs.obj &
|
||||
$(OBJS)\test_gui_selstoretest.obj &
|
||||
$(OBJS)\test_gui_clientsize.obj &
|
||||
$(OBJS)\test_gui_setsize.obj
|
||||
@@ -603,6 +604,9 @@ $(OBJS)\test_gui_textentrytest.obj : .AUTODEPEND .\controls\textentrytest.cpp
|
||||
$(OBJS)\test_gui_rawbmp.obj : .AUTODEPEND .\image\rawbmp.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\test_gui_guifuncs.obj : .AUTODEPEND .\misc\guifuncs.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
|
||||
|
||||
$(OBJS)\test_gui_selstoretest.obj : .AUTODEPEND .\misc\selstoretest.cpp
|
||||
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
|
||||
|
||||
|
69
tests/misc/guifuncs.cpp
Normal file
69
tests/misc/guifuncs.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: tests/misc/misctests.cpp
|
||||
// Purpose: test miscellaneous GUI functions
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2008-09-22
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2008 Vadim Zeitlin
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "testprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// test class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class MiscGUIFuncsTestCase : public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
MiscGUIFuncsTestCase() { }
|
||||
|
||||
private:
|
||||
CPPUNIT_TEST_SUITE( MiscGUIFuncsTestCase );
|
||||
CPPUNIT_TEST( DisplaySize );
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
void DisplaySize();
|
||||
|
||||
DECLARE_NO_COPY_CLASS(MiscGUIFuncsTestCase)
|
||||
};
|
||||
|
||||
// register in the unnamed registry so that these tests are run by default
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION( MiscGUIFuncsTestCase );
|
||||
|
||||
// also include in it's own registry so that these tests can be run alone
|
||||
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MiscGUIFuncsTestCase, "MiscGUIFuncsTestCase" );
|
||||
|
||||
void MiscGUIFuncsTestCase::DisplaySize()
|
||||
{
|
||||
// test that different (almost) overloads return the same results
|
||||
int w, h;
|
||||
wxDisplaySize(&w, &h);
|
||||
wxSize sz = wxGetDisplaySize();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL( w, sz.x );
|
||||
CPPUNIT_ASSERT_EQUAL( h, sz.y );
|
||||
|
||||
// test that passing NULL works as expected, e.g. doesn't crash
|
||||
wxDisplaySize(NULL, NULL);
|
||||
wxDisplaySize(&w, NULL);
|
||||
wxDisplaySize(NULL, &h);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL( w, sz.x );
|
||||
CPPUNIT_ASSERT_EQUAL( h, sz.y );
|
||||
|
||||
// test that display PPI is something reasonable
|
||||
sz = wxGetDisplayPPI();
|
||||
CPPUNIT_ASSERT( sz.x < 1000 && sz.y < 1000 );
|
||||
}
|
||||
|
@@ -109,6 +109,7 @@
|
||||
controls/textctrltest.cpp
|
||||
controls/textentrytest.cpp
|
||||
image/rawbmp.cpp
|
||||
misc/guifuncs.cpp
|
||||
misc/selstoretest.cpp
|
||||
window/clientsize.cpp
|
||||
window/setsize.cpp
|
||||
|
@@ -253,6 +253,10 @@ SOURCE=.\dummy.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\misc\guifuncs.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\geometry\point.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@@ -706,6 +706,8 @@
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\misc\guifuncs.cpp"/>
|
||||
<File
|
||||
RelativePath=".\geometry\point.cpp"/>
|
||||
<File
|
||||
|
@@ -884,6 +884,9 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\misc\guifuncs.cpp"
|
||||
/>
|
||||
<File
|
||||
RelativePath=".\geometry\point.cpp"
|
||||
/>
|
||||
|
Reference in New Issue
Block a user