make sure that wxSystemSettings::GetFont/GetColour return values are always valid
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59820 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -217,8 +217,9 @@ enum wxSystemScreenType
|
|||||||
@class wxSystemSettings
|
@class wxSystemSettings
|
||||||
|
|
||||||
wxSystemSettings allows the application to ask for details about the system.
|
wxSystemSettings allows the application to ask for details about the system.
|
||||||
This can include settings such as standard colours, fonts,
|
|
||||||
and user interface element sizes.
|
This can include settings such as standard colours, fonts, and user interface
|
||||||
|
element sizes.
|
||||||
|
|
||||||
@library{wxcore}
|
@library{wxcore}
|
||||||
@category{cfg}
|
@category{cfg}
|
||||||
@@ -238,13 +239,23 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a system colour.
|
Returns a system colour.
|
||||||
@a index can be one of the ::wxSystemColour enum values.
|
|
||||||
|
@param index
|
||||||
|
Can be one of the ::wxSystemColour enum values.
|
||||||
|
|
||||||
|
@return
|
||||||
|
The returned colour is always valid.
|
||||||
*/
|
*/
|
||||||
static wxColour GetColour(wxSystemColour index);
|
static wxColour GetColour(wxSystemColour index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a system font.
|
Returns a system font.
|
||||||
@a index can be one of the ::wxSystemFont enum values.
|
|
||||||
|
@param index
|
||||||
|
Can be one of the ::wxSystemFont enum values.
|
||||||
|
|
||||||
|
@return
|
||||||
|
The returned font is always valid.
|
||||||
*/
|
*/
|
||||||
static wxFont GetFont(wxSystemFont index);
|
static wxFont GetFont(wxSystemFont index);
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/fontutil.h"
|
#include "wx/fontutil.h"
|
||||||
|
#include "wx/fontenum.h"
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include "wx/gtk/private/win_gtk.h"
|
#include "wx/gtk/private/win_gtk.h"
|
||||||
@@ -232,6 +233,7 @@ wxColour wxSystemSettingsNative::GetColour( wxSystemColour index )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxASSERT(color.IsOk());
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,6 +257,13 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
|
|||||||
wxNativeFontInfo info;
|
wxNativeFontInfo info;
|
||||||
info.description = ButtonStyle()->font_desc;
|
info.description = ButtonStyle()->font_desc;
|
||||||
gs_fontSystem = wxFont(info);
|
gs_fontSystem = wxFont(info);
|
||||||
|
|
||||||
|
// (try to) heal the default font (on some common systems e.g. Ubuntu
|
||||||
|
// it's "Sans Serif" but the real font is called "Sans"):
|
||||||
|
if (!wxFontEnumerator::IsValidFacename(gs_fontSystem.GetFaceName()) &&
|
||||||
|
gs_fontSystem.GetFaceName() == "Sans Serif")
|
||||||
|
gs_fontSystem.SetFaceName("Sans");
|
||||||
|
|
||||||
info.description = NULL;
|
info.description = NULL;
|
||||||
}
|
}
|
||||||
font = gs_fontSystem;
|
font = gs_fontSystem;
|
||||||
@@ -263,6 +272,9 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxASSERT(font.IsOk() && wxFontEnumerator::IsValidFacename(font.GetFaceName()));
|
||||||
|
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/fontutil.h"
|
#include "wx/fontutil.h"
|
||||||
|
#include "wx/fontenum.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// private classes
|
// private classes
|
||||||
@@ -207,8 +208,10 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
|||||||
colSys = ::GetSysColor(index);
|
colSys = ::GetSysColor(index);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxRGBToColour(colSys);
|
wxColour ret = wxRGBToColour(colSys);
|
||||||
|
wxASSERT(ret.IsOk());
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -267,6 +270,8 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
|
|||||||
gs_fontDefault = new wxFont(wxCreateFontFromStockObject(SYSTEM_FONT));
|
gs_fontDefault = new wxFont(wxCreateFontFromStockObject(SYSTEM_FONT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxASSERT(gs_fontDefault->IsOk() &&
|
||||||
|
wxFontEnumerator::IsValidFacename(gs_fontDefault->GetFaceName()));
|
||||||
return *gs_fontDefault;
|
return *gs_fontDefault;
|
||||||
#else // !__WXWINCE__
|
#else // !__WXWINCE__
|
||||||
// wxWindow ctor calls GetFont(wxSYS_DEFAULT_GUI_FONT) so we're
|
// wxWindow ctor calls GetFont(wxSYS_DEFAULT_GUI_FONT) so we're
|
||||||
@@ -286,6 +291,7 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
|
|||||||
gs_fontDefault = new wxFont(font);
|
gs_fontDefault = new wxFont(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxASSERT(font.IsOk() && wxFontEnumerator::IsValidFacename(font.GetFaceName()));
|
||||||
return font;
|
return font;
|
||||||
#endif // __WXWINCE__/!__WXWINCE__
|
#endif // __WXWINCE__/!__WXWINCE__
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/osx/private.h"
|
#include "wx/osx/private.h"
|
||||||
|
#include "wx/fontenum.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxSystemSettingsNative
|
// wxSystemSettingsNative
|
||||||
@@ -146,6 +147,8 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
|||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//wxASSERT(resultColor.IsOk());
|
||||||
|
|
||||||
return resultColor;
|
return resultColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,20 +158,25 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
|||||||
|
|
||||||
wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
|
wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
|
||||||
{
|
{
|
||||||
|
wxFont font;
|
||||||
|
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case wxSYS_ANSI_VAR_FONT :
|
case wxSYS_ANSI_VAR_FONT :
|
||||||
case wxSYS_SYSTEM_FONT :
|
case wxSYS_SYSTEM_FONT :
|
||||||
case wxSYS_DEVICE_DEFAULT_FONT :
|
case wxSYS_DEVICE_DEFAULT_FONT :
|
||||||
case wxSYS_DEFAULT_GUI_FONT :
|
case wxSYS_DEFAULT_GUI_FONT :
|
||||||
return *wxSMALL_FONT ;
|
font = *wxSMALL_FONT ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
|
font = *wxNORMAL_FONT ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *wxNORMAL_FONT;
|
//wxASSERT(font.IsOk() && wxFontEnumerator::IsValidFacename(font.GetFaceName()));
|
||||||
|
|
||||||
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -141,6 +141,7 @@ TEST_GUI_OBJECTS = \
|
|||||||
test_gui_guifuncs.o \
|
test_gui_guifuncs.o \
|
||||||
test_gui_selstoretest.o \
|
test_gui_selstoretest.o \
|
||||||
test_gui_garbage.o \
|
test_gui_garbage.o \
|
||||||
|
test_gui_settings.o \
|
||||||
test_gui_socket.o \
|
test_gui_socket.o \
|
||||||
test_gui_clientsize.o \
|
test_gui_clientsize.o \
|
||||||
test_gui_setsize.o
|
test_gui_setsize.o
|
||||||
@@ -602,6 +603,9 @@ test_gui_selstoretest.o: $(srcdir)/misc/selstoretest.cpp $(TEST_GUI_ODEP)
|
|||||||
test_gui_garbage.o: $(srcdir)/misc/garbage.cpp $(TEST_GUI_ODEP)
|
test_gui_garbage.o: $(srcdir)/misc/garbage.cpp $(TEST_GUI_ODEP)
|
||||||
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/misc/garbage.cpp
|
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/misc/garbage.cpp
|
||||||
|
|
||||||
|
test_gui_settings.o: $(srcdir)/misc/settings.cpp $(TEST_GUI_ODEP)
|
||||||
|
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/misc/settings.cpp
|
||||||
|
|
||||||
test_gui_socket.o: $(srcdir)/net/socket.cpp $(TEST_GUI_ODEP)
|
test_gui_socket.o: $(srcdir)/net/socket.cpp $(TEST_GUI_ODEP)
|
||||||
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/net/socket.cpp
|
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/net/socket.cpp
|
||||||
|
|
||||||
|
@@ -126,6 +126,7 @@ TEST_GUI_OBJECTS = \
|
|||||||
$(OBJS)\test_gui_guifuncs.obj \
|
$(OBJS)\test_gui_guifuncs.obj \
|
||||||
$(OBJS)\test_gui_selstoretest.obj \
|
$(OBJS)\test_gui_selstoretest.obj \
|
||||||
$(OBJS)\test_gui_garbage.obj \
|
$(OBJS)\test_gui_garbage.obj \
|
||||||
|
$(OBJS)\test_gui_settings.obj \
|
||||||
$(OBJS)\test_gui_socket.obj \
|
$(OBJS)\test_gui_socket.obj \
|
||||||
$(OBJS)\test_gui_clientsize.obj \
|
$(OBJS)\test_gui_clientsize.obj \
|
||||||
$(OBJS)\test_gui_setsize.obj
|
$(OBJS)\test_gui_setsize.obj
|
||||||
@@ -644,6 +645,9 @@ $(OBJS)\test_gui_selstoretest.obj: .\misc\selstoretest.cpp
|
|||||||
$(OBJS)\test_gui_garbage.obj: .\misc\garbage.cpp
|
$(OBJS)\test_gui_garbage.obj: .\misc\garbage.cpp
|
||||||
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\misc\garbage.cpp
|
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\misc\garbage.cpp
|
||||||
|
|
||||||
|
$(OBJS)\test_gui_settings.obj: .\misc\settings.cpp
|
||||||
|
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\misc\settings.cpp
|
||||||
|
|
||||||
$(OBJS)\test_gui_socket.obj: .\net\socket.cpp
|
$(OBJS)\test_gui_socket.obj: .\net\socket.cpp
|
||||||
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\net\socket.cpp
|
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\net\socket.cpp
|
||||||
|
|
||||||
|
@@ -119,6 +119,7 @@ TEST_GUI_OBJECTS = \
|
|||||||
$(OBJS)\test_gui_guifuncs.o \
|
$(OBJS)\test_gui_guifuncs.o \
|
||||||
$(OBJS)\test_gui_selstoretest.o \
|
$(OBJS)\test_gui_selstoretest.o \
|
||||||
$(OBJS)\test_gui_garbage.o \
|
$(OBJS)\test_gui_garbage.o \
|
||||||
|
$(OBJS)\test_gui_settings.o \
|
||||||
$(OBJS)\test_gui_socket.o \
|
$(OBJS)\test_gui_socket.o \
|
||||||
$(OBJS)\test_gui_clientsize.o \
|
$(OBJS)\test_gui_clientsize.o \
|
||||||
$(OBJS)\test_gui_setsize.o
|
$(OBJS)\test_gui_setsize.o
|
||||||
@@ -624,6 +625,9 @@ $(OBJS)\test_gui_selstoretest.o: ./misc/selstoretest.cpp
|
|||||||
$(OBJS)\test_gui_garbage.o: ./misc/garbage.cpp
|
$(OBJS)\test_gui_garbage.o: ./misc/garbage.cpp
|
||||||
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
|
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
|
||||||
|
|
||||||
|
$(OBJS)\test_gui_settings.o: ./misc/settings.cpp
|
||||||
|
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
|
||||||
|
|
||||||
$(OBJS)\test_gui_socket.o: ./net/socket.cpp
|
$(OBJS)\test_gui_socket.o: ./net/socket.cpp
|
||||||
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
|
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
|
||||||
|
|
||||||
|
@@ -122,6 +122,7 @@ TEST_GUI_OBJECTS = \
|
|||||||
$(OBJS)\test_gui_guifuncs.obj \
|
$(OBJS)\test_gui_guifuncs.obj \
|
||||||
$(OBJS)\test_gui_selstoretest.obj \
|
$(OBJS)\test_gui_selstoretest.obj \
|
||||||
$(OBJS)\test_gui_garbage.obj \
|
$(OBJS)\test_gui_garbage.obj \
|
||||||
|
$(OBJS)\test_gui_settings.obj \
|
||||||
$(OBJS)\test_gui_socket.obj \
|
$(OBJS)\test_gui_socket.obj \
|
||||||
$(OBJS)\test_gui_clientsize.obj \
|
$(OBJS)\test_gui_clientsize.obj \
|
||||||
$(OBJS)\test_gui_setsize.obj
|
$(OBJS)\test_gui_setsize.obj
|
||||||
@@ -729,6 +730,9 @@ $(OBJS)\test_gui_selstoretest.obj: .\misc\selstoretest.cpp
|
|||||||
$(OBJS)\test_gui_garbage.obj: .\misc\garbage.cpp
|
$(OBJS)\test_gui_garbage.obj: .\misc\garbage.cpp
|
||||||
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\misc\garbage.cpp
|
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\misc\garbage.cpp
|
||||||
|
|
||||||
|
$(OBJS)\test_gui_settings.obj: .\misc\settings.cpp
|
||||||
|
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\misc\settings.cpp
|
||||||
|
|
||||||
$(OBJS)\test_gui_socket.obj: .\net\socket.cpp
|
$(OBJS)\test_gui_socket.obj: .\net\socket.cpp
|
||||||
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\net\socket.cpp
|
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\net\socket.cpp
|
||||||
|
|
||||||
|
@@ -357,6 +357,7 @@ TEST_GUI_OBJECTS = &
|
|||||||
$(OBJS)\test_gui_guifuncs.obj &
|
$(OBJS)\test_gui_guifuncs.obj &
|
||||||
$(OBJS)\test_gui_selstoretest.obj &
|
$(OBJS)\test_gui_selstoretest.obj &
|
||||||
$(OBJS)\test_gui_garbage.obj &
|
$(OBJS)\test_gui_garbage.obj &
|
||||||
|
$(OBJS)\test_gui_settings.obj &
|
||||||
$(OBJS)\test_gui_socket.obj &
|
$(OBJS)\test_gui_socket.obj &
|
||||||
$(OBJS)\test_gui_clientsize.obj &
|
$(OBJS)\test_gui_clientsize.obj &
|
||||||
$(OBJS)\test_gui_setsize.obj
|
$(OBJS)\test_gui_setsize.obj
|
||||||
@@ -685,6 +686,9 @@ $(OBJS)\test_gui_selstoretest.obj : .AUTODEPEND .\misc\selstoretest.cpp
|
|||||||
$(OBJS)\test_gui_garbage.obj : .AUTODEPEND .\misc\garbage.cpp
|
$(OBJS)\test_gui_garbage.obj : .AUTODEPEND .\misc\garbage.cpp
|
||||||
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
|
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
|
||||||
|
|
||||||
|
$(OBJS)\test_gui_settings.obj : .AUTODEPEND .\misc\settings.cpp
|
||||||
|
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
|
||||||
|
|
||||||
$(OBJS)\test_gui_socket.obj : .AUTODEPEND .\net\socket.cpp
|
$(OBJS)\test_gui_socket.obj : .AUTODEPEND .\net\socket.cpp
|
||||||
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
|
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
|
||||||
|
|
||||||
|
159
tests/misc/settings.cpp
Normal file
159
tests/misc/settings.cpp
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: tests/misc/settings.cpp
|
||||||
|
// Purpose: test wxSettings
|
||||||
|
// Author: Francesco Montorsi
|
||||||
|
// Created: 2009-03-24
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2009 Francesco Montorsi
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "testprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/settings.h"
|
||||||
|
#include "wx/fontenum.h"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// test class
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class SettingsTestCase : public CppUnit::TestCase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SettingsTestCase() { }
|
||||||
|
|
||||||
|
private:
|
||||||
|
CPPUNIT_TEST_SUITE( SettingsTestCase );
|
||||||
|
CPPUNIT_TEST( GetColour );
|
||||||
|
CPPUNIT_TEST( GetFont );
|
||||||
|
CPPUNIT_TEST( GlobalColours );
|
||||||
|
CPPUNIT_TEST( GlobalFonts );
|
||||||
|
CPPUNIT_TEST( GlobalBrushes );
|
||||||
|
CPPUNIT_TEST( GlobalPens );
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
void GetColour();
|
||||||
|
void GetFont();
|
||||||
|
|
||||||
|
// not really wxSystemSettings stuff but still nice to test:
|
||||||
|
void GlobalColours();
|
||||||
|
void GlobalFonts();
|
||||||
|
void GlobalBrushes();
|
||||||
|
void GlobalPens();
|
||||||
|
|
||||||
|
DECLARE_NO_COPY_CLASS(SettingsTestCase)
|
||||||
|
};
|
||||||
|
|
||||||
|
// register in the unnamed registry so that these tests are run by default
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION( SettingsTestCase );
|
||||||
|
|
||||||
|
// also include in it's own registry so that these tests can be run alone
|
||||||
|
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SettingsTestCase, "SettingsTestCase" );
|
||||||
|
|
||||||
|
|
||||||
|
void SettingsTestCase::GetColour()
|
||||||
|
{
|
||||||
|
for (unsigned int i=wxSYS_COLOUR_SCROLLBAR; i < wxSYS_COLOUR_MAX; i++)
|
||||||
|
CPPUNIT_ASSERT( wxSystemSettings::GetColour((wxSystemColour)i).IsOk() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsTestCase::GetFont()
|
||||||
|
{
|
||||||
|
const wxSystemFont ids[] =
|
||||||
|
{
|
||||||
|
wxSYS_OEM_FIXED_FONT,
|
||||||
|
wxSYS_ANSI_FIXED_FONT,
|
||||||
|
wxSYS_ANSI_VAR_FONT,
|
||||||
|
wxSYS_SYSTEM_FONT,
|
||||||
|
wxSYS_DEVICE_DEFAULT_FONT,
|
||||||
|
wxSYS_SYSTEM_FIXED_FONT,
|
||||||
|
wxSYS_DEFAULT_GUI_FONT
|
||||||
|
};
|
||||||
|
|
||||||
|
for (unsigned int i=0; i < WXSIZEOF(ids); i++)
|
||||||
|
{
|
||||||
|
const wxFont& font = wxSystemSettings::GetFont(ids[i]);
|
||||||
|
CPPUNIT_ASSERT( font.IsOk() &&
|
||||||
|
wxFontEnumerator::IsValidFacename(font.GetFaceName()) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsTestCase::GlobalColours()
|
||||||
|
{
|
||||||
|
wxColour col[] =
|
||||||
|
{
|
||||||
|
*wxBLACK,
|
||||||
|
*wxBLUE,
|
||||||
|
*wxCYAN,
|
||||||
|
*wxGREEN,
|
||||||
|
*wxLIGHT_GREY,
|
||||||
|
*wxRED,
|
||||||
|
*wxWHITE
|
||||||
|
};
|
||||||
|
|
||||||
|
for (unsigned int i=0; i < WXSIZEOF(col); i++)
|
||||||
|
CPPUNIT_ASSERT( col[i].IsOk() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsTestCase::GlobalFonts()
|
||||||
|
{
|
||||||
|
wxFont font[] =
|
||||||
|
{
|
||||||
|
*wxNORMAL_FONT,
|
||||||
|
*wxSMALL_FONT,
|
||||||
|
*wxITALIC_FONT,
|
||||||
|
*wxSWISS_FONT
|
||||||
|
};
|
||||||
|
|
||||||
|
for (unsigned int i=0; i < WXSIZEOF(font); i++)
|
||||||
|
CPPUNIT_ASSERT( font[i].IsOk() &&
|
||||||
|
wxFontEnumerator::IsValidFacename(font[i].GetFaceName()) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsTestCase::GlobalBrushes()
|
||||||
|
{
|
||||||
|
wxBrush brush[] =
|
||||||
|
{
|
||||||
|
*wxBLACK_BRUSH,
|
||||||
|
*wxBLUE_BRUSH,
|
||||||
|
*wxCYAN_BRUSH,
|
||||||
|
*wxGREEN_BRUSH,
|
||||||
|
*wxGREY_BRUSH,
|
||||||
|
*wxLIGHT_GREY_BRUSH,
|
||||||
|
*wxMEDIUM_GREY_BRUSH,
|
||||||
|
*wxRED_BRUSH,
|
||||||
|
*wxTRANSPARENT_BRUSH,
|
||||||
|
*wxWHITE_BRUSH
|
||||||
|
};
|
||||||
|
|
||||||
|
for (unsigned int i=0; i < WXSIZEOF(brush); i++)
|
||||||
|
CPPUNIT_ASSERT( brush[i].IsOk() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsTestCase::GlobalPens()
|
||||||
|
{
|
||||||
|
wxPen pen[] =
|
||||||
|
{
|
||||||
|
*wxBLACK_DASHED_PEN,
|
||||||
|
*wxBLACK_PEN,
|
||||||
|
*wxBLUE_PEN,
|
||||||
|
*wxCYAN_PEN,
|
||||||
|
*wxGREEN_PEN,
|
||||||
|
*wxGREY_PEN,
|
||||||
|
*wxLIGHT_GREY_PEN,
|
||||||
|
*wxMEDIUM_GREY_PEN,
|
||||||
|
*wxRED_PEN,
|
||||||
|
*wxTRANSPARENT_PEN,
|
||||||
|
*wxWHITE_PEN
|
||||||
|
};
|
||||||
|
|
||||||
|
for (unsigned int i=0; i < WXSIZEOF(pen); i++)
|
||||||
|
CPPUNIT_ASSERT( pen[i].IsOk() );
|
||||||
|
}
|
@@ -123,6 +123,7 @@
|
|||||||
misc/guifuncs.cpp
|
misc/guifuncs.cpp
|
||||||
misc/selstoretest.cpp
|
misc/selstoretest.cpp
|
||||||
misc/garbage.cpp
|
misc/garbage.cpp
|
||||||
|
misc/settings.cpp
|
||||||
<!--
|
<!--
|
||||||
This one is intentionally duplicated here (it is also part of
|
This one is intentionally duplicated here (it is also part of
|
||||||
non-GUI test) as sockets behave differently in console and GUI
|
non-GUI test) as sockets behave differently in console and GUI
|
||||||
|
@@ -309,6 +309,10 @@ SOURCE=.\window\setsize.cpp
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\misc\settings.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\geometry\size.cpp
|
SOURCE=.\geometry\size.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@@ -656,6 +656,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\window\setsize.cpp">
|
RelativePath=".\window\setsize.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\misc\settings.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\geometry\size.cpp">
|
RelativePath=".\geometry\size.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
@@ -951,6 +951,10 @@
|
|||||||
RelativePath=".\window\setsize.cpp"
|
RelativePath=".\window\setsize.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\misc\settings.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\geometry\size.cpp"
|
RelativePath=".\geometry\size.cpp"
|
||||||
>
|
>
|
||||||
|
@@ -923,6 +923,10 @@
|
|||||||
RelativePath=".\window\setsize.cpp"
|
RelativePath=".\window\setsize.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\misc\settings.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\geometry\size.cpp"
|
RelativePath=".\geometry\size.cpp"
|
||||||
>
|
>
|
||||||
|
Reference in New Issue
Block a user