Merge branch 'master' into web-request

Merge with the latest master in preparation for merging into master.

Rebake to resolve conflicts in generated files.
This commit is contained in:
Vadim Zeitlin
2020-12-12 17:44:45 +01:00
3934 changed files with 147571 additions and 96246 deletions

View File

@@ -1,6 +1,6 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.11 (http://www.bakefile.org)
# Bakefile 0.2.12 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
@@ -27,6 +27,7 @@ CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
USE_DPI_AWARE_MANIFEST = @USE_DPI_AWARE_MANIFEST@
WX_LIB_FLAVOUR = @WX_LIB_FLAVOUR@
TOOLKIT = @TOOLKIT@
TOOLKIT_LOWERCASE = @TOOLKIT_LOWERCASE@
@@ -37,7 +38,9 @@ EXTRALIBS_XML = @EXTRALIBS_XML@
EXTRALIBS_HTML = @EXTRALIBS_HTML@
EXTRALIBS_MEDIA = @EXTRALIBS_MEDIA@
EXTRALIBS_GUI = @EXTRALIBS_GUI@
CXXWARNINGS = @CXXWARNINGS@
WX_CPPFLAGS = @WX_CPPFLAGS@
WX_CXXFLAGS = @WX_CXXFLAGS@
WX_LDFLAGS = @WX_LDFLAGS@
HOST_SUFFIX = @HOST_SUFFIX@
SAMPLES_RPATH_FLAG = @SAMPLES_RPATH_FLAG@
SAMPLES_CXXFLAGS = @SAMPLES_CXXFLAGS@
@@ -47,13 +50,13 @@ wx_top_builddir = @wx_top_builddir@
DESTDIR =
WX_RELEASE = 3.1
WX_VERSION = $(WX_RELEASE).3
WX_VERSION = $(WX_RELEASE).5
LIBDIRNAME = $(wx_top_builddir)/lib
TEST_CXXFLAGS = $(__test_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
$(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) -DwxUSE_GUI=0 \
-I$(top_srcdir)/3rdparty/catch/include $(CXXWARNINGS) $(SAMPLES_CXXFLAGS) \
$(CPPFLAGS) $(CXXFLAGS)
TEST_CXXFLAGS = $(__test_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) \
-DwxUSE_GUI=0 -I$(top_srcdir)/3rdparty/catch/include $(WX_CXXFLAGS) \
$(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
TEST_OBJECTS = \
test_test.o \
test_anytest.o \
@@ -142,11 +145,12 @@ TEST_OBJECTS = \
test_xlocale.o \
test_xmltest.o
TEST_ODEP = $(_____pch_testprec_test_testprec_h_gch___depname)
TEST_DRAWING_CXXFLAGS = $(__test_drawing_PCH_INC) -D__WX$(TOOLKIT)__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) \
-DwxUSE_GUI=0 -I$(top_srcdir)/3rdparty/catch/include $(CXXWARNINGS) \
$(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
TEST_DRAWING_CXXFLAGS = $(__test_drawing_PCH_INC) $(WX_CPPFLAGS) \
-D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
-I$(srcdir) $(__DLLFLAG_p) -DwxUSE_GUI=0 \
-I$(top_srcdir)/3rdparty/catch/include $(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) \
$(CPPFLAGS) $(CXXFLAGS)
TEST_DRAWING_OBJECTS = \
test_drawing_test.o \
test_drawing_drawing.o \
@@ -155,17 +159,17 @@ TEST_DRAWING_OBJECTS = \
test_drawing_fonttest.o
TEST_DRAWING_ODEP = \
$(_____pch_testprec_test_drawing_testprec_h_gch___depname)
TEST_DRAWINGPLUGIN_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
$(__THREAD_DEFINE_p) $(__DLLFLAG_p) $(PIC_FLAG) $(CXXWARNINGS) $(CPPFLAGS) \
$(CXXFLAGS)
TEST_DRAWINGPLUGIN_CXXFLAGS = $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__DLLFLAG_p) $(PIC_FLAG) \
$(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
TEST_DRAWINGPLUGIN_OBJECTS = \
test_drawingplugin_pluginsample.o
TEST_GUI_CXXFLAGS = $(__test_gui_PCH_INC) -D__WX$(TOOLKIT)__ \
TEST_GUI_CXXFLAGS = $(__test_gui_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) \
-I$(srcdir)/../samples -I$(top_srcdir)/3rdparty/catch/include \
$(CXXWARNINGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
$(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
TEST_GUI_OBJECTS = \
$(__test_gui___win32rc) \
test_gui_asserthelper.o \
@@ -182,9 +186,11 @@ TEST_GUI_OBJECTS = \
test_gui_affinematrix.o \
test_gui_boundingbox.o \
test_gui_clippingbox.o \
test_gui_coords.o \
test_gui_graphmatrix.o \
test_gui_graphpath.o \
test_gui_config.o \
test_gui_auitest.o \
test_gui_bitmapcomboboxtest.o \
test_gui_bitmaptogglebuttontest.o \
test_gui_bookctrlbasetest.o \
@@ -223,6 +229,7 @@ TEST_GUI_OBJECTS = \
test_gui_slidertest.o \
test_gui_spinctrldbltest.o \
test_gui_spinctrltest.o \
test_gui_styledtextctrltest.o \
test_gui_textctrltest.o \
test_gui_textentrytest.o \
test_gui_togglebuttontest.o \
@@ -255,15 +262,31 @@ TEST_GUI_OBJECTS = \
test_gui_socket.o \
test_gui_tlw.o \
test_gui_dataview.o \
test_gui_rowheightcachetest.o \
test_gui_boxsizer.o \
test_gui_gridsizer.o \
test_gui_wrapsizer.o \
test_gui_toplevel.o \
test_gui_valnum.o \
test_gui_valtext.o \
test_gui_clientsize.o \
test_gui_setsize.o \
test_gui_xrctest.o
TEST_GUI_ODEP = $(_____pch_testprec_test_gui_testprec_h_gch___depname)
TEST_ALLHEADERS_CXXFLAGS = $(__test_allheaders_PCH_INC) $(WX_CPPFLAGS) \
-D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
-I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../samples \
-I$(top_srcdir)/3rdparty/catch/include $(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) \
$(CPPFLAGS) $(CXXFLAGS)
TEST_ALLHEADERS_OBJECTS = \
$(__test_allheaders___win32rc) \
test_allheaders_asserthelper.o \
test_allheaders_test.o \
test_allheaders_allheaders.o \
test_allheaders_testableframe.o
TEST_ALLHEADERS_ODEP = \
$(_____pch_testprec_test_allheaders_testprec_h_gch___depname)
### Conditionally set variables: ###
@@ -297,18 +320,12 @@ TEST_GUI_ODEP = $(_____pch_testprec_test_gui_testprec_h_gch___depname)
@COND_SHARED_1_USE_GUI_1@ = \
@COND_SHARED_1_USE_GUI_1@ $(DLLPREFIX_MODULE)test_drawingplugin.$(SO_SUFFIX_MODULE)
@COND_USE_GUI_1@__test_gui___depname = test_gui$(EXEEXT)
@COND_WXUNIV_1@__WXUNIV_DEFINE_p_6 = --define __WXUNIVERSAL__
@COND_DEBUG_FLAG_0@__DEBUG_DEFINE_p_6 = --define wxDEBUG_LEVEL=0
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p_6 = --define wxNO_EXCEPTIONS
@COND_USE_RTTI_0@__RTTI_DEFINE_p_6 = --define wxNO_RTTI
@COND_USE_THREADS_0@__THREAD_DEFINE_p_6 = --define wxNO_THREADS
@COND_SHARED_1@__DLLFLAG_p_6 = --define WXUSINGDLL
@COND_TOOLKIT_MSW@__RCDEFDIR_p = --include-dir \
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
@COND_PLATFORM_MACOSX_1_USE_GUI_1@__test_gui_app_Contents_PkgInfo___depname \
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ = test_gui.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1_USE_GUI_1@__test_gui_bundle___depname \
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ = test_gui_bundle
@COND_TOOLKIT_COCOA@____test_gui_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_COCOA@ $(__test_gui_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_MAC@____test_gui_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_MAC@ $(__test_gui_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_CARBON@____test_gui_BUNDLE_TGT_REF_DEP \
@@ -317,17 +334,15 @@ TEST_GUI_ODEP = $(_____pch_testprec_test_gui_testprec_h_gch___depname)
@COND_TOOLKIT_OSX_COCOA@ = $(__test_gui_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_IPHONE@____test_gui_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_IPHONE@ = $(__test_gui_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_COCOA@____test_gui_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_COCOA@ $(__test_gui_app_Contents_PkgInfo___depname)
@COND_PLATFORM_WIN32_1@__test_gui___win32rc = test_gui_sample_rc.o
@COND_GCC_PCH_1@__test_gui_PCH_INC = -I./.pch/testprec_test_gui
@COND_ICC_PCH_1@__test_gui_PCH_INC = $(ICC_PCH_USE_SWITCH) \
@COND_ICC_PCH_1@ ./.pch/testprec_test_gui/testprec.h.gch
@COND_USE_PCH_1@_____pch_testprec_test_gui_testprec_h_gch___depname \
@COND_USE_PCH_1@ = ./.pch/testprec_test_gui/testprec.h.gch
COND_MONOLITHIC_0_USE_WEBVIEW_1___WXLIB_WEBVIEW_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_webview-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0_USE_WEBVIEW_1@__WXLIB_WEBVIEW_p = $(COND_MONOLITHIC_0_USE_WEBVIEW_1___WXLIB_WEBVIEW_p)
COND_MONOLITHIC_0___WXLIB_AUI_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_aui-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_AUI_p = $(COND_MONOLITHIC_0___WXLIB_AUI_p)
COND_MONOLITHIC_0___WXLIB_RICHTEXT_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_richtext-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_RICHTEXT_p = $(COND_MONOLITHIC_0___WXLIB_RICHTEXT_p)
@@ -340,21 +355,65 @@ COND_MONOLITHIC_0___WXLIB_XRC_p = \
COND_MONOLITHIC_0___WXLIB_HTML_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_html-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_HTML_p = $(COND_MONOLITHIC_0___WXLIB_HTML_p)
@COND_USE_GUI_1@__test_allheaders___depname = test_allheaders$(EXEEXT)
@COND_PLATFORM_MACOSX_1_USE_GUI_1@__test_allheaders_app_Contents_PkgInfo___depname \
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ = test_allheaders.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1_USE_GUI_1@__test_allheaders_bundle___depname \
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ = test_allheaders_bundle
@COND_TOOLKIT_COCOA@____test_allheaders_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_COCOA@ = $(__test_allheaders_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_MAC@____test_allheaders_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_MAC@ = $(__test_allheaders_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_CARBON@____test_allheaders_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_CARBON@ = \
@COND_TOOLKIT_OSX_CARBON@ $(__test_allheaders_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_COCOA@____test_allheaders_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_COCOA@ = \
@COND_TOOLKIT_OSX_COCOA@ $(__test_allheaders_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_IPHONE@____test_allheaders_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_IPHONE@ = \
@COND_TOOLKIT_OSX_IPHONE@ $(__test_allheaders_app_Contents_PkgInfo___depname)
@COND_PLATFORM_WIN32_1@__test_allheaders___win32rc = \
@COND_PLATFORM_WIN32_1@ test_allheaders_sample_rc.o
@COND_GCC_PCH_1@__test_allheaders_PCH_INC = \
@COND_GCC_PCH_1@ -I./.pch/testprec_test_allheaders
@COND_ICC_PCH_1@__test_allheaders_PCH_INC = \
@COND_ICC_PCH_1@ $(ICC_PCH_USE_SWITCH) \
@COND_ICC_PCH_1@ ./.pch/testprec_test_allheaders/testprec.h.gch
@COND_USE_PCH_1@_____pch_testprec_test_allheaders_testprec_h_gch___depname \
@COND_USE_PCH_1@ = ./.pch/testprec_test_allheaders/testprec.h.gch
COND_MONOLITHIC_0___WXLIB_XML_p = \
-lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_XML_p = $(COND_MONOLITHIC_0___WXLIB_XML_p)
COND_MONOLITHIC_0___WXLIB_NET_p = \
-lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_NET_p = $(COND_MONOLITHIC_0___WXLIB_NET_p)
@COND_WXUNIV_1@__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__
@COND_WXUNIV_1@__WXUNIV_DEFINE_p_0 = --define __WXUNIVERSAL__
@COND_DEBUG_FLAG_0@__DEBUG_DEFINE_p = -DwxDEBUG_LEVEL=0
@COND_DEBUG_FLAG_0@__DEBUG_DEFINE_p_0 = --define wxDEBUG_LEVEL=0
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p_0 = --define wxNO_EXCEPTIONS
@COND_USE_RTTI_0@__RTTI_DEFINE_p = -DwxNO_RTTI
@COND_USE_RTTI_0@__RTTI_DEFINE_p_0 = --define wxNO_RTTI
@COND_USE_THREADS_0@__THREAD_DEFINE_p = -DwxNO_THREADS
@COND_USE_THREADS_0@__THREAD_DEFINE_p_0 = --define wxNO_THREADS
@COND_SHARED_1@__DLLFLAG_p = -DWXUSINGDLL
@COND_SHARED_1@__DLLFLAG_p_0 = --define WXUSINGDLL
@COND_PLATFORM_WIN32_1@__WIN32_DPI_MANIFEST_p = \
@COND_PLATFORM_WIN32_1@ --define \
@COND_PLATFORM_WIN32_1@ wxUSE_DPI_AWARE_MANIFEST=$(USE_DPI_AWARE_MANIFEST)
@COND_TOOLKIT_MSW@__RCDEFDIR_p = --include-dir \
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
COND_MONOLITHIC_0_USE_WEBVIEW_1___WXLIB_WEBVIEW_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_webview-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0_USE_WEBVIEW_1@__WXLIB_WEBVIEW_p = $(COND_MONOLITHIC_0_USE_WEBVIEW_1___WXLIB_WEBVIEW_p)
COND_MONOLITHIC_0_USE_STC_1___WXLIB_STC_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_stc-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0_USE_STC_1@__WXLIB_STC_p = $(COND_MONOLITHIC_0_USE_STC_1___WXLIB_STC_p)
COND_MONOLITHIC_0___WXLIB_CORE_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_CORE_p = $(COND_MONOLITHIC_0___WXLIB_CORE_p)
COND_MONOLITHIC_0___WXLIB_NET_p = \
-lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_NET_p = $(COND_MONOLITHIC_0___WXLIB_NET_p)
COND_MONOLITHIC_0___WXLIB_BASE_p = \
-lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_BASE_p = $(COND_MONOLITHIC_0___WXLIB_BASE_p)
@@ -383,7 +442,7 @@ COND_wxUSE_REGEX_builtin___LIB_REGEX_p = \
### Targets: ###
all: test$(EXEEXT) $(__test_drawing___depname) $(__test_drawingplugin___depname) $(__test_gui___depname) $(__test_gui_bundle___depname) data data-images fr ja
all: test$(EXEEXT) $(__test_drawing___depname) $(__test_drawingplugin___depname) $(__test_gui___depname) $(__test_gui_bundle___depname) $(__test_allheaders___depname) $(__test_allheaders_bundle___depname) data data-images fr ja
install:
@@ -399,27 +458,29 @@ clean:
rm -f $(DLLPREFIX_MODULE)test_drawingplugin.$(SO_SUFFIX_MODULE)
rm -f test_gui$(EXEEXT)
rm -rf test_gui.app
rm -f test_allheaders$(EXEEXT)
rm -rf test_allheaders.app
distclean: clean
rm -f config.cache config.log config.status bk-deps bk-make-pch shared-ld-sh Makefile
test$(EXEEXT): $(TEST_OBJECTS)
$(CXX) -o $@ $(TEST_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(__WXLIB_NET_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_PNG_IF_MONO_p) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
$(CXX) -o $@ $(TEST_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_NET_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_PNG_IF_MONO_p) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
@COND_USE_PCH_1@./.pch/testprec_test/testprec.h.gch:
@COND_USE_PCH_1@ $(BK_MAKE_PCH) ./.pch/testprec_test/testprec.h.gch testprec.h $(CXX) $(TEST_CXXFLAGS)
@COND_USE_GUI_1@test_drawing$(EXEEXT): $(TEST_DRAWING_OBJECTS)
@COND_USE_GUI_1@ $(CXX) -o $@ $(TEST_DRAWING_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
@COND_USE_GUI_1@ $(CXX) -o $@ $(TEST_DRAWING_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
@COND_USE_PCH_1@./.pch/testprec_test_drawing/testprec.h.gch:
@COND_USE_PCH_1@ $(BK_MAKE_PCH) ./.pch/testprec_test_drawing/testprec.h.gch testprec.h $(CXX) $(TEST_DRAWING_CXXFLAGS)
@COND_SHARED_1_USE_GUI_1@$(DLLPREFIX_MODULE)test_drawingplugin.$(SO_SUFFIX_MODULE): $(TEST_DRAWINGPLUGIN_OBJECTS)
@COND_SHARED_1_USE_GUI_1@ $(SHARED_LD_MODULE_CXX) $@ $(TEST_DRAWINGPLUGIN_OBJECTS) -L$(LIBDIRNAME) $(LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
@COND_SHARED_1_USE_GUI_1@ $(SHARED_LD_MODULE_CXX) $@ $(TEST_DRAWINGPLUGIN_OBJECTS) -L$(LIBDIRNAME) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
@COND_USE_GUI_1@test_gui$(EXEEXT): $(TEST_GUI_OBJECTS) $(__test_gui___win32rc)
@COND_USE_GUI_1@ $(CXX) -o $@ $(TEST_GUI_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(__WXLIB_WEBVIEW_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(EXTRALIBS_MEDIA) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__WXLIB_HTML_p) $(EXTRALIBS_HTML) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
@COND_USE_GUI_1@ $(CXX) -o $@ $(TEST_GUI_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_WEBVIEW_p) $(__WXLIB_STC_p) $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(EXTRALIBS_MEDIA) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__WXLIB_HTML_p) $(EXTRALIBS_HTML) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
@COND_PLATFORM_MACOSX_1_USE_GUI_1@test_gui.app/Contents/PkgInfo: $(__test_gui___depname) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ mkdir -p test_gui.app/Contents
@@ -446,6 +507,34 @@ test$(EXEEXT): $(TEST_OBJECTS)
@COND_USE_PCH_1@./.pch/testprec_test_gui/testprec.h.gch:
@COND_USE_PCH_1@ $(BK_MAKE_PCH) ./.pch/testprec_test_gui/testprec.h.gch testprec.h $(CXX) $(TEST_GUI_CXXFLAGS)
@COND_USE_GUI_1@test_allheaders$(EXEEXT): $(TEST_ALLHEADERS_OBJECTS) $(__test_allheaders___win32rc)
@COND_USE_GUI_1@ $(CXX) -o $@ $(TEST_ALLHEADERS_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_WEBVIEW_p) $(__WXLIB_STC_p) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
@COND_PLATFORM_MACOSX_1_USE_GUI_1@test_allheaders.app/Contents/PkgInfo: $(__test_allheaders___depname) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ mkdir -p test_allheaders.app/Contents
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ mkdir -p test_allheaders.app/Contents/MacOS
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ mkdir -p test_allheaders.app/Contents/Resources
@COND_PLATFORM_MACOSX_1_USE_GUI_1@
@COND_PLATFORM_MACOSX_1_USE_GUI_1@
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ sed -e "s/IDENTIFIER/`echo $(srcdir) | sed -e 's,\.\./,,g' | sed -e 's,/,.,g'`/" \
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ -e "s/EXECUTABLE/test_allheaders/" \
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ -e "s/VERSION/$(WX_VERSION)/" \
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ $(top_srcdir)/src/osx/carbon/Info.plist.in >test_allheaders.app/Contents/Info.plist
@COND_PLATFORM_MACOSX_1_USE_GUI_1@
@COND_PLATFORM_MACOSX_1_USE_GUI_1@
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ /bin/echo "APPL????" >test_allheaders.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1_USE_GUI_1@
@COND_PLATFORM_MACOSX_1_USE_GUI_1@
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ ln -f test_allheaders$(EXEEXT) test_allheaders.app/Contents/MacOS/test_allheaders
@COND_PLATFORM_MACOSX_1_USE_GUI_1@
@COND_PLATFORM_MACOSX_1_USE_GUI_1@
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ cp -f $(top_srcdir)/src/osx/carbon/wxmac.icns test_allheaders.app/Contents/Resources/wxmac.icns
@COND_PLATFORM_MACOSX_1_USE_GUI_1@test_allheaders_bundle: $(____test_allheaders_BUNDLE_TGT_REF_DEP)
@COND_USE_PCH_1@./.pch/testprec_test_allheaders/testprec.h.gch:
@COND_USE_PCH_1@ $(BK_MAKE_PCH) ./.pch/testprec_test_allheaders/testprec.h.gch testprec.h $(CXX) $(TEST_ALLHEADERS_CXXFLAGS)
data:
@mkdir -p .
@for f in horse.ani horse.bmp horse.cur horse.gif horse.ico horse.jpg horse.pcx horse.png horse.pnm horse.tga horse.tif horse.xpm; do \
@@ -460,7 +549,7 @@ data:
data-images:
@mkdir -p image
@for f in horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp horse_bicubic_50x50.png horse_bicubic_100x100.png horse_bicubic_150x150.png horse_bicubic_300x300.png horse_bilinear_50x50.png horse_bilinear_100x100.png horse_bilinear_150x150.png horse_bilinear_300x300.png horse_box_average_50x50.png horse_box_average_100x100.png horse_box_average_150x150.png horse_box_average_300x300.png cross_bicubic_256x256.png cross_bilinear_256x256.png cross_box_average_256x256.png cross_nearest_neighb_256x256.png; do \
@for f in horse_grey.bmp horse_grey_flipped.bmp horse_rle4.bmp horse_rle4_flipped.bmp horse_rle8.bmp horse_rle8_flipped.bmp horse_bicubic_50x50.png horse_bicubic_100x100.png horse_bicubic_150x150.png horse_bicubic_300x300.png horse_bilinear_50x50.png horse_bilinear_100x100.png horse_bilinear_150x150.png horse_bilinear_300x300.png horse_box_average_50x50.png horse_box_average_100x100.png horse_box_average_150x150.png horse_box_average_300x300.png cross_bicubic_256x256.png cross_bilinear_256x256.png cross_box_average_256x256.png cross_nearest_neighb_256x256.png paste_input_background.png paste_input_black.png paste_input_overlay_transparent_border_opaque_square.png paste_input_overlay_transparent_border_semitransparent_circle.png paste_input_overlay_transparent_border_semitransparent_square.png paste_result_background_plus_circle_plus_square.png paste_result_background_plus_overlay_transparent_border_opaque_square.png paste_result_background_plus_overlay_transparent_border_semitransparent_square.png paste_result_no_background_square_over_circle.png; do \
if test ! -f image/$$f -a ! -d image/$$f ; \
then x=yep ; \
else x=`find $(srcdir)/image/$$f -newer image/$$f -print` ; \
@@ -771,7 +860,7 @@ test_drawingplugin_pluginsample.o: $(srcdir)/drawing/pluginsample.cpp
$(CXXC) -c -o $@ $(TEST_DRAWINGPLUGIN_CXXFLAGS) $(srcdir)/drawing/pluginsample.cpp
test_gui_sample_rc.o: $(srcdir)/../samples/sample.rc $(TEST_GUI_ODEP)
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_6) $(__DEBUG_DEFINE_p_6) $(__EXCEPTIONS_DEFINE_p_6) $(__RTTI_DEFINE_p_6) $(__THREAD_DEFINE_p_6) --include-dir $(srcdir) $(__DLLFLAG_p_6) --include-dir $(srcdir)/../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --include-dir $(top_srcdir)/3rdparty/catch/include
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) --include-dir $(srcdir) $(__DLLFLAG_p_0) $(__WIN32_DPI_MANIFEST_p) --include-dir $(srcdir)/../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --include-dir $(top_srcdir)/3rdparty/catch/include
test_gui_asserthelper.o: $(srcdir)/asserthelper.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/asserthelper.cpp
@@ -815,6 +904,9 @@ test_gui_boundingbox.o: $(srcdir)/graphics/boundingbox.cpp $(TEST_GUI_ODEP)
test_gui_clippingbox.o: $(srcdir)/graphics/clippingbox.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/graphics/clippingbox.cpp
test_gui_coords.o: $(srcdir)/graphics/coords.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/graphics/coords.cpp
test_gui_graphmatrix.o: $(srcdir)/graphics/graphmatrix.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/graphics/graphmatrix.cpp
@@ -824,6 +916,9 @@ test_gui_graphpath.o: $(srcdir)/graphics/graphpath.cpp $(TEST_GUI_ODEP)
test_gui_config.o: $(srcdir)/config/config.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/config/config.cpp
test_gui_auitest.o: $(srcdir)/controls/auitest.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/auitest.cpp
test_gui_bitmapcomboboxtest.o: $(srcdir)/controls/bitmapcomboboxtest.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/bitmapcomboboxtest.cpp
@@ -938,6 +1033,9 @@ test_gui_spinctrldbltest.o: $(srcdir)/controls/spinctrldbltest.cpp $(TEST_GUI_OD
test_gui_spinctrltest.o: $(srcdir)/controls/spinctrltest.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/spinctrltest.cpp
test_gui_styledtextctrltest.o: $(srcdir)/controls/styledtextctrltest.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/styledtextctrltest.cpp
test_gui_textctrltest.o: $(srcdir)/controls/textctrltest.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/textctrltest.cpp
@@ -1034,6 +1132,9 @@ test_gui_tlw.o: $(srcdir)/persistence/tlw.cpp $(TEST_GUI_ODEP)
test_gui_dataview.o: $(srcdir)/persistence/dataview.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/persistence/dataview.cpp
test_gui_rowheightcachetest.o: $(srcdir)/rowheightcache/rowheightcachetest.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/rowheightcache/rowheightcachetest.cpp
test_gui_boxsizer.o: $(srcdir)/sizers/boxsizer.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/sizers/boxsizer.cpp
@@ -1049,6 +1150,9 @@ test_gui_toplevel.o: $(srcdir)/toplevel/toplevel.cpp $(TEST_GUI_ODEP)
test_gui_valnum.o: $(srcdir)/validators/valnum.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/validators/valnum.cpp
test_gui_valtext.o: $(srcdir)/validators/valtext.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/validators/valtext.cpp
test_gui_clientsize.o: $(srcdir)/window/clientsize.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/window/clientsize.cpp
@@ -1058,17 +1162,27 @@ test_gui_setsize.o: $(srcdir)/window/setsize.cpp $(TEST_GUI_ODEP)
test_gui_xrctest.o: $(srcdir)/xml/xrctest.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/xml/xrctest.cpp
test_allheaders_sample_rc.o: $(srcdir)/../samples/sample.rc $(TEST_ALLHEADERS_ODEP)
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) --include-dir $(srcdir) $(__DLLFLAG_p_0) $(__WIN32_DPI_MANIFEST_p) --include-dir $(srcdir)/../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --include-dir $(top_srcdir)/3rdparty/catch/include
# notice the ugly hack with using CXXWARNINGS: we can't use CPPFLAGS as
# currently the value in the makefile would be ignored if we did, but
# warnings don't matter when we expect compilation to fail anyhow so we can
# use this variable to enable the compilation of code which is supposed to
# fail
failtest: failtest_combobox failtest_evthandler failtest_weakref
test_allheaders_asserthelper.o: $(srcdir)/asserthelper.cpp $(TEST_ALLHEADERS_ODEP)
$(CXXC) -c -o $@ $(TEST_ALLHEADERS_CXXFLAGS) $(srcdir)/asserthelper.cpp
test_allheaders_test.o: $(srcdir)/test.cpp $(TEST_ALLHEADERS_ODEP)
$(CXXC) -c -o $@ $(TEST_ALLHEADERS_CXXFLAGS) $(srcdir)/test.cpp
test_allheaders_allheaders.o: $(srcdir)/allheaders.cpp $(TEST_ALLHEADERS_ODEP)
$(CXXC) -c -o $@ $(TEST_ALLHEADERS_CXXFLAGS) $(srcdir)/allheaders.cpp
test_allheaders_testableframe.o: $(srcdir)/testableframe.cpp $(TEST_ALLHEADERS_ODEP)
$(CXXC) -c -o $@ $(TEST_ALLHEADERS_CXXFLAGS) $(srcdir)/testableframe.cpp
failtest: failtest_combobox failtest_evthandler failtest_weakref failtest_allheaders
failtest_combobox:
@$(RM) test_gui_comboboxtest.o
if $(MAKE) CXXWARNINGS=-DTEST_INVALID_COMBOBOX_ISEMPTY test_gui_comboboxtest.o 2>/dev/null; then \
if $(MAKE) CPPFLAGS=-DTEST_INVALID_COMBOBOX_ISEMPTY test_gui_comboboxtest.o 2>/dev/null; then \
echo "*** Compilation with TEST_INVALID_COMBOBOX_ISEMPTY unexpectedly succeeded.">&2; \
exit 1; \
fi; \
@@ -1076,9 +1190,9 @@ failtest_combobox:
failtest_evthandler:
@$(RM) test_evthandler.o
@for d in GLOBAL STATIC METHOD FUNCTOR NO_HANDLER DERIVED WRONG_CLASS; do \
if $(MAKE) CXXWARNINGS=-DTEST_INVALID_BIND_$$d test_evthandler.o 2>/dev/null; then \
echo "*** Compilation with TEST_INVALID_BIND_$$d unexpectedly succeeded.">&2; \
@for d in BIND_GLOBAL BIND_STATIC BIND_METHOD BIND_FUNCTOR BIND_NO_HANDLER BIND_DERIVED BIND_WRONG_CLASS EVENT_CREATION; do \
if $(MAKE) CPPFLAGS=-DTEST_INVALID_$$d test_evthandler.o 2>/dev/null; then \
echo "*** Compilation with TEST_INVALID_$$d unexpectedly succeeded.">&2; \
exit 1; \
fi; \
done; \
@@ -1086,15 +1200,24 @@ failtest_evthandler:
failtest_weakref:
@$(RM) test_weakref.o
if $(MAKE) CXXWARNINGS=-DTEST_INVALID_INCOMPLETE_WEAKREF test_weakref.o 2>/dev/null; then \
if $(MAKE) CPPFLAGS=-DTEST_INVALID_INCOMPLETE_WEAKREF test_weakref.o 2>/dev/null; then \
echo "*** Compilation with TEST_INVALID_INCOMPLETE_WEAKREF unexpectedly succeeded.">&2; \
exit 1; \
fi; \
exit 0
.PHONY: failtest
failtest_allheaders:
@$(RM) test_allheaders.o
if $(MAKE) CPPFLAGS=-DwxNO_IMPLICIT_WXSTRING_ENCODING -DTEST_IMPLICIT_WXSTRING_ENCODING test_allheaders.o 2>/dev/null; then \
echo "*** Compilation with TEST_IMPLICIT_WXSTRING_ENCODING unexpectedly succeeded.">&2; \
exit 1; \
fi; \
exit 0
.PHONY: failtest failtest_combobox failtest_evthandler failtest_weakref failtest_allheaders
# Include dependency info, if present:
@IF_GNU_MAKE@-include ./.deps/*.d
.PHONY: all install uninstall clean distclean test_gui_bundle data data-images fr ja
.PHONY: all install uninstall clean distclean test_gui_bundle \
test_allheaders_bundle data data-images fr ja

451
tests/allheaders.cpp Normal file
View File

@@ -0,0 +1,451 @@
///////////////////////////////////////////////////////////////////////////////
// Name: tests/allheaders.cpp
// Purpose: Compilation test for all headers
// Author: Vadim Zeitlin, Arrigo Marchiori
// Created: 2020-04-20
// Copyright: (c) 2010,2020 Vadim Zeitlin, Wlodzimierz Skiba, Arrigo Marchiori
///////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// Note: can't use wxCHECK_GCC_VERSION() here as it's not defined yet.
#if defined(__GNUC__)
#define CHECK_GCC_VERSION(major, minor) \
(__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
#else
#define CHECK_GCC_VERSION(major, minor) 0
#endif
#if CHECK_GCC_VERSION(4, 6)
// As above, we can't reuse wxCONCAT() and wxSTRINGIZE macros from wx/cpp.h
// here, so define their equivalents here.
#define CONCAT_HELPER(x, y) x ## y
#define CONCAT(x1, x2) CONCAT_HELPER(x1, x2)
#define STRINGIZE_HELPER(x) #x
#define STRINGIZE(x) STRINGIZE_HELPER(x)
#define GCC_TURN_ON(warn) \
_Pragma(STRINGIZE(GCC diagnostic error STRINGIZE(CONCAT(-W,warn))))
#define GCC_TURN_OFF(warn) \
_Pragma(STRINGIZE(GCC diagnostic ignored STRINGIZE(CONCAT(-W,warn))))
#endif
// Due to what looks like a bug in gcc, some warnings enabled after including
// the standard headers still result in warnings being given when instantiating
// some functions defined in these headers later and we need to explicitly
// disable these warnings to avoid them, even if they're not enabled yet.
#ifdef GCC_TURN_OFF
#pragma GCC diagnostic push
GCC_TURN_OFF(aggregate-return)
GCC_TURN_OFF(conversion)
GCC_TURN_OFF(format)
GCC_TURN_OFF(padded)
GCC_TURN_OFF(parentheses)
GCC_TURN_OFF(sign-compare)
GCC_TURN_OFF(sign-conversion)
GCC_TURN_OFF(unused-parameter)
GCC_TURN_OFF(zero-as-null-pointer-constant)
#endif
// We have to include this one first in order to check for HAVE_XXX below.
#include "wx/setup.h"
// Include all standard headers that are used in wx headers before enabling the
// warnings below.
#include <algorithm>
#include <cmath>
#include <exception>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <locale>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#if defined(HAVE_STD_UNORDERED_MAP)
#include <unordered_map>
#endif
#if defined(HAVE_STD_UNORDERED_SET)
#include <unordered_set>
#endif
#if defined(HAVE_DLOPEN)
#include <dlfcn.h>
#endif
#include <fcntl.h>
#include "catch.hpp"
#if defined(__WXMSW__)
#include <windows.h>
// Avoid warnings about redeclaring standard functions such as chmod() in
// various standard headers when using MinGW/Cygwin.
#if defined(__MINGW32__) || defined(__CYGWIN__)
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <io.h>
#endif
#elif defined(__WXQT__)
#include <QtGui/QFont>
#endif
#ifdef GCC_TURN_OFF
#pragma GCC diagnostic pop
#endif
// Enable max warning level for headers if possible, using gcc pragmas.
#ifdef GCC_TURN_ON
// Enable all the usual "maximal" warnings.
GCC_TURN_ON(all)
GCC_TURN_ON(extra)
GCC_TURN_ON(pedantic)
// Enable all the individual warnings not enabled by one of the warnings
// above.
// Start of semi-auto-generated part, don't modify it manually.
//
// Manual changes:
// - Globally replace HANDLE_GCC_WARNING with GCC_TURN_ON.
// - Add v6 check for -Wabi, gcc < 6 don't seem to support turning it off
// once it's turned on and gives it for the standard library symbols.
// {{{
#if CHECK_GCC_VERSION(6,1)
GCC_TURN_ON(abi)
#endif // 6.1
#if CHECK_GCC_VERSION(4,8)
GCC_TURN_ON(abi-tag)
#endif // 4.8
GCC_TURN_ON(address)
GCC_TURN_ON(aggregate-return)
#if CHECK_GCC_VERSION(7,1)
GCC_TURN_ON(alloc-zero)
#endif // 7.1
#if CHECK_GCC_VERSION(7,1)
GCC_TURN_ON(alloca)
#endif // 7.1
#if CHECK_GCC_VERSION(10,1)
GCC_TURN_ON(arith-conversion)
#endif // 10.1
GCC_TURN_ON(array-bounds)
GCC_TURN_ON(builtin-macro-redefined)
GCC_TURN_ON(cast-align)
#if CHECK_GCC_VERSION(8,1)
GCC_TURN_ON(cast-align=strict)
#endif // 8.1
GCC_TURN_ON(cast-qual)
GCC_TURN_ON(char-subscripts)
#if CHECK_GCC_VERSION(9,1)
GCC_TURN_ON(chkp)
#endif // 9.1
#if CHECK_GCC_VERSION(8,1)
GCC_TURN_ON(class-memaccess)
#endif // 8.1
GCC_TURN_ON(clobbered)
#if CHECK_GCC_VERSION(10,1)
GCC_TURN_ON(comma-subscript)
#endif // 10.1
GCC_TURN_ON(comment)
#if CHECK_GCC_VERSION(4,9)
GCC_TURN_ON(conditionally-supported)
#endif // 4.9
GCC_TURN_ON(conversion)
GCC_TURN_ON(ctor-dtor-privacy)
#if CHECK_GCC_VERSION(4,9)
GCC_TURN_ON(date-time)
#endif // 4.9
#if CHECK_GCC_VERSION(4,7)
GCC_TURN_ON(delete-non-virtual-dtor)
#endif // 4.7
#if CHECK_GCC_VERSION(9,1)
GCC_TURN_ON(deprecated-copy)
#endif // 9.1
#if CHECK_GCC_VERSION(9,1)
GCC_TURN_ON(deprecated-copy-dtor)
#endif // 9.1
GCC_TURN_ON(disabled-optimization)
GCC_TURN_ON(double-promotion)
#if CHECK_GCC_VERSION(7,1)
GCC_TURN_ON(duplicated-branches)
#endif // 7.1
#if CHECK_GCC_VERSION(6,1)
GCC_TURN_ON(duplicated-cond)
#endif // 6.1
GCC_TURN_ON(empty-body)
GCC_TURN_ON(endif-labels)
GCC_TURN_ON(enum-compare)
#if CHECK_GCC_VERSION(8,1)
GCC_TURN_ON(extra-semi)
#endif // 8.1
GCC_TURN_ON(float-equal)
GCC_TURN_ON(format)
GCC_TURN_ON(format-contains-nul)
GCC_TURN_ON(format-extra-args)
GCC_TURN_ON(format-nonliteral)
GCC_TURN_ON(format-security)
#if CHECK_GCC_VERSION(5,1)
GCC_TURN_ON(format-signedness)
#endif // 5.1
#if CHECK_GCC_VERSION(4,7)
GCC_TURN_ON(format-zero-length)
#endif // 4.7
GCC_TURN_ON(ignored-qualifiers)
GCC_TURN_ON(init-self)
GCC_TURN_ON(inline)
GCC_TURN_ON(invalid-pch)
#if CHECK_GCC_VERSION(4,8)
GCC_TURN_ON(literal-suffix)
#endif // 4.8
#if CHECK_GCC_VERSION(6,1)
GCC_TURN_ON(logical-op)
#endif // 6.1
GCC_TURN_ON(long-long)
GCC_TURN_ON(main)
#if CHECK_GCC_VERSION(4,7)
GCC_TURN_ON(maybe-uninitialized)
#endif // 4.7
#if CHECK_GCC_VERSION(10,1)
GCC_TURN_ON(mismatched-tags)
#endif // 10.1
GCC_TURN_ON(missing-braces)
GCC_TURN_ON(missing-declarations)
GCC_TURN_ON(missing-field-initializers)
GCC_TURN_ON(missing-format-attribute)
GCC_TURN_ON(missing-include-dirs)
GCC_TURN_ON(missing-noreturn)
GCC_TURN_ON(multichar)
#if CHECK_GCC_VERSION(6,1)
GCC_TURN_ON(namespaces)
#endif // 6.1
#if CHECK_GCC_VERSION(4,7)
GCC_TURN_ON(narrowing)
#endif // 4.7
GCC_TURN_ON(noexcept)
#if CHECK_GCC_VERSION(7,1)
GCC_TURN_ON(noexcept-type)
#endif // 7.1
GCC_TURN_ON(non-virtual-dtor)
#if CHECK_GCC_VERSION(4,7)
GCC_TURN_ON(nonnull)
#endif // 4.7
#if CHECK_GCC_VERSION(6,1)
GCC_TURN_ON(null-dereference)
#endif // 6.1
GCC_TURN_ON(old-style-cast)
GCC_TURN_ON(overlength-strings)
GCC_TURN_ON(overloaded-virtual)
GCC_TURN_ON(packed)
GCC_TURN_ON(packed-bitfield-compat)
GCC_TURN_ON(padded)
GCC_TURN_ON(parentheses)
#if CHECK_GCC_VERSION(9,1)
GCC_TURN_ON(pessimizing-move)
#endif // 9.1
GCC_TURN_ON(pointer-arith)
GCC_TURN_ON(redundant-decls)
#if CHECK_GCC_VERSION(10,1)
GCC_TURN_ON(redundant-tags)
#endif // 10.1
#if CHECK_GCC_VERSION(7,1)
GCC_TURN_ON(register)
#endif // 7.1
GCC_TURN_ON(reorder)
#if CHECK_GCC_VERSION(7,1)
GCC_TURN_ON(restrict)
#endif // 7.1
GCC_TURN_ON(return-type)
GCC_TURN_ON(sequence-point)
GCC_TURN_ON(shadow)
#if CHECK_GCC_VERSION(6,1)
GCC_TURN_ON(shift-negative-value)
#endif // 6.1
GCC_TURN_ON(sign-compare)
GCC_TURN_ON(sign-conversion)
GCC_TURN_ON(sign-promo)
GCC_TURN_ON(stack-protector)
GCC_TURN_ON(strict-aliasing)
GCC_TURN_ON(strict-null-sentinel)
GCC_TURN_ON(strict-overflow)
#if CHECK_GCC_VERSION(10,1)
GCC_TURN_ON(string-compare)
#endif // 10.1
#if CHECK_GCC_VERSION(8,1)
GCC_TURN_ON(stringop-truncation)
#endif // 8.1
#if CHECK_GCC_VERSION(8,1)
GCC_TURN_ON(suggest-attribute=cold)
#endif // 8.1
GCC_TURN_ON(suggest-attribute=const)
#if CHECK_GCC_VERSION(4,8)
GCC_TURN_ON(suggest-attribute=format)
#endif // 4.8
#if CHECK_GCC_VERSION(8,1)
GCC_TURN_ON(suggest-attribute=malloc)
#endif // 8.1
GCC_TURN_ON(suggest-attribute=noreturn)
GCC_TURN_ON(suggest-attribute=pure)
#if CHECK_GCC_VERSION(5,1)
GCC_TURN_ON(suggest-final-methods)
#endif // 5.1
#if CHECK_GCC_VERSION(5,1)
GCC_TURN_ON(suggest-final-types)
#endif // 5.1
#if CHECK_GCC_VERSION(5,1)
GCC_TURN_ON(suggest-override)
#endif // 5.1
GCC_TURN_ON(switch)
GCC_TURN_ON(switch-default)
GCC_TURN_ON(switch-enum)
GCC_TURN_ON(synth)
GCC_TURN_ON(system-headers)
#if CHECK_GCC_VERSION(6,1)
GCC_TURN_ON(templates)
#endif // 6.1
GCC_TURN_ON(trampolines)
GCC_TURN_ON(trigraphs)
GCC_TURN_ON(type-limits)
GCC_TURN_ON(undef)
GCC_TURN_ON(uninitialized)
GCC_TURN_ON(unknown-pragmas)
GCC_TURN_ON(unreachable-code)
GCC_TURN_ON(unsafe-loop-optimizations)
GCC_TURN_ON(unused)
GCC_TURN_ON(unused-but-set-parameter)
GCC_TURN_ON(unused-but-set-variable)
GCC_TURN_ON(unused-function)
GCC_TURN_ON(unused-label)
#if CHECK_GCC_VERSION(4,7)
GCC_TURN_ON(unused-local-typedefs)
#endif // 4.7
GCC_TURN_ON(unused-macros)
GCC_TURN_ON(unused-parameter)
GCC_TURN_ON(unused-value)
GCC_TURN_ON(unused-variable)
#if CHECK_GCC_VERSION(4,8)
GCC_TURN_ON(useless-cast)
#endif // 4.8
GCC_TURN_ON(variadic-macros)
#if CHECK_GCC_VERSION(4,7)
GCC_TURN_ON(vector-operation-performance)
#endif // 4.7
#if CHECK_GCC_VERSION(6,1)
GCC_TURN_ON(virtual-inheritance)
#endif // 6.1
GCC_TURN_ON(vla)
#if CHECK_GCC_VERSION(10,1)
GCC_TURN_ON(volatile)
#endif // 10.1
GCC_TURN_ON(volatile-register-var)
GCC_TURN_ON(write-strings)
#if CHECK_GCC_VERSION(4,7)
GCC_TURN_ON(zero-as-null-pointer-constant)
#endif // 4.7
// }}}
#undef GCC_TURN_ON
/*
Some warnings still must be disabled, so turn them back off explicitly:
*/
// Those are potentially useful warnings, but there are just too many
// occurrences of them in our code currently.
GCC_TURN_OFF(conversion)
GCC_TURN_OFF(sign-compare)
GCC_TURN_OFF(sign-conversion)
GCC_TURN_OFF(old-style-cast)
#if CHECK_GCC_VERSION(4,8)
GCC_TURN_OFF(useless-cast)
#endif // 4.8
#if CHECK_GCC_VERSION(10,1)
GCC_TURN_OFF(redundant-tags) // "struct tm" triggers this
#endif // 10.1
// This one is given for NULL, and not just literal 0, up to gcc 10, and so
// has to remain disabled for as long as we use any NULLs in our code.
#if CHECK_GCC_VERSION(4,7) && !CHECK_GCC_VERSION(10,1)
GCC_TURN_OFF(zero-as-null-pointer-constant)
#endif
// These ones could be useful to explore, but for now we don't use "final"
// at all anywhere.
#if CHECK_GCC_VERSION(5,1)
GCC_TURN_OFF(suggest-final-methods)
GCC_TURN_OFF(suggest-final-types)
#endif // 5.1
// wxWARNING_SUPPRESS_MISSING_OVERRIDE() inside wxRTTI macros is just
// ignored by gcc up to 9.x for some reason, so we have no choice but to
// disable it.
#if CHECK_GCC_VERSION(5,1) && !CHECK_GCC_VERSION(9,0)
GCC_TURN_OFF(suggest-override)
#endif
// The rest are the warnings that we don't ever want to enable.
// This one is given whenever inheriting from std:: classes without using
// C++11 ABI tag explicitly, probably harmless.
#if CHECK_GCC_VERSION(4,8)
GCC_TURN_OFF(abi-tag)
#endif // 4.8
// This can be used to ask the compiler to explain why some function is not
// inlined, but it's perfectly normal for some functions not to be inlined.
GCC_TURN_OFF(inline)
// All those are about using perfectly normal C++ features that are
// actually used in our code.
GCC_TURN_OFF(aggregate-return)
GCC_TURN_OFF(long-long)
#if CHECK_GCC_VERSION(6,1)
GCC_TURN_OFF(namespaces)
GCC_TURN_OFF(multiple-inheritance)
GCC_TURN_OFF(templates)
#endif // 6.1
// This warns about missing "default" label in exhaustive switches over
// enums, so it's completely useless.
GCC_TURN_OFF(switch-default)
// We don't care about padding being added to our structs.
GCC_TURN_OFF(padded)
#endif // gcc >= 4.6
// ANSI build hasn't been updated to work without implicit wxString encoding
// and never will be, as it will be removed soon anyhow. And in UTF-8-only
// build we actually want to use implicit encoding (UTF-8).
#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
#define wxNO_IMPLICIT_WXSTRING_ENCODING
#endif
#include "testprec.h"
#include "allheaders.h"
#ifdef GCC_TURN_OFF
// Just using REQUIRE() below triggers -Wparentheses, so avoid it.
GCC_TURN_OFF(parentheses)
#endif
TEST_CASE("wxNO_IMPLICIT_WXSTRING_ENCODING", "[string]")
{
wxString s = wxASCII_STR("Hello, ASCII");
REQUIRE(s == L"Hello, ASCII");
#ifdef TEST_IMPLICIT_WXSTRING_ENCODING
// Compilation of this should fail, because the macro
// wxNO_IMPLICIT_WXSTRING_ENCODING must be set
s = "Hello, implicit encoding";
#endif
}

423
tests/allheaders.h Normal file
View File

@@ -0,0 +1,423 @@
/*
This file should list all the header files in the include/wx directory
that can be directly included from the user code.
Excluded headers:
#include <wx/catch_cppunit.h>
#include <wx/dvrenderers.h>
#include <wx/fmappriv.h>
#include <wx/setup_inc.h>
#include <wx/setup_redirect.h>
#include <wx/variantbase.h>
#include <wx/vms_x_fix.h>
#include <wx/xpmhand.h>
*/
#include <wx/beforestd.h>
#include <wx/afterstd.h>
#include <wx/aboutdlg.h>
#include <wx/accel.h>
#include <wx/access.h>
#include <wx/activityindicator.h>
#include <wx/addremovectrl.h>
#include <wx/affinematrix2dbase.h>
#include <wx/affinematrix2d.h>
#include <wx/anidecod.h>
#include <wx/animate.h>
#include <wx/animdecod.h>
#include <wx/anybutton.h>
#include <wx/any.h>
#include <wx/anystr.h>
#include <wx/app.h>
#include <wx/appprogress.h>
#include <wx/apptrait.h>
#include <wx/archive.h>
#include <wx/arrstr.h>
#include <wx/artprov.h>
#include <wx/atomic.h>
#include <wx/bannerwindow.h>
#include <wx/base64.h>
#include <wx/bitmap.h>
#include <wx/bmpbuttn.h>
#include <wx/bmpcbox.h>
#include <wx/bookctrl.h>
#include <wx/brush.h>
#include <wx/buffer.h>
#include <wx/build.h>
#include <wx/busyinfo.h>
#include <wx/button.h>
#include <wx/calctrl.h>
#include <wx/caret.h>
#include <wx/chartype.h>
#include <wx/checkbox.h>
#include <wx/checkeddelete.h>
#include <wx/checklst.h>
#include <wx/chkconf.h>
#include <wx/choicdlg.h>
#include <wx/choicebk.h>
#include <wx/choice.h>
#include <wx/clipbrd.h>
#include <wx/clntdata.h>
#include <wx/clrpicker.h>
#include <wx/cmdargs.h>
#include <wx/cmdline.h>
#include <wx/cmdproc.h>
#include <wx/cmndata.h>
#include <wx/collheaderctrl.h>
#include <wx/collpane.h>
#include <wx/colordlg.h>
#include <wx/colourdata.h>
#include <wx/colour.h>
#include <wx/combobox.h>
#include <wx/combo.h>
#include <wx/commandlinkbutton.h>
#include <wx/compiler.h>
#include <wx/compositewin.h>
#include <wx/confbase.h>
#include <wx/config.h>
#include <wx/containr.h>
#include <wx/control.h>
#include <wx/convauto.h>
#include <wx/cpp.h>
#include <wx/crt.h>
#include <wx/cshelp.h>
#include <wx/ctrlsub.h>
#include <wx/cursor.h>
#include <wx/custombgwin.h>
#include <wx/dataobj.h>
#include <wx/dataview.h>
#include <wx/datectrl.h>
#include <wx/dateevt.h>
#include <wx/datetimectrl.h>
#include <wx/datetime.h>
#include <wx/datstrm.h>
#include <wx/dcbuffer.h>
#include <wx/dcclient.h>
#include <wx/dcgraph.h>
#include <wx/dc.h>
#include <wx/dcmemory.h>
#include <wx/dcmirror.h>
#include <wx/dcprint.h>
#include <wx/dcps.h>
#include <wx/dcscreen.h>
#include <wx/dcsvg.h>
#include <wx/debug.h>
#include <wx/debugrpt.h>
#include <wx/defs.h>
#include <wx/dialog.h>
#include <wx/dialup.h>
#include <wx/dirctrl.h>
#include <wx/dirdlg.h>
#include <wx/dir.h>
#include <wx/display.h>
#include <wx/dlimpexp.h>
#include <wx/dlist.h>
#include <wx/dnd.h>
#include <wx/docmdi.h>
#include <wx/docview.h>
#include <wx/dragimag.h>
#include <wx/dynarray.h>
#include <wx/dynlib.h>
#include <wx/dynload.h>
#include <wx/editlbox.h>
#include <wx/effects.h>
#include <wx/encconv.h>
#include <wx/encinfo.h>
#include <wx/eventfilter.h>
#include <wx/event.h>
#include <wx/evtloop.h>
#include <wx/evtloopsrc.h>
#include <wx/except.h>
#include <wx/fdrepdlg.h>
#include <wx/features.h>
#include <wx/ffile.h>
#include <wx/fileconf.h>
#include <wx/filectrl.h>
#include <wx/filedlg.h>
#include <wx/filefn.h>
#include <wx/file.h>
#include <wx/filehistory.h>
#include <wx/filename.h>
#include <wx/filepicker.h>
#include <wx/filesys.h>
#include <wx/flags.h>
#include <wx/fontdata.h>
#include <wx/fontdlg.h>
#include <wx/fontenc.h>
#include <wx/fontenum.h>
#include <wx/font.h>
#include <wx/fontmap.h>
#include <wx/fontpicker.h>
#include <wx/fontutil.h>
#include <wx/frame.h>
#include <wx/fs_arc.h>
#include <wx/fs_filter.h>
#include <wx/fs_inet.h>
#include <wx/fs_mem.h>
#include <wx/fswatcher.h>
#include <wx/fs_zip.h>
#include <wx/gauge.h>
#include <wx/gbsizer.h>
#include <wx/gdicmn.h>
#include <wx/gdiobj.h>
#include <wx/geometry.h>
#include <wx/gifdecod.h>
#include <wx/glcanvas.h>
#include <wx/graphics.h>
#include <wx/grid.h>
#include <wx/hash.h>
#include <wx/hashmap.h>
#include <wx/hashset.h>
#include <wx/headercol.h>
#include <wx/headerctrl.h>
#include <wx/helpbase.h>
#include <wx/help.h>
#include <wx/helphtml.h>
#include <wx/helpwin.h>
#include <wx/htmllbox.h>
#include <wx/hyperlink.h>
#include <wx/iconbndl.h>
#include <wx/icon.h>
#include <wx/iconloc.h>
#include <wx/imagbmp.h>
#include <wx/image.h>
#include <wx/imaggif.h>
#include <wx/imagiff.h>
#include <wx/imagjpeg.h>
#include <wx/imaglist.h>
#include <wx/imagpcx.h>
#include <wx/imagpng.h>
#include <wx/imagpnm.h>
#include <wx/imagtga.h>
#include <wx/imagtiff.h>
#include <wx/imagxpm.h>
#include <wx/infobar.h>
#include <wx/init.h>
#include <wx/intl.h>
#include <wx/iosfwrap.h>
#include <wx/ioswrap.h>
#include <wx/ipcbase.h>
#include <wx/ipc.h>
#include <wx/itemattr.h>
#include <wx/itemid.h>
#include <wx/joystick.h>
#include <wx/kbdstate.h>
#include <wx/language.h>
#include <wx/layout.h>
#include <wx/laywin.h>
#include <wx/link.h>
#include <wx/listbase.h>
#include <wx/listbook.h>
#include <wx/listbox.h>
#include <wx/listctrl.h>
#include <wx/list.h>
#include <wx/log.h>
#include <wx/longlong.h>
#include <wx/lzmastream.h>
#include <wx/math.h>
/* Intentionally excluded to avoid deprecation warnings.
#include <wx/matrix.h>
*/
#include <wx/mdi.h>
#include <wx/mediactrl.h>
#include <wx/memconf.h>
#include <wx/memory.h>
#include <wx/memtext.h>
#include <wx/menu.h>
#include <wx/menuitem.h>
#include <wx/metafile.h>
#include <wx/mimetype.h>
#include <wx/minifram.h>
#include <wx/modalhook.h>
#include <wx/module.h>
#include <wx/mousemanager.h>
#include <wx/mousestate.h>
#include <wx/msgdlg.h>
#include <wx/msgout.h>
#include <wx/msgqueue.h>
#include <wx/mstream.h>
#include <wx/nativewin.h>
#include <wx/nonownedwnd.h>
#include <wx/notebook.h>
#include <wx/notifmsg.h>
#include <wx/numdlg.h>
#include <wx/numformatter.h>
#include <wx/object.h>
#include <wx/odcombo.h>
#include <wx/overlay.h>
#include <wx/ownerdrw.h>
#include <wx/palette.h>
#include <wx/panel.h>
#include <wx/paper.h>
#include <wx/pen.h>
#include <wx/peninfobase.h>
#include <wx/persist.h>
#include <wx/persist/bookctrl.h>
#include <wx/persist/combobox.h>
#include <wx/persist/dataview.h>
#include <wx/persist/splitter.h>
#include <wx/persist/toplevel.h>
#include <wx/persist/treebook.h>
#include <wx/persist/window.h>
#include <wx/pickerbase.h>
#include <wx/platform.h>
#include <wx/platinfo.h>
#include <wx/popupwin.h>
#include <wx/position.h>
#include <wx/power.h>
#include <wx/preferences.h>
#include <wx/printdlg.h>
#include <wx/print.h>
#include <wx/prntbase.h>
#include <wx/process.h>
#include <wx/progdlg.h>
#include <wx/propdlg.h>
#include <wx/ptr_scpd.h>
#include <wx/ptr_shrd.h>
#include <wx/quantize.h>
#include <wx/radiobox.h>
#include <wx/radiobut.h>
#include <wx/range.h>
#include <wx/rawbmp.h>
#include <wx/rearrangectrl.h>
#include <wx/recguard.h>
#include <wx/regex.h>
#include <wx/region.h>
#include <wx/renderer.h>
#include <wx/richmsgdlg.h>
#include <wx/richtooltip.h>
#include <wx/rtti.h>
#include <wx/sashwin.h>
#include <wx/sckaddr.h>
#include <wx/sckipc.h>
#include <wx/sckstrm.h>
#include <wx/scopedarray.h>
#include <wx/scopedptr.h>
#include <wx/scopeguard.h>
#include <wx/scrolbar.h>
#include <wx/scrolwin.h>
#include <wx/secretstore.h>
#include <wx/selstore.h>
#include <wx/settings.h>
#include <wx/sharedptr.h>
#include <wx/simplebook.h>
#include <wx/sizer.h>
#include <wx/slider.h>
#include <wx/snglinst.h>
#include <wx/socket.h>
#include <wx/sound.h>
#include <wx/spinbutt.h>
#include <wx/spinctrl.h>
#include <wx/splash.h>
#include <wx/splitter.h>
#include <wx/srchctrl.h>
#include <wx/sstream.h>
#include <wx/stack.h>
#include <wx/stackwalk.h>
#include <wx/statbmp.h>
#include <wx/statbox.h>
#include <wx/statline.h>
#include <wx/stattext.h>
#include <wx/statusbr.h>
#include <wx/stdpaths.h>
#include <wx/stdstream.h>
#include <wx/stockitem.h>
#include <wx/stopwatch.h>
#include <wx/strconv.h>
#include <wx/stream.h>
#include <wx/string.h>
#include <wx/stringimpl.h>
#include <wx/stringops.h>
#include <wx/strvararg.h>
#include <wx/sysopt.h>
#include <wx/systhemectrl.h>
#include <wx/tarstrm.h>
#include <wx/taskbarbutton.h>
#include <wx/taskbar.h>
#include <wx/tbarbase.h>
#include <wx/testing.h>
#include <wx/textbuf.h>
#include <wx/textcompleter.h>
#include <wx/textctrl.h>
#include <wx/textdlg.h>
#include <wx/textentry.h>
#include <wx/textfile.h>
#include <wx/textwrapper.h>
#include <wx/tglbtn.h>
#include <wx/thread.h>
#include <wx/timectrl.h>
#include <wx/time.h>
#include <wx/timer.h>
#include <wx/tipdlg.h>
#include <wx/tipwin.h>
#include <wx/tls.h>
#include <wx/tokenzr.h>
#include <wx/toolbar.h>
#include <wx/toolbook.h>
#include <wx/tooltip.h>
#include <wx/toplevel.h>
#include <wx/tracker.h>
#include <wx/translation.h>
#include <wx/treebase.h>
#include <wx/treebook.h>
#include <wx/treectrl.h>
#include <wx/treelist.h>
#include <wx/txtstrm.h>
#include <wx/typeinfo.h>
#include <wx/types.h>
#include <wx/uiaction.h>
#include <wx/unichar.h>
#include <wx/uri.h>
#include <wx/url.h>
#include <wx/ustring.h>
#include <wx/utils.h>
#include <wx/valgen.h>
#include <wx/validate.h>
#include <wx/valnum.h>
#include <wx/valtext.h>
#include <wx/variant.h>
#include <wx/vector.h>
#include <wx/version.h>
#include <wx/versioninfo.h>
#include <wx/vidmode.h>
#include <wx/vlbox.h>
#include <wx/volume.h>
#include <wx/vscroll.h>
#include <wx/weakref.h>
#include <wx/webviewarchivehandler.h>
#include <wx/webviewfshandler.h>
#include <wx/webview.h>
#include <wx/wfstream.h>
#include <wx/window.h>
#include <wx/windowid.h>
#include <wx/windowptr.h>
#include <wx/withimages.h>
#include <wx/wizard.h>
#include <wx/wrapsizer.h>
#include <wx/wupdlock.h>
#include <wx/wxchar.h>
#include <wx/wxcrtbase.h>
#include <wx/wxcrt.h>
#include <wx/wxcrtvararg.h>
#include <wx/wx.h>
#include <wx/wxhtml.h>
#include <wx/wxprec.h>
#include <wx/xlocale.h>
#include <wx/xpmdecod.h>
#include <wx/xrc/xmlres.h>
#include <wx/xti2.h>
#include <wx/xtictor.h>
#include <wx/xti.h>
#include <wx/xtihandler.h>
#include <wx/xtiprop.h>
#include <wx/xtistrm.h>
#include <wx/xtitypes.h>
#include <wx/xtixml.h>
#include <wx/zipstrm.h>
#include <wx/zstream.h>
#if defined(__WINDOWS__)
#include <wx/dde.h>
#endif

View File

@@ -8,10 +8,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
# pragma hdrstop
#endif
#if wxUSE_ANY
#include "wx/any.h"
@@ -656,6 +652,8 @@ void wxAnyTestCase::wxVariantConversions()
CPPUNIT_ASSERT(variant.GetCount() == 2);
CPPUNIT_ASSERT(variant[0].GetLong() == 15);
CPPUNIT_ASSERT(variant[1].GetString() == "abc");
// Avoid the memory leak.
WX_CLEAR_LIST(wxAnyList, anyList);
any = wxAny(vCustomType);
CPPUNIT_ASSERT(wxANY_CHECK_TYPE(any, wxVariantData*));

View File

@@ -8,10 +8,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
# pragma hdrstop
#endif
#ifndef WX_PRECOMP
# include "wx/wx.h"
#endif
@@ -30,16 +26,12 @@ using std::string;
// Check whether member templates can be used
//
#if defined __GNUC__ && \
(__GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
#if defined __GNUC__
# define WXARC_MEMBER_TEMPLATES
#endif
#if defined _MSC_VER && _MSC_VER >= 1310 && !defined __WIN64__
# define WXARC_MEMBER_TEMPLATES
#endif
#if defined __BORLANDC__ && __BORLANDC__ >= 0x530
# define WXARC_MEMBER_TEMPLATES
#endif
#if defined __HP_aCC && __HP_aCC > 33300
# define WXARC_MEMBER_TEMPLATES
#endif
@@ -386,7 +378,7 @@ void TempDir::RemoveDir(wxString& path)
#if defined __UNIX__ || defined __MINGW32__
# define WXARC_popen popen
# define WXARC_pclose pclose
#elif defined _MSC_VER || defined __BORLANDC__
#elif defined _MSC_VER
# define WXARC_popen _popen
# define WXARC_pclose _pclose
#else
@@ -462,7 +454,13 @@ void ArchiveTestCase<ClassFactoryT>::runTest()
if (m_archiver.empty())
CreateArchive(out);
else
{
#ifndef __WXOSX_IPHONE__
CreateArchive(out, m_archiver);
#else
CPPUNIT_FAIL("using external archivers is not supported on iOS");
#endif
}
// check archive could be created
CPPUNIT_ASSERT(out.GetLength() > 0);
@@ -489,7 +487,13 @@ void ArchiveTestCase<ClassFactoryT>::runTest()
if (m_unarchiver.empty())
ExtractArchive(in);
else
{
#ifndef __WXOSX_IPHONE__
ExtractArchive(in, m_unarchiver);
#else
CPPUNIT_FAIL("using external archivers is not supported on iOS");
#endif
}
// check that all the test entries were found in the archive
CPPUNIT_ASSERT(m_testEntries.empty());
@@ -620,6 +624,7 @@ void ArchiveTestCase<ClassFactoryT>::CreateArchive(wxOutputStream& out)
// Create an archive using an external archive program
//
#ifndef __WXOSX_IPHONE__
template <class ClassFactoryT>
void ArchiveTestCase<ClassFactoryT>::CreateArchive(wxOutputStream& out,
const wxString& archiver)
@@ -683,6 +688,7 @@ void ArchiveTestCase<ClassFactoryT>::CreateArchive(wxOutputStream& out,
out.Write(in);
}
}
#endif
// Do a standard set of modification on an archive, delete an entry,
// rename an entry and add an entry
@@ -864,6 +870,7 @@ void ArchiveTestCase<ClassFactoryT>::ExtractArchive(wxInputStream& in)
// Extract an archive using an external unarchive program
//
#ifndef __WXOSX_IPHONE__
template <class ClassFactoryT>
void ArchiveTestCase<ClassFactoryT>::ExtractArchive(wxInputStream& in,
const wxString& unarchiver)
@@ -905,6 +912,7 @@ void ArchiveTestCase<ClassFactoryT>::ExtractArchive(wxInputStream& in,
wxString dir = tmpdir.GetName();
VerifyDir(dir);
}
#endif
// Verifies the files produced by an external unarchiver are as expected
//

View File

@@ -180,14 +180,18 @@ protected:
// 'archive up' the test data
void CreateArchive(wxOutputStream& out);
#ifndef __WXOSX_IPHONE__
void CreateArchive(wxOutputStream& out, const wxString& archiver);
#endif
// perform various modifications on the archive
void ModifyArchive(wxInputStream& in, wxOutputStream& out);
// extract the archive and verify its contents
void ExtractArchive(wxInputStream& in);
#ifndef __WXOSX_IPHONE__
void ExtractArchive(wxInputStream& in, const wxString& unarchiver);
#endif
void VerifyDir(wxString& path, size_t rootlen = 0);
// tests for the iterators

View File

@@ -8,10 +8,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
# pragma hdrstop
#endif
#ifndef WX_PRECOMP
# include "wx/wx.h"
#endif

View File

@@ -8,10 +8,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
# pragma hdrstop
#endif
#ifndef WX_PRECOMP
# include "wx/wx.h"
#endif

View File

@@ -12,9 +12,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
@@ -364,12 +361,18 @@ void ArraysTestCase::wxStringArrayTest()
a6.Add("Foo");
a6.Insert(a6[0], 1, 100);
// The whole point of this code is to test self-assignment, so suppress
// clang warning about it.
wxCLANG_WARNING_SUPPRESS(self-assign-overloaded)
wxArrayString a7;
a7 = a7;
CPPUNIT_ASSERT_EQUAL( 0, a7.size() );
a7.Add("Bar");
a7 = a7;
CPPUNIT_ASSERT_EQUAL( 1, a7.size() );
wxCLANG_WARNING_RESTORE(self-assign-overloaded)
}
void ArraysTestCase::SortedArray()
@@ -774,3 +777,80 @@ void ArraysTestCase::IndexFromEnd()
CPPUNIT_ASSERT_EQUAL( 1, a.Index(1, /*bFromEnd=*/true) );
CPPUNIT_ASSERT_EQUAL( 2, a.Index(42, /*bFromEnd=*/true) );
}
TEST_CASE("wxNaturalStringComparisonGeneric()", "[wxString][compare]")
{
// simple string comparison
CHECK(wxCmpNaturalGeneric("a", "a") == 0);
CHECK(wxCmpNaturalGeneric("a", "z") < 0);
CHECK(wxCmpNaturalGeneric("z", "a") > 0);
// case insensitivity
CHECK(wxCmpNaturalGeneric("a", "A") == 0);
CHECK(wxCmpNaturalGeneric("A", "a") == 0);
CHECK(wxCmpNaturalGeneric("AB", "a") > 0);
CHECK(wxCmpNaturalGeneric("a", "AB") < 0);
// empty strings sort before whitespace and punctiation
CHECK(wxCmpNaturalGeneric("", " ") < 0);
CHECK(wxCmpNaturalGeneric(" ", "") > 0);
CHECK(wxCmpNaturalGeneric("", ",") < 0);
CHECK(wxCmpNaturalGeneric(",", "") > 0);
// empty strings sort before numbers
CHECK(wxCmpNaturalGeneric("", "0") < 0);
CHECK(wxCmpNaturalGeneric("0", "") > 0);
// empty strings sort before letters and symbols
CHECK(wxCmpNaturalGeneric("", "abc") < 0);
CHECK(wxCmpNaturalGeneric("abc", "") > 0);
// whitespace and punctiation sort before numbers
CHECK(wxCmpNaturalGeneric(" ", "1") < 0);
CHECK(wxCmpNaturalGeneric("1", " ") > 0);
CHECK(wxCmpNaturalGeneric(",", "1") < 0);
CHECK(wxCmpNaturalGeneric("1", ",") > 0);
// strings containing numbers sort before letters and symbols
CHECK(wxCmpNaturalGeneric("00", "a") < 0);
CHECK(wxCmpNaturalGeneric("a", "00") > 0);
// strings containing numbers are compared by their value
CHECK(wxCmpNaturalGeneric("01", "1") == 0);
CHECK(wxCmpNaturalGeneric("1", "01") == 0);
CHECK(wxCmpNaturalGeneric("1", "05") < 0);
CHECK(wxCmpNaturalGeneric("05", "1") > 0);
CHECK(wxCmpNaturalGeneric("10", "5") > 0);
CHECK(wxCmpNaturalGeneric("5", "10") < 0);
CHECK(wxCmpNaturalGeneric("1", "9999999999999999999") < 0);
CHECK(wxCmpNaturalGeneric("9999999999999999999", "1") > 0);
// comparing strings composed from whitespace,
// punctuation, numbers, letters, and symbols
CHECK(wxCmpNaturalGeneric("1st", " 1st") > 0);
CHECK(wxCmpNaturalGeneric(" 1st", "1st") < 0);
CHECK(wxCmpNaturalGeneric("1st", ",1st") > 0);
CHECK(wxCmpNaturalGeneric(",1st", "1st") < 0);
CHECK(wxCmpNaturalGeneric("1st", "01st") == 0);
CHECK(wxCmpNaturalGeneric("01st", "1st") == 0);
CHECK(wxCmpNaturalGeneric("10th", "5th") > 0);
CHECK(wxCmpNaturalGeneric("5th", "10th") < 0);
CHECK(wxCmpNaturalGeneric("a1st", "a01st") == 0);
CHECK(wxCmpNaturalGeneric("a01st", "a1st") == 0);
CHECK(wxCmpNaturalGeneric("a10th", "a5th") > 0);
CHECK(wxCmpNaturalGeneric("a5th", "a10th") < 0);
CHECK(wxCmpNaturalGeneric("a 10th", "a5th") < 0);
CHECK(wxCmpNaturalGeneric("a5th", "a 10th") > 0);
CHECK(wxCmpNaturalGeneric("a1st1", "a01st01") == 0);
CHECK(wxCmpNaturalGeneric("a01st01", "a1st1") == 0);
CHECK(wxCmpNaturalGeneric("a10th10", "a5th5") > 0);
CHECK(wxCmpNaturalGeneric("a5th5", "a10th10") < 0);
CHECK(wxCmpNaturalGeneric("a 10th 10", "a5th 5") < 0);
CHECK(wxCmpNaturalGeneric("a5th 5", "a 10th 10") > 0);
}

View File

@@ -8,9 +8,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "asserthelper.h"
@@ -49,7 +46,7 @@ std::ostream& operator<<(std::ostream& os, const wxColour& c)
std::ostream& operator<<(std::ostream& os, const wxSize& s)
{
os << s.x << "x" << s.y;
os << s.x << "*" << s.y;
return os;
}

View File

@@ -11,9 +11,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"

View File

@@ -1,6 +1,6 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.11 (http://www.bakefile.org)
# Bakefile 0.2.12 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
@@ -21,6 +21,7 @@ CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
USE_DPI_AWARE_MANIFEST = @USE_DPI_AWARE_MANIFEST@
WX_LIB_FLAVOUR = @WX_LIB_FLAVOUR@
TOOLKIT = @TOOLKIT@
TOOLKIT_LOWERCASE = @TOOLKIT_LOWERCASE@
@@ -30,7 +31,9 @@ EXTRALIBS = @EXTRALIBS@
EXTRALIBS_XML = @EXTRALIBS_XML@
EXTRALIBS_GUI = @EXTRALIBS_GUI@
EXTRALIBS_OPENGL = @EXTRALIBS_OPENGL@
CXXWARNINGS = @CXXWARNINGS@
WX_CPPFLAGS = @WX_CPPFLAGS@
WX_CXXFLAGS = @WX_CXXFLAGS@
WX_LDFLAGS = @WX_LDFLAGS@
HOST_SUFFIX = @HOST_SUFFIX@
SAMPLES_RPATH_FLAG = @SAMPLES_RPATH_FLAG@
SAMPLES_CXXFLAGS = @SAMPLES_CXXFLAGS@
@@ -40,12 +43,12 @@ wx_top_builddir = @wx_top_builddir@
DESTDIR =
WX_RELEASE = 3.1
WX_VERSION = $(WX_RELEASE).3
WX_VERSION = $(WX_RELEASE).5
LIBDIRNAME = $(wx_top_builddir)/lib
BENCH_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
-I$(srcdir) $(__DLLFLAG_p) -DwxUSE_GUI=0 $(CXXWARNINGS) $(SAMPLES_CXXFLAGS) \
$(CPPFLAGS) $(CXXFLAGS)
BENCH_CXXFLAGS = $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
$(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) -DwxUSE_GUI=0 $(WX_CXXFLAGS) \
$(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
BENCH_OBJECTS = \
bench_bench.o \
bench_datetime.o \
@@ -57,19 +60,20 @@ BENCH_OBJECTS = \
bench_strings.o \
bench_tls.o \
bench_printfbench.o
BENCH_GUI_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
BENCH_GUI_CXXFLAGS = $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
$(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../../samples \
$(CXXWARNINGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
$(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
BENCH_GUI_OBJECTS = \
$(__bench_gui___win32rc) \
bench_gui_bench.o \
bench_gui_display.o \
bench_gui_image.o
BENCH_GRAPHICS_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
$(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../../samples \
$(CXXWARNINGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
BENCH_GRAPHICS_CXXFLAGS = $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) \
-I$(srcdir)/../../samples $(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) \
$(CXXFLAGS)
BENCH_GRAPHICS_OBJECTS = \
$(__bench_graphics___win32rc) \
bench_graphics_graphics.o
@@ -141,6 +145,9 @@ COND_MONOLITHIC_0___WXLIB_NET_p = \
@COND_USE_THREADS_0@__THREAD_DEFINE_p_0 = --define wxNO_THREADS
@COND_SHARED_1@__DLLFLAG_p = -DWXUSINGDLL
@COND_SHARED_1@__DLLFLAG_p_0 = --define WXUSINGDLL
@COND_PLATFORM_WIN32_1@__WIN32_DPI_MANIFEST_p = \
@COND_PLATFORM_WIN32_1@ --define \
@COND_PLATFORM_WIN32_1@ wxUSE_DPI_AWARE_MANIFEST=$(USE_DPI_AWARE_MANIFEST)
@COND_TOOLKIT_MSW@__RCDEFDIR_p = --include-dir \
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
COND_MONOLITHIC_0___WXLIB_CORE_p = \
@@ -195,7 +202,7 @@ distclean: clean
rm -f config.cache config.log config.status bk-deps bk-make-pch shared-ld-sh Makefile
bench$(EXEEXT): $(BENCH_OBJECTS)
$(CXX) -o $@ $(BENCH_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_PNG_IF_MONO_p) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
$(CXX) -o $@ $(BENCH_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_PNG_IF_MONO_p) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
data:
@mkdir -p .
@@ -210,7 +217,7 @@ data:
done
@COND_USE_GUI_1@bench_gui$(EXEEXT): $(BENCH_GUI_OBJECTS) $(__bench_gui___win32rc)
@COND_USE_GUI_1@ $(CXX) -o $@ $(BENCH_GUI_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
@COND_USE_GUI_1@ $(CXX) -o $@ $(BENCH_GUI_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
@COND_PLATFORM_MACOSX_1_USE_GUI_1@bench_gui.app/Contents/PkgInfo: $(__bench_gui___depname) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ mkdir -p bench_gui.app/Contents
@@ -235,7 +242,7 @@ data:
@COND_PLATFORM_MACOSX_1_USE_GUI_1@bench_gui_bundle: $(____bench_gui_BUNDLE_TGT_REF_DEP)
@COND_USE_GUI_1@bench_graphics$(EXEEXT): $(BENCH_GRAPHICS_OBJECTS) $(__bench_graphics___win32rc)
@COND_USE_GUI_1@ $(CXX) -o $@ $(BENCH_GRAPHICS_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl-$(WX_RELEASE)$(HOST_SUFFIX) $(EXTRALIBS_OPENGL) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
@COND_USE_GUI_1@ $(CXX) -o $@ $(BENCH_GRAPHICS_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl-$(WX_RELEASE)$(HOST_SUFFIX) $(EXTRALIBS_OPENGL) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
@COND_PLATFORM_MACOSX_1_USE_GUI_1@bench_graphics.app/Contents/PkgInfo: $(__bench_graphics___depname) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
@COND_PLATFORM_MACOSX_1_USE_GUI_1@ mkdir -p bench_graphics.app/Contents
@@ -302,7 +309,7 @@ bench_printfbench.o: $(srcdir)/printfbench.cpp
$(CXXC) -c -o $@ $(BENCH_CXXFLAGS) $(srcdir)/printfbench.cpp
bench_gui_sample_rc.o: $(srcdir)/../../samples/sample.rc
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) --include-dir $(srcdir) $(__DLLFLAG_p_0) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) --include-dir $(srcdir) $(__DLLFLAG_p_0) $(__WIN32_DPI_MANIFEST_p) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include
bench_gui_bench.o: $(srcdir)/bench.cpp
$(CXXC) -c -o $@ $(BENCH_GUI_CXXFLAGS) $(srcdir)/bench.cpp
@@ -314,7 +321,7 @@ bench_gui_image.o: $(srcdir)/image.cpp
$(CXXC) -c -o $@ $(BENCH_GUI_CXXFLAGS) $(srcdir)/image.cpp
bench_graphics_sample_rc.o: $(srcdir)/../../samples/sample.rc
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) --include-dir $(srcdir) $(__DLLFLAG_p_0) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) --include-dir $(srcdir) $(__DLLFLAG_p_0) $(__WIN32_DPI_MANIFEST_p) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include
bench_graphics_graphics.o: $(srcdir)/graphics.cpp
$(CXXC) -c -o $@ $(BENCH_GRAPHICS_CXXFLAGS) $(srcdir)/graphics.cpp

View File

@@ -2,7 +2,7 @@
<!--
This project was generated by
Bakefile 0.2.11 (http://www.bakefile.org)
Bakefile 0.2.12 (http://www.bakefile.org)
Do not modify, all changes will be overwritten!
-->

View File

@@ -2,7 +2,7 @@
<!--
This project was generated by
Bakefile 0.2.11 (http://www.bakefile.org)
Bakefile 0.2.12 (http://www.bakefile.org)
Do not modify, all changes will be overwritten!
-->

View File

@@ -2,7 +2,7 @@
<!--
This project was generated by
Bakefile 0.2.11 (http://www.bakefile.org)
Bakefile 0.2.12 (http://www.bakefile.org)
Do not modify, all changes will be overwritten!
-->

View File

@@ -2,7 +2,7 @@
<!--
This project was generated by
Bakefile 0.2.11 (http://www.bakefile.org)
Bakefile 0.2.12 (http://www.bakefile.org)
Do not modify, all changes will be overwritten!
-->

View File

@@ -2,7 +2,7 @@
<!--
This project was generated by
Bakefile 0.2.11 (http://www.bakefile.org)
Bakefile 0.2.12 (http://www.bakefile.org)
Do not modify, all changes will be overwritten!
-->

View File

@@ -2,7 +2,7 @@
<!--
This project was generated by
Bakefile 0.2.11 (http://www.bakefile.org)
Bakefile 0.2.12 (http://www.bakefile.org)
Do not modify, all changes will be overwritten!
-->

View File

@@ -2,7 +2,7 @@
<!--
This project was generated by
Bakefile 0.2.11 (http://www.bakefile.org)
Bakefile 0.2.12 (http://www.bakefile.org)
Do not modify, all changes will be overwritten!
-->

View File

@@ -2,7 +2,7 @@
<!--
This project was generated by
Bakefile 0.2.11 (http://www.bakefile.org)
Bakefile 0.2.12 (http://www.bakefile.org)
Do not modify, all changes will be overwritten!
-->

View File

@@ -2,7 +2,7 @@
<!--
This project was generated by
Bakefile 0.2.11 (http://www.bakefile.org)
Bakefile 0.2.12 (http://www.bakefile.org)
Do not modify, all changes will be overwritten!
-->

View File

@@ -51,6 +51,7 @@ struct GraphicsBenchmarkOptions
{
mapMode = 0;
penWidth = 0;
penStyle = wxPENSTYLE_INVALID;
width = 800;
height = 600;
@@ -63,7 +64,10 @@ struct GraphicsBenchmarkOptions
testRawBitmaps =
testRectangles =
testCircles =
testEllipses = false;
testEllipses =
testTextExtent =
testMultiLineTextExtent =
testPartialTextExtents = false;
usePaint =
useClient =
@@ -82,13 +86,18 @@ struct GraphicsBenchmarkOptions
height,
numIters;
wxPenStyle penStyle;
bool testBitmaps,
testImages,
testLines,
testRawBitmaps,
testRectangles,
testCircles,
testEllipses;
testEllipses,
testTextExtent,
testMultiLineTextExtent,
testPartialTextExtents;
bool usePaint,
useClient,
@@ -152,11 +161,26 @@ public:
Connect(wxEVT_SIZE, wxSizeEventHandler(GraphicsBenchmarkFrame::OnSize));
m_bitmapARGB.Create(64, 64, 32);
#ifdef __WXMSW__
#if defined(__WXMSW__) || defined(__WXOSX__)
m_bitmapARGB.UseAlpha(true);
#endif // __WXMSW__
#endif // __WXMSW__ || _WXOSX__
m_bitmapRGB.Create(64, 64, 24);
wxBitmap bmpMask(64, 64, 1);
{
wxMemoryDC dc(bmpMask);
dc.SetBackground(*wxBLACK_BRUSH);
dc.Clear();
}
m_bitmapARGBwithMask.Create(64, 64, 32);
#if defined(__WXMSW__) || defined(__WXOSX__)
m_bitmapARGBwithMask.UseAlpha(true);
#endif // __WXMSW__ || __WXOSX__
m_bitmapARGBwithMask.SetMask(new wxMask(bmpMask));
m_bitmapRGBwithMask.Create(64, 64, 24);
m_bitmapRGBwithMask.SetMask(new wxMask(bmpMask));
m_renderer = NULL;
if ( opts.useGC )
{
@@ -322,12 +346,9 @@ private:
BenchmarkDCAndGC("RGB memory", dc, gcdc);
}
{
#ifdef __WXMSW__
#if defined(__WXMSW__) || defined(__WXOSX__)
wxBitmap bmp(opts.width, opts.height, 32);
bmp.UseAlpha(false);
#else // !__WXMSW__
wxBitmap bmp(opts.width, opts.height, 24);
#endif // __WXMSW__/!__WXMSW__
wxMemoryDC dc(bmp);
wxGCDC gcdc;
if ( m_renderer )
@@ -336,12 +357,13 @@ private:
gcdc.SetGraphicsContext(gc);
}
BenchmarkDCAndGC("0RGB memory", dc, gcdc);
#endif // __WXMSW__ ||__WXOSX__
}
{
wxBitmap bmp(opts.width, opts.height, 32);
#ifdef __WXMSW__
#if defined(__WXMSW__) || defined(__WXOSX__)
bmp.UseAlpha(true);
#endif // __WXMSW__
#endif // __WXMSW__ || __WXOSX__
wxMemoryDC dc(bmp);
wxGCDC gcdc;
if ( m_renderer )
@@ -380,6 +402,24 @@ private:
BenchmarkRoundedRectangles(msg, dc);
BenchmarkCircles(msg, dc);
BenchmarkEllipses(msg, dc);
BenchmarkTextExtent(msg, dc);
BenchmarkPartialTextExtents(msg, dc);
}
void SetupDC(wxDC& dc)
{
if ( opts.mapMode != 0 )
dc.SetMapMode((wxMappingMode)opts.mapMode);
if ( opts.penWidth != 0 )
dc.SetPen(wxPen(*wxWHITE, opts.penWidth));
if ( opts.penStyle != wxPENSTYLE_INVALID )
{
wxPen pen = dc.GetPen();
if ( !pen.IsOk() )
pen = wxPen(*wxWHITE, 1);
pen.SetStyle(opts.penStyle);
dc.SetPen(pen);
}
}
void BenchmarkLines(const wxString& msg, wxDC& dc)
@@ -387,32 +427,88 @@ private:
if ( !opts.testLines )
return;
if ( opts.mapMode != 0 )
dc.SetMapMode((wxMappingMode)opts.mapMode);
if ( opts.penWidth != 0 )
dc.SetPen(wxPen(*wxWHITE, opts.penWidth));
SetupDC(dc);
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
wxStopWatch sw;
int x = 0,
y = 0;
int x0 = 0,
y0 = 0;
for ( int n = 0; n < opts.numIters; n++ )
{
int x1 = rand() % opts.width,
y1 = rand() % opts.height;
dc.DrawLine(x, y, x1, y1);
dc.DrawLine(x0, y0, x1, y1);
x = x1;
y = y1;
x0 = x1;
y0 = y1;
}
const long t = sw.Time();
wxPrintf("%ld lines done in %ldms = %gus/line\n",
opts.numIters, t, (1000. * t)/opts.numIters);
// Horizontal lines
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
sw.Start();
x0 = 0;
for ( int n = 0; n < opts.numIters; n++ )
{
int x1 = rand() % opts.width;
int y = rand() % opts.height;
dc.DrawLine(x0, y, x1, y);
x0 = x1;
}
const long t2 = sw.Time();
wxPrintf("%ld horizontal lines done in %ldms = %gus/line\n",
opts.numIters, t2, (1000. * t2) / opts.numIters);
// Vertical lines
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
sw.Start();
y0 = 0;
for ( int n = 0; n < opts.numIters; n++ )
{
int x = rand() % opts.width;
int y1 = rand() % opts.height;
dc.DrawLine(x, y0, x, y1);
y0 = y1;
}
const long t3 = sw.Time();
wxPrintf("%ld vertical lines done in %ldms = %gus/line\n",
opts.numIters, t3, (1000. * t3) / opts.numIters);
// Cross hair
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
sw.Start();
for ( int n = 0; n < opts.numIters; n++ )
{
x0 = rand() % opts.width;
y0 = rand() % opts.height;
dc.CrossHair(x0, y0);
}
const long t4 = sw.Time();
wxPrintf("%ld cross hairs done in %ldms = %gus/line\n",
opts.numIters, t4, (1000. * t4) / (2*opts.numIters));
}
@@ -421,10 +517,7 @@ private:
if ( !opts.testRectangles )
return;
if ( opts.mapMode != 0 )
dc.SetMapMode((wxMappingMode)opts.mapMode);
if ( opts.penWidth != 0 )
dc.SetPen(wxPen(*wxWHITE, opts.penWidth));
SetupDC(dc);
dc.SetBrush( *wxRED_BRUSH );
@@ -451,10 +544,7 @@ private:
if ( !opts.testRectangles )
return;
if ( opts.mapMode != 0 )
dc.SetMapMode((wxMappingMode)opts.mapMode);
if ( opts.penWidth != 0 )
dc.SetPen(wxPen(*wxWHITE, opts.penWidth));
SetupDC(dc);
dc.SetBrush( *wxCYAN_BRUSH );
@@ -481,10 +571,7 @@ private:
if ( !opts.testCircles )
return;
if ( opts.mapMode != 0 )
dc.SetMapMode((wxMappingMode)opts.mapMode);
if ( opts.penWidth != 0 )
dc.SetPen(wxPen(*wxWHITE, opts.penWidth));
SetupDC(dc);
dc.SetBrush( *wxGREEN_BRUSH );
@@ -511,10 +598,7 @@ private:
if ( !opts.testEllipses )
return;
if ( opts.mapMode != 0 )
dc.SetMapMode((wxMappingMode)opts.mapMode);
if ( opts.penWidth != 0 )
dc.SetPen(wxPen(*wxWHITE, opts.penWidth));
SetupDC(dc);
dc.SetBrush( *wxBLUE_BRUSH );
@@ -536,15 +620,69 @@ private:
opts.numIters, t, (1000. * t)/opts.numIters);
}
void BenchmarkTextExtent(const wxString& msg, wxDC& dc)
{
if ( !opts.testTextExtent )
return;
SetupDC(dc);
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
const wxString str("The quick brown fox jumps over the lazy dog");
wxSize size;
wxStopWatch sw;
for ( long n = 0; n < opts.numIters; n++ )
{
if ( opts.testMultiLineTextExtent )
size += dc.GetMultiLineTextExtent(str);
else
size += dc.GetTextExtent(str);
}
const long t = sw.Time();
wxPrintf("%ld text extent measures done in %ldms = %gus/call\n",
opts.numIters, t, (1000. * t)/opts.numIters);
}
void BenchmarkPartialTextExtents(const wxString& msg, wxDC& dc)
{
if ( !opts.testPartialTextExtents )
return;
SetupDC(dc);
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
const wxString str("The quick brown fox jumps over the lazy dog");
wxArrayInt widths;
wxStopWatch sw;
for ( long n = 0; n < opts.numIters; n++ )
{
if ( !dc.GetPartialTextExtents(str, widths) )
{
wxPrintf("ERROR: GetPartialTextExtents() failed\n");
return;
}
}
const long t = sw.Time();
wxPrintf("%ld partial text extents measures done in %ldms = %gus/call\n",
opts.numIters, t, (1000. * t)/opts.numIters);
}
void BenchmarkBitmaps(const wxString& msg, wxDC& dc)
{
if ( !opts.testBitmaps )
return;
if ( opts.mapMode != 0 )
dc.SetMapMode((wxMappingMode)opts.mapMode);
if ( opts.penWidth != 0 )
dc.SetPen(wxPen(*wxWHITE, opts.penWidth));
SetupDC(dc);
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
@@ -579,6 +717,37 @@ private:
wxPrintf("%ld RGB bitmaps done in %ldms = %gus/bitmap\n",
opts.numIters, t2, (1000. * t2)/opts.numIters);
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
sw.Start();
for ( int n = 0; n < opts.numIters; n++ )
{
int x = rand() % opts.width,
y = rand() % opts.height;
dc.DrawBitmap(m_bitmapARGBwithMask, x, y, true);
}
const long t3 = sw.Time();
wxPrintf("%ld ARGB bitmaps with mask done in %ldms = %gus/bitmap\n",
opts.numIters, t3, (1000. * t3) / opts.numIters);
wxPrintf("Benchmarking %s: ", msg);
fflush(stdout);
sw.Start();
for ( int n = 0; n < opts.numIters; n++ )
{
int x = rand() % opts.width,
y = rand() % opts.height;
dc.DrawBitmap(m_bitmapRGBwithMask, x, y, true);
}
const long t4 = sw.Time();
wxPrintf("%ld RGB bitmaps with mask done in %ldms = %gus/bitmap\n",
opts.numIters, t4, (1000. * t4) / opts.numIters);
}
void BenchmarkImages(const wxString& msg, wxDC& dc)
@@ -659,6 +828,8 @@ private:
wxBitmap m_bitmapARGB;
wxBitmap m_bitmapRGB;
wxBitmap m_bitmapARGBwithMask;
wxBitmap m_bitmapRGBwithMask;
#if wxUSE_GLCANVAS
wxGLCanvas* m_glCanvas;
wxGLContext* m_glContext;
@@ -680,6 +851,9 @@ public:
{ wxCMD_LINE_SWITCH, "", "rectangles" },
{ wxCMD_LINE_SWITCH, "", "circles" },
{ wxCMD_LINE_SWITCH, "", "ellipses" },
{ wxCMD_LINE_SWITCH, "", "textextent" },
{ wxCMD_LINE_SWITCH, "", "multilinetextextent" },
{ wxCMD_LINE_SWITCH, "", "partialtextextents" },
{ wxCMD_LINE_SWITCH, "", "paint" },
{ wxCMD_LINE_SWITCH, "", "client" },
{ wxCMD_LINE_SWITCH, "", "memory" },
@@ -690,6 +864,7 @@ public:
#endif // wxUSE_GLCANVAS
{ wxCMD_LINE_OPTION, "m", "map-mode", "", wxCMD_LINE_VAL_NUMBER },
{ wxCMD_LINE_OPTION, "p", "pen-width", "", wxCMD_LINE_VAL_NUMBER },
{ wxCMD_LINE_OPTION, "s", "pen-style", "solid | dot | long_dash | short_dash", wxCMD_LINE_VAL_STRING },
{ wxCMD_LINE_OPTION, "w", "width", "", wxCMD_LINE_VAL_NUMBER },
{ wxCMD_LINE_OPTION, "h", "height", "", wxCMD_LINE_VAL_NUMBER },
{ wxCMD_LINE_OPTION, "I", "images", "", wxCMD_LINE_VAL_NUMBER },
@@ -710,6 +885,34 @@ public:
return false;
if ( parser.Found("p", &opts.penWidth) && opts.penWidth < 1 )
return false;
wxString penStyle;
if ( parser.Found("pen-style", &penStyle) )
{
if ( !penStyle.empty() )
{
if ( penStyle == wxS("solid") )
{
opts.penStyle = wxPENSTYLE_SOLID;
}
else if ( penStyle == wxS("dot") )
{
opts.penStyle = wxPENSTYLE_DOT;
}
else if ( penStyle == wxS("long_dash") )
{
opts.penStyle = wxPENSTYLE_LONG_DASH;
}
else if ( penStyle == wxS("short_dash") )
{
opts.penStyle = wxPENSTYLE_SHORT_DASH;
}
else
{
wxLogError(wxS("Unsupported pen style."));
return false;
}
}
}
if ( parser.Found("w", &opts.width) && opts.width < 1 )
return false;
if ( parser.Found("h", &opts.height) && opts.height < 1 )
@@ -724,9 +927,13 @@ public:
opts.testRectangles = parser.Found("rectangles");
opts.testCircles = parser.Found("circles");
opts.testEllipses = parser.Found("ellipses");
opts.testTextExtent = parser.Found("textextent");
opts.testMultiLineTextExtent = parser.Found("multilinetextextent");
opts.testPartialTextExtents = parser.Found("partialtextextents");
if ( !(opts.testBitmaps || opts.testImages || opts.testLines
|| opts.testRawBitmaps || opts.testRectangles
|| opts.testCircles || opts.testEllipses) )
|| opts.testCircles || opts.testEllipses
|| opts.testTextExtent || opts.testPartialTextExtents) )
{
// Do everything by default.
opts.testBitmaps =
@@ -735,7 +942,9 @@ public:
opts.testRawBitmaps =
opts.testRectangles =
opts.testCircles =
opts.testEllipses = true;
opts.testEllipses =
opts.testTextExtent =
opts.testPartialTextExtents = true;
}
opts.usePaint = parser.Found("paint");

View File

@@ -8,9 +8,6 @@
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "htmlpars.h"

View File

@@ -8,9 +8,6 @@
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "htmltag.h"

View File

@@ -43,6 +43,7 @@ BENCHMARK_FUNC(LoadPNG)
return image.LoadFile("horse.png");
}
#if wxUSE_LIBTIFF
BENCHMARK_FUNC(LoadTIFF)
{
static bool s_handlerAdded = false;
@@ -55,6 +56,7 @@ BENCHMARK_FUNC(LoadTIFF)
wxImage image;
return image.LoadFile("horse.tif");
}
#endif // wxUSE_LIBTIFF
static const wxImage& GetTestImage()
{

View File

@@ -1,355 +0,0 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.11 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
.autodepend
!ifndef BCCDIR
!ifndef MAKEDIR
!error Your Borland compiler does not define MAKEDIR. Please define the BCCDIR variable, e.g. BCCDIR=d:\bc4
!endif
BCCDIR = $(MAKEDIR)\..
!endif
!include ../../build/msw/config.bcc
# -------------------------------------------------------------------------
# Do not modify the rest of this file!
# -------------------------------------------------------------------------
### Variables: ###
WX_RELEASE_NODOT = 31
COMPILER_PREFIX = bcc
OBJS = \
$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
LIBDIRNAME = \
.\..\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG)
SETUPHDIR = \
$(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)
BENCH_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \
$(__OPTIMIZEFLAG) $(__THREADSFLAG_1) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) \
-I$(SETUPHDIR) -I.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES) -I. \
$(__DLLFLAG_p) -DwxUSE_GUI=0 $(CPPFLAGS) $(CXXFLAGS)
BENCH_OBJECTS = \
$(OBJS)\bench_bench.obj \
$(OBJS)\bench_datetime.obj \
$(OBJS)\bench_htmlpars.obj \
$(OBJS)\bench_htmltag.obj \
$(OBJS)\bench_ipcclient.obj \
$(OBJS)\bench_log.obj \
$(OBJS)\bench_mbconv.obj \
$(OBJS)\bench_strings.obj \
$(OBJS)\bench_tls.obj \
$(OBJS)\bench_printfbench.obj
BENCH_GUI_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \
$(__OPTIMIZEFLAG) $(__THREADSFLAG_1) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) \
-I$(SETUPHDIR) -I.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES) -I. \
$(__DLLFLAG_p) -I.\..\..\samples -DNOPCH $(CPPFLAGS) $(CXXFLAGS)
BENCH_GUI_OBJECTS = \
$(OBJS)\bench_gui_bench.obj \
$(OBJS)\bench_gui_display.obj \
$(OBJS)\bench_gui_image.obj
BENCH_GRAPHICS_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \
$(__OPTIMIZEFLAG) $(__THREADSFLAG_1) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) \
-I$(SETUPHDIR) -I.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES) -I. \
$(__DLLFLAG_p) -I.\..\..\samples -DNOPCH $(CPPFLAGS) $(CXXFLAGS)
BENCH_GRAPHICS_OBJECTS = \
$(OBJS)\bench_graphics_graphics.obj
### Conditionally set variables: ###
!if "$(USE_GUI)" == "0"
PORTNAME = base
!endif
!if "$(USE_GUI)" == "1"
PORTNAME = msw$(TOOLKIT_VERSION)
!endif
!if "$(OFFICIAL_BUILD)" == "1"
COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
!endif
!if "$(BUILD)" == "debug"
WXDEBUGFLAG = d
!endif
!if "$(UNICODE)" == "1"
WXUNICODEFLAG = u
!endif
!if "$(WXUNIV)" == "1"
WXUNIVNAME = univ
!endif
!if "$(SHARED)" == "1"
WXDLLFLAG = dll
!endif
!if "$(SHARED)" == "0"
LIBTYPE_SUFFIX = lib
!endif
!if "$(SHARED)" == "1"
LIBTYPE_SUFFIX = dll
!endif
!if "$(MONOLITHIC)" == "0"
EXTRALIBS_FOR_BASE =
!endif
!if "$(MONOLITHIC)" == "1"
EXTRALIBS_FOR_BASE =
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_NET_p = \
wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net.lib
!endif
!if "$(MONOLITHIC)" == "1"
__LIB_PNG_IF_MONO_p = $(__LIB_PNG_p)
!endif
!if "$(USE_GUI)" == "1"
__bench_gui___depname = $(OBJS)\bench_gui.exe
!endif
!if "$(USE_GUI)" == "1"
__bench_graphics___depname = $(OBJS)\bench_graphics.exe
!endif
!if "$(BUILD)" == "debug"
__OPTIMIZEFLAG = -Od
!endif
!if "$(BUILD)" == "release"
__OPTIMIZEFLAG = -O2
!endif
!if "$(USE_THREADS)" == "0"
__THREADSFLAG =
!endif
!if "$(USE_THREADS)" == "1"
__THREADSFLAG = mt
!endif
!if "$(USE_THREADS)" == "0"
__THREADSFLAG_1 =
!endif
!if "$(USE_THREADS)" == "1"
__THREADSFLAG_1 = -tWM
!endif
!if "$(RUNTIME_LIBS)" == "dynamic"
__RUNTIME_LIBS = -tWR
!endif
!if "$(RUNTIME_LIBS)" == "static"
__RUNTIME_LIBS =
!endif
!if "$(RUNTIME_LIBS)" == "dynamic"
__RUNTIME_LIBS_1 = i
!endif
!if "$(RUNTIME_LIBS)" == "static"
__RUNTIME_LIBS_1 =
!endif
!if "$(WXUNIV)" == "1"
__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__
!endif
!if "$(WXUNIV)" == "1"
__WXUNIV_DEFINE_p_0 = -d__WXUNIVERSAL__
!endif
!if "$(DEBUG_FLAG)" == "0"
__DEBUG_DEFINE_p = -DwxDEBUG_LEVEL=0
!endif
!if "$(DEBUG_FLAG)" == "0"
__DEBUG_DEFINE_p_0 = -dwxDEBUG_LEVEL=0
!endif
!if "$(BUILD)" == "release"
__NDEBUG_DEFINE_p = -DNDEBUG
!endif
!if "$(BUILD)" == "release"
__NDEBUG_DEFINE_p_0 = -dNDEBUG
!endif
!if "$(USE_EXCEPTIONS)" == "0"
__EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS
!endif
!if "$(USE_EXCEPTIONS)" == "0"
__EXCEPTIONS_DEFINE_p_0 = -dwxNO_EXCEPTIONS
!endif
!if "$(USE_RTTI)" == "0"
__RTTI_DEFINE_p = -DwxNO_RTTI
!endif
!if "$(USE_RTTI)" == "0"
__RTTI_DEFINE_p_0 = -dwxNO_RTTI
!endif
!if "$(USE_THREADS)" == "0"
__THREAD_DEFINE_p = -DwxNO_THREADS
!endif
!if "$(USE_THREADS)" == "0"
__THREAD_DEFINE_p_0 = -dwxNO_THREADS
!endif
!if "$(UNICODE)" == "0"
__UNICODE_DEFINE_p = -DwxUSE_UNICODE=0
!endif
!if "$(UNICODE)" == "1"
__UNICODE_DEFINE_p = -D_UNICODE
!endif
!if "$(UNICODE)" == "0"
__UNICODE_DEFINE_p_0 = -dwxUSE_UNICODE=0
!endif
!if "$(UNICODE)" == "1"
__UNICODE_DEFINE_p_0 = -d_UNICODE
!endif
!if "$(USE_CAIRO)" == "1"
____CAIRO_INCLUDEDIR_FILENAMES = -I$(CAIRO_ROOT)\include\cairo
!endif
!if "$(USE_CAIRO)" == "1"
____CAIRO_INCLUDEDIR_FILENAMES_0 = -i$(CAIRO_ROOT)\include\cairo
!endif
!if "$(SHARED)" == "1"
__DLLFLAG_p = -DWXUSINGDLL
!endif
!if "$(SHARED)" == "1"
__DLLFLAG_p_0 = -dWXUSINGDLL
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_CORE_p = \
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core.lib
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_BASE_p = \
wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
!endif
!if "$(MONOLITHIC)" == "1"
__WXLIB_MONO_p = \
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
!endif
!if "$(MONOLITHIC)" == "1" && "$(USE_STC)" == "1"
__LIB_SCINTILLA_IF_MONO_p = wxscintilla$(WXDEBUGFLAG).lib
!endif
!if "$(USE_GUI)" == "1"
__LIB_TIFF_p = wxtiff$(WXDEBUGFLAG).lib
!endif
!if "$(USE_GUI)" == "1"
__LIB_JPEG_p = wxjpeg$(WXDEBUGFLAG).lib
!endif
!if "$(USE_GUI)" == "1"
__LIB_PNG_p = wxpng$(WXDEBUGFLAG).lib
!endif
!if "$(USE_CAIRO)" == "1"
__CAIRO_LIB_p = cairo.lib
!endif
!if "$(USE_CAIRO)" == "1"
____CAIRO_LIBDIR_FILENAMES = -L$(CAIRO_ROOT)\lib
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO = -v
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO = -v-
!endif
!if "$(DEBUG_INFO)" == "0"
__DEBUGINFO = -v-
!endif
!if "$(DEBUG_INFO)" == "1"
__DEBUGINFO = -v
!endif
all: $(OBJS)
$(OBJS):
-if not exist $(OBJS) mkdir $(OBJS)
### Targets: ###
all: $(OBJS)\bench.exe data $(__bench_gui___depname) $(__bench_graphics___depname) data-image
clean:
-if exist $(OBJS)\*.obj del $(OBJS)\*.obj
-if exist $(OBJS)\*.res del $(OBJS)\*.res
-if exist $(OBJS)\*.csm del $(OBJS)\*.csm
-if exist $(OBJS)\bench.exe del $(OBJS)\bench.exe
-if exist $(OBJS)\bench.tds del $(OBJS)\bench.tds
-if exist $(OBJS)\bench.ilc del $(OBJS)\bench.ilc
-if exist $(OBJS)\bench.ild del $(OBJS)\bench.ild
-if exist $(OBJS)\bench.ilf del $(OBJS)\bench.ilf
-if exist $(OBJS)\bench.ils del $(OBJS)\bench.ils
-if exist $(OBJS)\bench_gui.exe del $(OBJS)\bench_gui.exe
-if exist $(OBJS)\bench_gui.tds del $(OBJS)\bench_gui.tds
-if exist $(OBJS)\bench_gui.ilc del $(OBJS)\bench_gui.ilc
-if exist $(OBJS)\bench_gui.ild del $(OBJS)\bench_gui.ild
-if exist $(OBJS)\bench_gui.ilf del $(OBJS)\bench_gui.ilf
-if exist $(OBJS)\bench_gui.ils del $(OBJS)\bench_gui.ils
-if exist $(OBJS)\bench_graphics.exe del $(OBJS)\bench_graphics.exe
-if exist $(OBJS)\bench_graphics.tds del $(OBJS)\bench_graphics.tds
-if exist $(OBJS)\bench_graphics.ilc del $(OBJS)\bench_graphics.ilc
-if exist $(OBJS)\bench_graphics.ild del $(OBJS)\bench_graphics.ild
-if exist $(OBJS)\bench_graphics.ilf del $(OBJS)\bench_graphics.ilf
-if exist $(OBJS)\bench_graphics.ils del $(OBJS)\bench_graphics.ils
$(OBJS)\bench.exe: $(BENCH_OBJECTS)
ilink32 -Tpe -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -ap $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @&&|
c0x32.obj $(BENCH_OBJECTS),$@,, $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_PNG_IF_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) ole2w32.lib oleacc.lib uxtheme.lib import32.lib cw32$(__THREADSFLAG)$(__RUNTIME_LIBS_1).lib,,
|
data:
if not exist $(OBJS) mkdir $(OBJS)
for %f in (htmltest.html) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
!if "$(USE_GUI)" == "1"
$(OBJS)\bench_gui.exe: $(BENCH_GUI_OBJECTS) $(OBJS)\bench_gui_sample.res
ilink32 -Tpe -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -ap $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @&&|
c0x32.obj $(BENCH_GUI_OBJECTS),$@,, $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) ole2w32.lib oleacc.lib uxtheme.lib import32.lib cw32$(__THREADSFLAG)$(__RUNTIME_LIBS_1).lib,, $(OBJS)\bench_gui_sample.res
|
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\bench_graphics.exe: $(BENCH_GRAPHICS_OBJECTS) $(OBJS)\bench_graphics_sample.res
ilink32 -Tpe -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -ap $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @&&|
c0x32.obj $(BENCH_GRAPHICS_OBJECTS),$@,, $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) ole2w32.lib oleacc.lib uxtheme.lib import32.lib cw32$(__THREADSFLAG)$(__RUNTIME_LIBS_1).lib,, $(OBJS)\bench_graphics_sample.res
|
!endif
data-image:
if not exist $(OBJS) mkdir $(OBJS)
for %f in (../../samples/image/horse.bmp ../../samples/image/horse.jpg ../../samples/image/horse.png ../../samples/image/horse.tif) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
$(OBJS)\bench_bench.obj: .\bench.cpp
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\bench.cpp
$(OBJS)\bench_datetime.obj: .\datetime.cpp
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\datetime.cpp
$(OBJS)\bench_htmlpars.obj: .\htmlparser\htmlpars.cpp
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\htmlparser\htmlpars.cpp
$(OBJS)\bench_htmltag.obj: .\htmlparser\htmltag.cpp
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\htmlparser\htmltag.cpp
$(OBJS)\bench_ipcclient.obj: .\ipcclient.cpp
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\ipcclient.cpp
$(OBJS)\bench_log.obj: .\log.cpp
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\log.cpp
$(OBJS)\bench_mbconv.obj: .\mbconv.cpp
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\mbconv.cpp
$(OBJS)\bench_strings.obj: .\strings.cpp
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\strings.cpp
$(OBJS)\bench_tls.obj: .\tls.cpp
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\tls.cpp
$(OBJS)\bench_printfbench.obj: .\printfbench.cpp
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\printfbench.cpp
$(OBJS)\bench_gui_sample.res: .\..\..\samples\sample.rc
brcc32 -32 -r -fo$@ -i$(BCCDIR)\include -d__WXMSW__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__NDEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) $(__UNICODE_DEFINE_p_0) -i$(SETUPHDIR) -i.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_0) -i. $(__DLLFLAG_p_0) -i.\..\..\samples -i$(BCCDIR)\include\windows\sdk -dNOPCH .\..\..\samples\sample.rc
$(OBJS)\bench_gui_bench.obj: .\bench.cpp
$(CXX) -q -c -P -o$@ $(BENCH_GUI_CXXFLAGS) .\bench.cpp
$(OBJS)\bench_gui_display.obj: .\display.cpp
$(CXX) -q -c -P -o$@ $(BENCH_GUI_CXXFLAGS) .\display.cpp
$(OBJS)\bench_gui_image.obj: .\image.cpp
$(CXX) -q -c -P -o$@ $(BENCH_GUI_CXXFLAGS) .\image.cpp
$(OBJS)\bench_graphics_sample.res: .\..\..\samples\sample.rc
brcc32 -32 -r -fo$@ -i$(BCCDIR)\include -d__WXMSW__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__NDEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) $(__UNICODE_DEFINE_p_0) -i$(SETUPHDIR) -i.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_0) -i. $(__DLLFLAG_p_0) -i.\..\..\samples -i$(BCCDIR)\include\windows\sdk -dNOPCH .\..\..\samples\sample.rc
$(OBJS)\bench_graphics_graphics.obj: .\graphics.cpp
$(CXX) -q -c -P -o$@ $(BENCH_GRAPHICS_CXXFLAGS) .\graphics.cpp

View File

@@ -1,6 +1,6 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.11 (http://www.bakefile.org)
# Bakefile 0.2.12 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
@@ -21,10 +21,10 @@ LIBDIRNAME = \
.\..\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG)
SETUPHDIR = \
$(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)
BENCH_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) $(GCCFLAGS) \
-DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \
$(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
$(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) -I$(SETUPHDIR) -I.\..\..\include \
BENCH_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) -D__WXMSW__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) \
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
$(__UNICODE_DEFINE_p) -I$(SETUPHDIR) -I.\..\..\include \
$(____CAIRO_INCLUDEDIR_FILENAMES) -W -Wall -I. $(__DLLFLAG_p) -DwxUSE_GUI=0 \
$(__RTTIFLAG) $(__EXCEPTIONSFLAG) -Wno-ctor-dtor-privacy $(CPPFLAGS) \
$(CXXFLAGS)
@@ -40,33 +40,30 @@ BENCH_OBJECTS = \
$(OBJS)\bench_tls.o \
$(OBJS)\bench_printfbench.o
BENCH_GUI_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) \
$(GCCFLAGS) -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) \
-I$(SETUPHDIR) -I.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES) -W -Wall \
-I. $(__DLLFLAG_p) -I.\..\..\samples -DNOPCH $(__RTTIFLAG) \
$(__EXCEPTIONSFLAG) -Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS)
-D__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) \
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
$(__UNICODE_DEFINE_p) -I$(SETUPHDIR) -I.\..\..\include \
$(____CAIRO_INCLUDEDIR_FILENAMES) -W -Wall -I. $(__DLLFLAG_p) \
-I.\..\..\samples -DNOPCH $(__RTTIFLAG) $(__EXCEPTIONSFLAG) \
-Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS)
BENCH_GUI_OBJECTS = \
$(OBJS)\bench_gui_sample_rc.o \
$(OBJS)\bench_gui_bench.o \
$(OBJS)\bench_gui_display.o \
$(OBJS)\bench_gui_image.o
BENCH_GRAPHICS_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) \
$(GCCFLAGS) -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) \
-I$(SETUPHDIR) -I.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES) -W -Wall \
-I. $(__DLLFLAG_p) -I.\..\..\samples -DNOPCH $(__RTTIFLAG) \
$(__EXCEPTIONSFLAG) -Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS)
-D__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) \
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
$(__UNICODE_DEFINE_p) -I$(SETUPHDIR) -I.\..\..\include \
$(____CAIRO_INCLUDEDIR_FILENAMES) -W -Wall -I. $(__DLLFLAG_p) \
-I.\..\..\samples -DNOPCH $(__RTTIFLAG) $(__EXCEPTIONSFLAG) \
-Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS)
BENCH_GRAPHICS_OBJECTS = \
$(OBJS)\bench_graphics_sample_rc.o \
$(OBJS)\bench_graphics_graphics.o
### Conditionally set variables: ###
ifeq ($(GCC_VERSION),2.95)
GCCFLAGS = -fvtable-thunks
endif
ifeq ($(USE_GUI),0)
PORTNAME = base
endif
@@ -263,7 +260,10 @@ clean:
-if exist $(OBJS)\bench_graphics.exe del $(OBJS)\bench_graphics.exe
$(OBJS)\bench.exe: $(BENCH_OBJECTS)
$(CXX) -o $@ $(BENCH_OBJECTS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_PNG_IF_MONO_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwininet -loleacc -luxtheme
$(foreach f,$(subst \,/,$(BENCH_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp))
@move /y $@.rsp.tmp $@.rsp >nul
$(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_PNG_IF_MONO_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwininet -loleacc -luxtheme
@-del $@.rsp
data:
if not exist $(OBJS) mkdir $(OBJS)
@@ -271,12 +271,18 @@ data:
ifeq ($(USE_GUI),1)
$(OBJS)\bench_gui.exe: $(BENCH_GUI_OBJECTS) $(OBJS)\bench_gui_sample_rc.o
$(CXX) -o $@ $(BENCH_GUI_OBJECTS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwininet -loleacc -luxtheme
$(foreach f,$(subst \,/,$(BENCH_GUI_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp))
@move /y $@.rsp.tmp $@.rsp >nul
$(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwininet -loleacc -luxtheme
@-del $@.rsp
endif
ifeq ($(USE_GUI),1)
$(OBJS)\bench_graphics.exe: $(BENCH_GRAPHICS_OBJECTS) $(OBJS)\bench_graphics_sample_rc.o
$(CXX) -o $@ $(BENCH_GRAPHICS_OBJECTS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl -lopengl32 -lglu32 $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwininet -loleacc -luxtheme
$(foreach f,$(subst \,/,$(BENCH_GRAPHICS_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp))
@move /y $@.rsp.tmp $@.rsp >nul
$(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl -lopengl32 -lglu32 $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwininet -loleacc -luxtheme
@-del $@.rsp
endif
data-image:
@@ -314,7 +320,7 @@ $(OBJS)\bench_printfbench.o: ./printfbench.cpp
$(CXX) -c -o $@ $(BENCH_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\bench_gui_sample_rc.o: ./../../samples/sample.rc
$(WINDRES) -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__NDEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) $(__UNICODE_DEFINE_p_0) --include-dir $(SETUPHDIR) --include-dir ./../../include $(__CAIRO_INCLUDEDIR_p) --include-dir . $(__DLLFLAG_p_0) --include-dir ./../../samples --define NOPCH
$(WINDRES) -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__NDEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) $(__UNICODE_DEFINE_p_0) --include-dir $(SETUPHDIR) --include-dir ./../../include $(__CAIRO_INCLUDEDIR_p) --include-dir . $(__DLLFLAG_p_0) --define wxUSE_DPI_AWARE_MANIFEST=$(USE_DPI_AWARE_MANIFEST) --include-dir ./../../samples --define NOPCH
$(OBJS)\bench_gui_bench.o: ./bench.cpp
$(CXX) -c -o $@ $(BENCH_GUI_CXXFLAGS) $(CPPDEPS) $<
@@ -326,7 +332,7 @@ $(OBJS)\bench_gui_image.o: ./image.cpp
$(CXX) -c -o $@ $(BENCH_GUI_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\bench_graphics_sample_rc.o: ./../../samples/sample.rc
$(WINDRES) -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__NDEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) $(__UNICODE_DEFINE_p_0) --include-dir $(SETUPHDIR) --include-dir ./../../include $(__CAIRO_INCLUDEDIR_p) --include-dir . $(__DLLFLAG_p_0) --include-dir ./../../samples --define NOPCH
$(WINDRES) -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__NDEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) $(__UNICODE_DEFINE_p_0) --include-dir $(SETUPHDIR) --include-dir ./../../include $(__CAIRO_INCLUDEDIR_p) --include-dir . $(__DLLFLAG_p_0) --define wxUSE_DPI_AWARE_MANIFEST=$(USE_DPI_AWARE_MANIFEST) --include-dir ./../../samples --define NOPCH
$(OBJS)\bench_graphics_graphics.o: ./graphics.cpp
$(CXX) -c -o $@ $(BENCH_GRAPHICS_CXXFLAGS) $(CPPDEPS) $<

View File

@@ -1,6 +1,6 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.11 (http://www.bakefile.org)
# Bakefile 0.2.12 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
@@ -23,8 +23,8 @@ SETUPHDIR = \
BENCH_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME) /DWIN32 \
$(__DEBUGINFO) /Fd$(OBJS)\bench.pdb $(____DEBUGRUNTIME) $(__OPTIMIZEFLAG) \
/D_CRT_SECURE_NO_DEPRECATE=1 /D_CRT_NON_CONFORMING_SWPRINTFS=1 \
/D_SCL_SECURE_NO_WARNINGS=1 $(__NO_VC_CRTDBG_p) /D__WXMSW__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) \
/D_SCL_SECURE_NO_WARNINGS=1 $(__NO_VC_CRTDBG_p) $(__TARGET_CPU_COMPFLAG_p) \
/D__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) \
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
$(__UNICODE_DEFINE_p) /I$(SETUPHDIR) /I.\..\..\include \
$(____CAIRO_INCLUDEDIR_FILENAMES) /W4 /I. $(__DLLFLAG_p) /D_CONSOLE \
@@ -44,9 +44,10 @@ BENCH_GUI_CXXFLAGS = /M$(__RUNTIME_LIBS_26)$(__DEBUGRUNTIME) /DWIN32 \
$(__DEBUGINFO) /Fd$(OBJS)\bench_gui.pdb $(____DEBUGRUNTIME) \
$(__OPTIMIZEFLAG) /D_CRT_SECURE_NO_DEPRECATE=1 \
/D_CRT_NON_CONFORMING_SWPRINTFS=1 /D_SCL_SECURE_NO_WARNINGS=1 \
$(__NO_VC_CRTDBG_p) /D__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \
$(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
$(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) /I$(SETUPHDIR) /I.\..\..\include \
$(__NO_VC_CRTDBG_p) $(__TARGET_CPU_COMPFLAG_p) /D__WXMSW__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) \
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
$(__UNICODE_DEFINE_p) /I$(SETUPHDIR) /I.\..\..\include \
$(____CAIRO_INCLUDEDIR_FILENAMES) /W4 /I. $(__DLLFLAG_p) /I.\..\..\samples \
/DNOPCH /D_CONSOLE $(__RTTIFLAG) $(__EXCEPTIONSFLAG) $(CPPFLAGS) $(CXXFLAGS)
BENCH_GUI_OBJECTS = \
@@ -59,9 +60,10 @@ BENCH_GRAPHICS_CXXFLAGS = /M$(__RUNTIME_LIBS_42)$(__DEBUGRUNTIME) /DWIN32 \
$(__DEBUGINFO) /Fd$(OBJS)\bench_graphics.pdb $(____DEBUGRUNTIME) \
$(__OPTIMIZEFLAG) /D_CRT_SECURE_NO_DEPRECATE=1 \
/D_CRT_NON_CONFORMING_SWPRINTFS=1 /D_SCL_SECURE_NO_WARNINGS=1 \
$(__NO_VC_CRTDBG_p) /D__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \
$(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
$(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) /I$(SETUPHDIR) /I.\..\..\include \
$(__NO_VC_CRTDBG_p) $(__TARGET_CPU_COMPFLAG_p) /D__WXMSW__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) \
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
$(__UNICODE_DEFINE_p) /I$(SETUPHDIR) /I.\..\..\include \
$(____CAIRO_INCLUDEDIR_FILENAMES) /W4 /I. $(__DLLFLAG_p) /I.\..\..\samples \
/DNOPCH /D_CONSOLE $(__RTTIFLAG) $(__EXCEPTIONSFLAG) $(CPPFLAGS) $(CXXFLAGS)
BENCH_GRAPHICS_OBJECTS = \
@@ -83,6 +85,12 @@ ARCH_SUFFIX = _ia64
!if "$(TARGET_CPU)" == "X64"
ARCH_SUFFIX = _x64
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
ARCH_SUFFIX = _x64
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
ARCH_SUFFIX = _x64
!endif
!if "$(TARGET_CPU)" == "amd64"
ARCH_SUFFIX = _x64
!endif
@@ -137,6 +145,12 @@ LINK_TARGET_CPU = /MACHINE:IA64
!if "$(TARGET_CPU)" == "X64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "amd64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
@@ -149,6 +163,174 @@ LINK_TARGET_CPU = /MACHINE:IA64
!if "$(TARGET_CPU)" == "x64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "amd64" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "amd64" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "amd64" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "AMD64" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "AMD64" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "AMD64" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "x64" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "x64" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "x64" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "X64" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "X64" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "X64" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOPLATFORM)" == "x64" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOPLATFORM)" == "x64" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOPLATFORM)" == "x64" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOPLATFORM)" == "X64" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOPLATFORM)" == "X64" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOPLATFORM)" == "X64" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "amd64" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "amd64" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "amd64" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "AMD64" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "AMD64" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "AMD64" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "x64" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "x64" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "x64" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "X64" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "X64" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "X64" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOPLATFORM)" == "x64" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOPLATFORM)" == "x64" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOPLATFORM)" == "x64" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOPLATFORM)" == "X64" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOPLATFORM)" == "X64" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(TARGET_CPU)" == "" && "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOPLATFORM)" == "X64" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/amd64_dpi_aware_pmv2.manifest
!endif
!if "$(MONOLITHIC)" == "0"
EXTRALIBS_FOR_BASE =
!endif
@@ -330,6 +512,24 @@ __NO_VC_CRTDBG_p_0 = /d __NO_VC_CRTDBG__
!if "$(BUILD)" == "release" && "$(DEBUG_FLAG)" == "1"
__NO_VC_CRTDBG_p_0 = /d __NO_VC_CRTDBG__
!endif
!if "$(TARGET_CPU)" == ""
__TARGET_CPU_COMPFLAG_p = /DTARGET_CPU_COMPFLAG=0
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
__TARGET_CPU_COMPFLAG_p =
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
__TARGET_CPU_COMPFLAG_p =
!endif
!if "$(TARGET_CPU)" == ""
__TARGET_CPU_COMPFLAG_p_0 = /d TARGET_CPU_COMPFLAG=0
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
__TARGET_CPU_COMPFLAG_p_0 =
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
__TARGET_CPU_COMPFLAG_p_0 =
!endif
!if "$(WXUNIV)" == "1"
__WXUNIV_DEFINE_p = /D__WXUNIVERSAL__
!endif
@@ -461,14 +661,14 @@ data:
!if "$(USE_GUI)" == "1"
$(OBJS)\bench_gui.exe: $(BENCH_GUI_OBJECTS) $(OBJS)\bench_gui_sample.res
link /NOLOGO /OUT:$@ $(__DEBUGINFO_3) /pdb:"$(OBJS)\bench_gui.pdb" $(__DEBUGINFO_18) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:CONSOLE $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @<<
link /NOLOGO /OUT:$@ $(__DEBUGINFO_3) /pdb:"$(OBJS)\bench_gui.pdb" $(__DEBUGINFO_18) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:CONSOLE $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @<<
$(BENCH_GUI_OBJECTS) $(BENCH_GUI_RESOURCES) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib wsock32.lib wininet.lib
<<
!endif
!if "$(USE_GUI)" == "1"
$(OBJS)\bench_graphics.exe: $(BENCH_GRAPHICS_OBJECTS) $(OBJS)\bench_graphics_sample.res
link /NOLOGO /OUT:$@ $(__DEBUGINFO_3) /pdb:"$(OBJS)\bench_graphics.pdb" $(__DEBUGINFO_34) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:CONSOLE $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @<<
link /NOLOGO /OUT:$@ $(__DEBUGINFO_3) /pdb:"$(OBJS)\bench_graphics.pdb" $(__DEBUGINFO_34) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:CONSOLE $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @<<
$(BENCH_GRAPHICS_OBJECTS) $(BENCH_GRAPHICS_RESOURCES) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib opengl32.lib glu32.lib $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib wsock32.lib wininet.lib
<<
!endif
@@ -508,7 +708,7 @@ $(OBJS)\bench_printfbench.obj: .\printfbench.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BENCH_CXXFLAGS) .\printfbench.cpp
$(OBJS)\bench_gui_sample.res: .\..\..\samples\sample.rc
rc /fo$@ /d WIN32 $(____DEBUGRUNTIME_0) /d _CRT_SECURE_NO_DEPRECATE=1 /d _CRT_NON_CONFORMING_SWPRINTFS=1 /d _SCL_SECURE_NO_WARNINGS=1 $(__NO_VC_CRTDBG_p_0) /d __WXMSW__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__NDEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) $(__UNICODE_DEFINE_p_0) /i $(SETUPHDIR) /i .\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_0) /i . $(__DLLFLAG_p_0) /i .\..\..\samples /d NOPCH /d _CONSOLE .\..\..\samples\sample.rc
rc /fo$@ /d WIN32 $(____DEBUGRUNTIME_0) /d _CRT_SECURE_NO_DEPRECATE=1 /d _CRT_NON_CONFORMING_SWPRINTFS=1 /d _SCL_SECURE_NO_WARNINGS=1 $(__NO_VC_CRTDBG_p_0) $(__TARGET_CPU_COMPFLAG_p_0) /d __WXMSW__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__NDEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) $(__UNICODE_DEFINE_p_0) /i $(SETUPHDIR) /i .\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_0) /i . $(__DLLFLAG_p_0) /i .\..\..\samples /d NOPCH /d _CONSOLE .\..\..\samples\sample.rc
$(OBJS)\bench_gui_bench.obj: .\bench.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BENCH_GUI_CXXFLAGS) .\bench.cpp
@@ -520,7 +720,7 @@ $(OBJS)\bench_gui_image.obj: .\image.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BENCH_GUI_CXXFLAGS) .\image.cpp
$(OBJS)\bench_graphics_sample.res: .\..\..\samples\sample.rc
rc /fo$@ /d WIN32 $(____DEBUGRUNTIME_0) /d _CRT_SECURE_NO_DEPRECATE=1 /d _CRT_NON_CONFORMING_SWPRINTFS=1 /d _SCL_SECURE_NO_WARNINGS=1 $(__NO_VC_CRTDBG_p_0) /d __WXMSW__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__NDEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) $(__UNICODE_DEFINE_p_0) /i $(SETUPHDIR) /i .\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_0) /i . $(__DLLFLAG_p_0) /i .\..\..\samples /d NOPCH /d _CONSOLE .\..\..\samples\sample.rc
rc /fo$@ /d WIN32 $(____DEBUGRUNTIME_0) /d _CRT_SECURE_NO_DEPRECATE=1 /d _CRT_NON_CONFORMING_SWPRINTFS=1 /d _SCL_SECURE_NO_WARNINGS=1 $(__NO_VC_CRTDBG_p_0) $(__TARGET_CPU_COMPFLAG_p_0) /d __WXMSW__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__NDEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) $(__UNICODE_DEFINE_p_0) /i $(SETUPHDIR) /i .\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_0) /i . $(__DLLFLAG_p_0) /i .\..\..\samples /d NOPCH /d _CONSOLE .\..\..\samples\sample.rc
$(OBJS)\bench_graphics_graphics.obj: .\graphics.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BENCH_GRAPHICS_CXXFLAGS) .\graphics.cpp

View File

@@ -12,9 +12,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#endif // WX_PRECOMP
@@ -299,6 +296,8 @@ void CmdLineTestCase::ArgumentsCollection()
void CmdLineTestCase::Usage()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
// check that Usage() returns roughly what we expect (don't check all the
// details, its format can change in the future)
static const wxCmdLineEntryDesc desc[] =
@@ -319,6 +318,8 @@ void CmdLineTestCase::Usage()
{ wxCMD_LINE_NONE }
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
wxCmdLineParser p(desc);
const wxArrayString usageLines = wxSplit(p.GetUsageString(), '\n');
@@ -348,6 +349,8 @@ void CmdLineTestCase::Usage()
void CmdLineTestCase::Found()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const wxCmdLineEntryDesc desc[] =
{
{ wxCMD_LINE_SWITCH, "v", "verbose", "be verbose" },
@@ -359,6 +362,8 @@ void CmdLineTestCase::Found()
{ wxCMD_LINE_NONE }
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
wxCmdLineParser p(desc);
p.SetCmdLine ("-v --output hello -s 2 --date=2014-02-17 -f 0.2 input-file.txt");

View File

@@ -19,9 +19,6 @@
#if wxUSE_CONFIG
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"

View File

@@ -12,9 +12,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_FILECONFIG

View File

@@ -12,9 +12,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_CONFIG && wxUSE_REGKEY

131
tests/controls/auitest.cpp Normal file
View File

@@ -0,0 +1,131 @@
///////////////////////////////////////////////////////////////////////////////
// Name: tests/controls/auitest.cpp
// Purpose: wxAui control tests
// Author: Sebastian Walderich
// Created: 2018-12-19
// Copyright: (c) 2018 Sebastian Walderich
///////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "testprec.h"
#if wxUSE_AUI
#ifndef WX_PRECOMP
#include "wx/app.h"
#endif // WX_PRECOMP
#include "wx/panel.h"
#include "wx/scopedptr.h"
#include "wx/aui/auibook.h"
#include "asserthelper.h"
// ----------------------------------------------------------------------------
// test class
// ----------------------------------------------------------------------------
TEST_CASE( "wxAuiNotebook::DoGetBestSize", "[aui]" )
{
wxWindow *frame = wxTheApp->GetTopWindow();
REQUIRE( frame );
wxAuiNotebook *nb = new wxAuiNotebook(frame);
wxScopedPtr<wxAuiNotebook> cleanUp(nb);
wxPanel *p = new wxPanel(nb);
p->SetMinSize(wxSize(100, 100));
REQUIRE( nb->AddPage(p, "Center Pane") );
const int tabHeight = nb->GetTabCtrlHeight();
SECTION( "Single pane with multiple tabs" )
{
p = new wxPanel(nb);
p->SetMinSize(wxSize(300, 100));
nb->AddPage(p, "Center Tab 2");
p = new wxPanel(nb);
p->SetMinSize(wxSize(100, 200));
nb->AddPage(p, "Center Tab 3");
CHECK( nb->GetBestSize() == wxSize(300, 200 + tabHeight) );
}
SECTION( "Horizontal split" )
{
p = new wxPanel(nb);
p->SetMinSize(wxSize(25, 0));
nb->AddPage(p, "Left Pane");
nb->Split(nb->GetPageCount()-1, wxLEFT);
CHECK( nb->GetBestSize() == wxSize(125, 100 + tabHeight) );
p = new wxPanel(nb);
p->SetMinSize(wxSize(50, 0));
nb->AddPage(p, "Right Pane 1");
nb->Split(nb->GetPageCount()-1, wxRIGHT);
CHECK( nb->GetBestSize() == wxSize(175, 100 + tabHeight) );
p = new wxPanel(nb);
p->SetMinSize(wxSize(100, 0));
nb->AddPage(p, "Right Pane 2");
nb->Split(nb->GetPageCount()-1, wxRIGHT);
CHECK( nb->GetBestSize() == wxSize(275, 100 + tabHeight) );
}
SECTION( "Vertical split" )
{
p = new wxPanel(nb);
p->SetMinSize(wxSize(0, 100));
nb->AddPage(p, "Top Pane 1");
nb->Split(nb->GetPageCount()-1, wxTOP);
p = new wxPanel(nb);
p->SetMinSize(wxSize(0, 50));
nb->AddPage(p, "Top Pane 2");
nb->Split(nb->GetPageCount()-1, wxTOP);
CHECK( nb->GetBestSize() == wxSize(100, 250 + 3*tabHeight) );
p = new wxPanel(nb);
p->SetMinSize(wxSize(0, 25));
nb->AddPage(p, "Bottom Pane");
nb->Split(nb->GetPageCount()-1, wxBOTTOM);
CHECK( nb->GetBestSize() == wxSize(100, 275 + 4*tabHeight) );
}
SECTION( "Surrounding panes" )
{
p = new wxPanel(nb);
p->SetMinSize(wxSize(50, 25));
nb->AddPage(p, "Bottom Pane");
nb->Split(nb->GetPageCount()-1, wxBOTTOM);
p = new wxPanel(nb);
p->SetMinSize(wxSize(50, 120));
nb->AddPage(p, "Right Pane");
nb->Split(nb->GetPageCount()-1, wxRIGHT);
p = new wxPanel(nb);
p->SetMinSize(wxSize(225, 50));
nb->AddPage(p, "Top Pane");
nb->Split(nb->GetPageCount()-1, wxTOP);
p = new wxPanel(nb);
p->SetMinSize(wxSize(25, 105));
nb->AddPage(p, "Left Pane");
nb->Split(nb->GetPageCount()-1, wxLEFT);
CHECK( nb->GetBestSize() == wxSize(250, 175 + 3*tabHeight) );
}
}
#endif

View File

@@ -10,9 +10,6 @@
#if wxUSE_BITMAPCOMBOBOX
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -24,9 +21,6 @@
#include "itemcontainertest.h"
#include "asserthelper.h"
//Test only if we are based off of wxComboBox
#ifndef wxGENERIC_BITMAPCOMBOBOX
class BitmapComboBoxTestCase : public TextEntryTestCase,
public ItemContainerTestCase,
public CppUnit::TestCase
@@ -59,30 +53,13 @@ private:
void Bitmap();
#if defined(__WXGTK__) && wxUSE_UIACTIONSIMULATOR
virtual void SimSelect() wxOVERRIDE
{
// There is an inexplicable and locally irreproducible failure in this
// test for wxBitmapComboBox when it runs on the Linux buildbot slaves:
// wxUIActionSimulator::Select() fails there for some reason, so skip
// the test. If you ever manage to reproduce this locally, please try
// to debug it to understand what goes on!
if ( !IsAutomaticTest() )
ItemContainerTestCase::SimSelect();
}
#endif // __WXGTK__
wxBitmapComboBox *m_combo;
wxDECLARE_NO_COPY_CLASS(BitmapComboBoxTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( BitmapComboBoxTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( BitmapComboBoxTestCase,
"BitmapComboBoxTestCase" );
wxREGISTER_UNIT_TEST_WITH_TAGS(BitmapComboBoxTestCase,
"[BitmapComboBoxTestCase][item-container]");
void BitmapComboBoxTestCase::setUp()
{
@@ -99,9 +76,9 @@ void BitmapComboBoxTestCase::Bitmap()
wxArrayString items;
items.push_back("item 0");
items.push_back("item 1");
//We need this otherwise MSVC complains as it cannot find a suitable append
static_cast<wxComboBox*>(m_combo)->Append(items);
// TODO: Add wxBitmapComboBoxBase::Append(wxArrayString )
for( unsigned int i = 0; i < items.size(); ++i )
m_combo->Append(items[i]);
CPPUNIT_ASSERT(!m_combo->GetItemBitmap(0).IsOk());
@@ -121,8 +98,10 @@ void BitmapComboBoxTestCase::Bitmap()
CPPUNIT_ASSERT(m_combo->GetItemBitmap(0).IsOk());
CPPUNIT_ASSERT_EQUAL(wxSize(16, 16), m_combo->GetBitmapSize());
m_combo->SetSelection( 1 );
CPPUNIT_ASSERT_EQUAL( m_combo->GetStringSelection(), "item with bitmap" );
}
#endif //wxGENERIC_BITMAPCOMBOBOX
#endif //wxUSE_BITMAPCOMBOBOX

View File

@@ -10,9 +10,6 @@
#if wxUSE_TOGGLEBTN
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/tglbtn.h"
@@ -88,7 +85,10 @@ void BitmapToggleButtonTestCase::Click()
CPPUNIT_ASSERT(m_button->GetValue());
clicked.Clear();
#ifdef __WXMSW__
wxMilliSleep(1000);
#endif
sim.MouseClick();
wxYield();

View File

@@ -8,6 +8,8 @@
#include "testprec.h"
#if wxUSE_BOOKCTRL
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/panel.h"
@@ -163,3 +165,5 @@ void BookCtrlBaseTestCase::Image()
CPPUNIT_ASSERT_EQUAL(2, base->GetPageImage(2));
}
#endif

View File

@@ -10,9 +10,6 @@
#if wxUSE_BUTTON
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -98,12 +95,25 @@ void ButtonTestCase::Click()
void ButtonTestCase::Disabled()
{
EventCounter clicked(m_button, wxEVT_BUTTON);
wxUIActionSimulator sim;
//In this test we disable the button and check events are not sent
m_button->Disable();
// In this test we disable the button and check events are not sent and we
// do it once by disabling the previously enabled button and once by
// creating the button in the disabled state.
SECTION("Disable after creation")
{
m_button->Disable();
}
SECTION("Create disabled")
{
delete m_button;
m_button = new wxButton();
m_button->Disable();
m_button->Create(wxTheApp->GetTopWindow(), wxID_ANY, "wxButton");
}
EventCounter clicked(m_button, wxEVT_BUTTON);
sim.MouseMove(m_button->GetScreenPosition() + wxPoint(10, 10));
wxYield();
@@ -163,12 +173,17 @@ void ButtonTestCase::Bitmap()
//We start with no bitmaps
CPPUNIT_ASSERT(!m_button->GetBitmap().IsOk());
// Some bitmap, doesn't really matter which.
const wxBitmap bmp = wxArtProvider::GetBitmap(wxART_INFORMATION);
m_button->SetBitmap(wxArtProvider::GetIcon(wxART_INFORMATION,
wxART_OTHER,
wxSize(32, 32)));
m_button->SetBitmap(bmp);
CPPUNIT_ASSERT(m_button->GetBitmap().IsOk());
// Check that resetting the button label doesn't result in problems when
// updating the bitmap later, as it used to be the case in wxGTK (#18898).
m_button->SetLabel(wxString());
CHECK_NOTHROW( m_button->Disable() );
}
#endif //wxUSE_BUTTON

View File

@@ -10,9 +10,6 @@
#if wxUSE_CHECKBOX
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -53,6 +50,7 @@ private:
// any meaning otherwise.
bool CreateCheckBox(long style)
{
wxDELETE( m_check );
m_check = new wxCheckBox(wxTheApp->GetTopWindow(), wxID_ANY, "Check box",
wxDefaultPosition, wxDefaultSize, style);
return false;
@@ -110,7 +108,6 @@ void CheckBoxTestCase::Check()
#ifdef wxHAS_3STATE_CHECKBOX
void CheckBoxTestCase::ThirdState()
{
wxDELETE(m_check);
CreateCheckBox(wxCHK_3STATE);
CPPUNIT_ASSERT_EQUAL(wxCHK_UNCHECKED, m_check->Get3StateValue());
@@ -128,7 +125,6 @@ void CheckBoxTestCase::ThirdState()
void CheckBoxTestCase::ThirdStateUser()
{
wxDELETE(m_check);
CreateCheckBox(wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER);
CPPUNIT_ASSERT_EQUAL(wxCHK_UNCHECKED, m_check->Get3StateValue());
@@ -147,14 +143,12 @@ void CheckBoxTestCase::ThirdStateUser()
void CheckBoxTestCase::InvalidStyles()
{
// Check that using incompatible styles doesn't work.
wxDELETE( m_check );
WX_ASSERT_FAILS_WITH_ASSERT( CreateCheckBox(wxCHK_2STATE | wxCHK_3STATE) );
#if !wxDEBUG_LEVEL
CPPUNIT_ASSERT( !m_check->Is3State() );
CPPUNIT_ASSERT( !m_check->Is3rdStateAllowedForUser() );
#endif
wxDELETE( m_check );
WX_ASSERT_FAILS_WITH_ASSERT(
CreateCheckBox(wxCHK_2STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER) );
#if !wxDEBUG_LEVEL
@@ -163,7 +157,6 @@ void CheckBoxTestCase::InvalidStyles()
#endif
// wxCHK_ALLOW_3RD_STATE_FOR_USER without wxCHK_3STATE doesn't work.
wxDELETE( m_check );
WX_ASSERT_FAILS_WITH_ASSERT( CreateCheckBox(wxCHK_ALLOW_3RD_STATE_FOR_USER) );
}

View File

@@ -10,9 +10,6 @@
#if wxUSE_CHECKLISTBOX
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -46,11 +43,8 @@ private:
wxDECLARE_NO_COPY_CLASS(CheckListBoxTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( CheckListBoxTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( CheckListBoxTestCase, "CheckListBoxTestCase" );
wxREGISTER_UNIT_TEST_WITH_TAGS(CheckListBoxTestCase,
"[CheckListBoxTestCase][item-container]");
void CheckListBoxTestCase::setUp()
{

View File

@@ -10,9 +10,6 @@
#if wxUSE_CHOICEBOOK
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"

View File

@@ -10,9 +10,6 @@
#if wxUSE_CHOICE
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -36,20 +33,19 @@ private:
CPPUNIT_TEST_SUITE( ChoiceTestCase );
wxITEM_CONTAINER_TESTS();
CPPUNIT_TEST( Sort );
CPPUNIT_TEST( GetBestSize );
CPPUNIT_TEST_SUITE_END();
void Sort();
void GetBestSize();
wxChoice* m_choice;
wxDECLARE_NO_COPY_CLASS(ChoiceTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( ChoiceTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ChoiceTestCase, "ChoiceTestCase" );
wxREGISTER_UNIT_TEST_WITH_TAGS(ChoiceTestCase,
"[ChoiceTestCase][item-container]");
void ChoiceTestCase::setUp()
{
@@ -92,4 +88,33 @@ void ChoiceTestCase::Sort()
#endif
}
void ChoiceTestCase::GetBestSize()
{
wxArrayString testitems;
testitems.Add("1");
testitems.Add("11");
m_choice->Append(testitems);
SECTION("Normal best size")
{
// nothing to do here
}
// Ensure that the hidden control return a valid best size too.
SECTION("Hidden best size")
{
m_choice->Hide();
}
wxYield();
m_choice->InvalidateBestSize();
const wxSize bestSize = m_choice->GetBestSize();
CHECK(bestSize.GetWidth() > m_choice->FromDIP(30));
CHECK(bestSize.GetWidth() < m_choice->FromDIP(120));
CHECK(bestSize.GetHeight() > m_choice->FromDIP(15));
CHECK(bestSize.GetHeight() < m_choice->FromDIP(35));
}
#endif //wxUSE_CHOICE

View File

@@ -14,9 +14,6 @@
#if wxUSE_COMBOBOX
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -88,11 +85,8 @@ private:
wxDECLARE_NO_COPY_CLASS(ComboBoxTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( ComboBoxTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ComboBoxTestCase, "ComboBoxTestCase" );
wxREGISTER_UNIT_TEST_WITH_TAGS(ComboBoxTestCase,
"[ComboBoxTestCase][item-container]");
// ----------------------------------------------------------------------------
// test initialization
@@ -153,8 +147,9 @@ void ComboBoxTestCase::PopDismiss()
// Under wxGTK2, the event is sent only during idle time and not
// immediately, so we need this yield to get it.
wxYield();
CPPUNIT_ASSERT_EQUAL(1, close.GetCount());
#endif // wxGTK2
CPPUNIT_ASSERT_EQUAL(1, close.GetCount());
#endif
}
@@ -234,4 +229,23 @@ void ComboBoxTestCase::IsEmpty()
#endif
}
TEST_CASE("wxComboBox::ProcessEnter", "[wxComboBox][enter]")
{
class ComboBoxCreator : public TextLikeControlCreator
{
public:
virtual wxControl* Create(wxWindow* parent, int style) const wxOVERRIDE
{
const wxString choices[] = { "foo", "bar", "baz" };
return new wxComboBox(parent, wxID_ANY, wxString(),
wxDefaultPosition, wxDefaultSize,
WXSIZEOF(choices), choices,
style);
}
};
TestProcessEnter(ComboBoxCreator());
}
#endif //wxUSE_COMBOBOX

View File

@@ -14,12 +14,12 @@
#if wxUSE_DATAVIEWCTRL
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/app.h"
#include "wx/dataview.h"
#ifdef __WXGTK__
#include "wx/stopwatch.h"
#endif // __WXGTK__
#include "testableframe.h"
#include "asserthelper.h"
@@ -67,6 +67,27 @@ public:
}
};
class MultiColumnsDataViewCtrlTestCase
{
public:
MultiColumnsDataViewCtrlTestCase();
~MultiColumnsDataViewCtrlTestCase();
protected:
// the dataview control itself
wxDataViewListCtrl *m_dvc;
// constants
const wxSize m_size;
const int m_firstColumnWidth;
// and the columns
wxDataViewColumn* m_firstColumn;
wxDataViewColumn* m_lastColumn;
wxDECLARE_NO_COPY_CLASS(MultiColumnsDataViewCtrlTestCase);
};
// ----------------------------------------------------------------------------
// test initialization
// ----------------------------------------------------------------------------
@@ -95,10 +116,57 @@ DataViewCtrlTestCase::~DataViewCtrlTestCase()
delete m_dvc;
}
MultiColumnsDataViewCtrlTestCase::MultiColumnsDataViewCtrlTestCase()
: m_size(200, 100),
m_firstColumnWidth(50)
{
m_dvc = new wxDataViewListCtrl(wxTheApp->GetTopWindow(), wxID_ANY);
m_firstColumn =
m_dvc->AppendTextColumn(wxString(), wxDATAVIEW_CELL_INERT, m_firstColumnWidth);
m_lastColumn =
m_dvc->AppendTextColumn(wxString(), wxDATAVIEW_CELL_INERT);
// Set size after columns appending to extend size of the last column.
m_dvc->SetSize(m_size);
m_dvc->Layout();
m_dvc->Refresh();
m_dvc->Update();
}
MultiColumnsDataViewCtrlTestCase::~MultiColumnsDataViewCtrlTestCase()
{
delete m_dvc;
}
// ----------------------------------------------------------------------------
// the tests themselves
// ----------------------------------------------------------------------------
TEST_CASE_METHOD(MultiSelectDataViewCtrlTestCase,
"wxDVC::Selection",
"[wxDataViewCtrl][select]")
{
// Check selection round-trip.
wxDataViewItemArray sel;
sel.push_back(m_child1);
sel.push_back(m_grandchild);
REQUIRE_NOTHROW( m_dvc->SetSelections(sel) );
wxDataViewItemArray sel2;
CHECK( m_dvc->GetSelections(sel2) == static_cast<int>(sel.size()) );
CHECK( sel2 == sel );
// Invalid items in GetSelections() input are supposed to be just skipped.
sel.clear();
sel.push_back(wxDataViewItem());
REQUIRE_NOTHROW( m_dvc->SetSelections(sel) );
CHECK( m_dvc->GetSelections(sel2) == 0 );
CHECK( sel2.empty() );
}
TEST_CASE_METHOD(MultiSelectDataViewCtrlTestCase,
"wxDVC::DeleteSelected",
"[wxDataViewCtrl][delete]")
@@ -203,6 +271,19 @@ TEST_CASE_METHOD(SingleSelectDataViewCtrlTestCase,
CHECK( !m_dvc->IsExpanded(m_grandchild) );
#endif
CHECK( !m_dvc->IsExpanded(m_child2) );
m_dvc->Collapse(m_root);
CHECK( !m_dvc->IsExpanded(m_root) );
m_dvc->ExpandChildren(m_root);
CHECK( m_dvc->IsExpanded(m_root) );
CHECK( m_dvc->IsExpanded(m_child1) );
// Expanding an already expanded node must still expand all its children.
m_dvc->Collapse(m_child1);
CHECK( !m_dvc->IsExpanded(m_child1) );
m_dvc->ExpandChildren(m_root);
CHECK( m_dvc->IsExpanded(m_child1) );
}
TEST_CASE_METHOD(SingleSelectDataViewCtrlTestCase,
@@ -229,6 +310,12 @@ TEST_CASE_METHOD(SingleSelectDataViewCtrlTestCase,
CHECK( rect1.y < rect2.y );
}
// This forces generic implementation to add m_grandchild to the tree, as
// it does it only on demand. We want the item to really be there to check
// that GetItemRect() returns an empty rectangle for collapsed items.
m_dvc->Expand(m_child1);
m_dvc->Collapse(m_child1);
const wxRect rectNotShown = m_dvc->GetItemRect(m_grandchild);
CHECK( rectNotShown == wxRect() );
@@ -262,4 +349,49 @@ TEST_CASE_METHOD(SingleSelectDataViewCtrlTestCase,
CHECK( rectRoot == wxRect() );
}
TEST_CASE_METHOD(SingleSelectDataViewCtrlTestCase,
"wxDVC::DeleteAllItems",
"[wxDataViewCtrl][delete]")
{
// The invalid item corresponds to the root of tree store model, so it
// should have a single item (our m_root) initially.
CHECK( m_dvc->GetChildCount(wxDataViewItem()) == 1 );
m_dvc->DeleteAllItems();
// And none at all after deleting all the items.
CHECK( m_dvc->GetChildCount(wxDataViewItem()) == 0 );
}
TEST_CASE_METHOD(MultiColumnsDataViewCtrlTestCase,
"wxDVC::AppendTextColumn",
"[wxDataViewCtrl][column]")
{
#ifdef __WXGTK__
// Wait for the list control to be realized.
wxStopWatch sw;
while ( m_firstColumn->GetWidth() == 0 )
{
if ( sw.Time() > 500 )
{
WARN("Timed out waiting for wxDataViewListCtrl to be realized");
break;
}
wxYield();
}
#endif
// Check the width of the first column.
CHECK( m_firstColumn->GetWidth() == m_firstColumnWidth );
// Check that the last column was extended to fit client area.
const int lastColumnMaxWidth =
m_dvc->GetClientSize().GetWidth() - m_firstColumnWidth;
// In GTK and under Mac the width of the last column is less then
// a remaining client area.
const int lastColumnMinWidth = lastColumnMaxWidth - 10;
CHECK( m_lastColumn->GetWidth() <= lastColumnMaxWidth );
CHECK( m_lastColumn->GetWidth() >= lastColumnMinWidth );
}
#endif //wxUSE_DATAVIEWCTRL

View File

@@ -10,9 +10,6 @@
#if wxUSE_DATEPICKCTRL
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -85,8 +82,13 @@ void DatePickerCtrlTestCase::Range()
// minimum as it doesn't support dates before 1601-01-01, hence don't rely
// on GetRange() returning false.
wxDateTime dtRangeStart, dtRangeEnd;
// Default end date for QT is 31/12/7999 which is considered valid,
// therefore we should omit this assertion for QT
#ifndef __WXQT__
m_datepicker->GetRange(&dtRangeStart, &dtRangeEnd);
CPPUNIT_ASSERT( !dtRangeEnd.IsValid() );
#endif
// After we set it we should be able to get it back.
const wxDateTime

View File

@@ -8,9 +8,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/testing.h"
@@ -34,7 +31,9 @@ private:
#if !defined (__WXX11__)
CPPUNIT_TEST( MessageDialog );
#endif
#if wxUSE_FILEDLG
CPPUNIT_TEST( FileDialog );
#endif
CPPUNIT_TEST( CustomDialog );
CPPUNIT_TEST( InitDialog );
CPPUNIT_TEST_SUITE_END();
@@ -57,16 +56,24 @@ void ModalDialogsTestCase::MessageDialog()
{
int rc;
#if wxUSE_FILEDLG
#define FILE_DIALOG_TEST ,\
wxExpectModal<wxFileDialog>(wxGetCwd() + "/test.txt").Optional()
#else
#define FILE_DIALOG_TEST
#endif
wxTEST_DIALOG
(
rc = wxMessageBox("Should I fail?", "Question", wxYES|wxNO),
wxExpectModal<wxMessageDialog>(wxNO),
wxExpectModal<wxFileDialog>(wxGetCwd() + "/test.txt").Optional()
wxExpectModal<wxMessageDialog>(wxNO)
FILE_DIALOG_TEST
);
CPPUNIT_ASSERT_EQUAL(wxNO, rc);
}
#if wxUSE_FILEDLG
void ModalDialogsTestCase::FileDialog()
{
wxFileDialog dlg(NULL);
@@ -89,7 +96,7 @@ void ModalDialogsTestCase::FileDialog()
wxYield();
#endif
}
#endif
class MyDialog : public wxDialog
{

View File

@@ -8,9 +8,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"

View File

@@ -10,9 +10,6 @@
#if wxUSE_GAUGE
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"

File diff suppressed because it is too large Load Diff

View File

@@ -12,9 +12,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"

View File

@@ -10,9 +10,6 @@
#if wxUSE_HTML
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -43,11 +40,8 @@ private:
wxDECLARE_NO_COPY_CLASS(HtmlListBoxTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( HtmlListBoxTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( HtmlListBoxTestCase, "HtmlListBoxTestCase" );
wxREGISTER_UNIT_TEST_WITH_TAGS(HtmlListBoxTestCase,
"[HtmlListBoxTestCase][item-container]");
void HtmlListBoxTestCase::setUp()
{

View File

@@ -10,9 +10,6 @@
#if wxUSE_HYPERLINKCTRL
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -92,7 +89,7 @@ void HyperlinkCtrlTestCase::Url()
void HyperlinkCtrlTestCase::Click()
{
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
#if wxUSE_UIACTIONSIMULATOR
EventCounter hyperlink(m_hyperlink, wxEVT_HYPERLINK);
wxUIActionSimulator sim;

View File

@@ -270,6 +270,33 @@ void ItemContainerTestCase::SetString()
#endif
}
void ItemContainerTestCase::SelectionAfterDelete()
{
wxItemContainer * const container = GetContainer();
container->Append("item 0");
container->Append("item 1");
container->Append("item 2");
container->Append("item 3");
container->SetSelection(1);
CHECK( container->GetSelection() == 1 );
container->Delete(3);
CHECK( container->GetSelection() == 1 );
container->Delete(1);
CHECK( container->GetSelection() == wxNOT_FOUND );
container->SetSelection(1);
container->Delete(1);
CHECK( container->GetSelection() == wxNOT_FOUND );
container->SetSelection(0);
container->Delete(0);
CHECK( container->GetSelection() == wxNOT_FOUND );
}
void ItemContainerTestCase::SetSelection()
{
wxItemContainer * const container = GetContainer();

View File

@@ -24,7 +24,7 @@ protected:
// and this one must be overridden to return the window which implements
// wxItemContainer interface -- usually it will return the same pointer as
// GetTestEntry(), just as a different type
// GetContainer(), just as a different type
virtual wxWindow *GetContainerWindow() const = 0;
// this should be inserted in the derived class CPPUNIT_TEST_SUITE
@@ -40,6 +40,7 @@ protected:
CPPUNIT_TEST( Set ); \
CPPUNIT_TEST( SetSelection ); \
CPPUNIT_TEST( SetString ); \
CPPUNIT_TEST( SelectionAfterDelete ); \
WXUISIM_TEST( SimSelect );
void Append();
@@ -52,6 +53,7 @@ protected:
void Set();
void SetSelection();
void SetString();
void SelectionAfterDelete();
#if wxUSE_UIACTIONSIMULATOR
virtual void SimSelect();
#endif

View File

@@ -12,184 +12,125 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
#endif // WX_PRECOMP
#include "wx/control.h"
#include "wx/stattext.h"
#include "wx/checkbox.h"
#include "wx/control.h"
#include "wx/scopedptr.h"
#include "wx/stattext.h"
// ----------------------------------------------------------------------------
// test class
// ----------------------------------------------------------------------------
#include "wx/generic/stattextg.h"
class LabelTestCase : public CppUnit::TestCase
namespace
{
public:
LabelTestCase() { }
virtual void setUp() wxOVERRIDE;
virtual void tearDown() wxOVERRIDE;
const char* const ORIGINAL_LABEL = "origin label";
private:
CPPUNIT_TEST_SUITE( LabelTestCase );
CPPUNIT_TEST( GetLabel );
CPPUNIT_TEST( GetLabelText );
CPPUNIT_TEST( Statics );
CPPUNIT_TEST_SUITE_END();
void GetLabel();
void GetLabelText();
void Statics();
wxStaticText *m_st;
// we cannot test wxControl directly (it's abstract) so we rather test wxCheckBox
wxCheckBox *m_cb;
wxDECLARE_NO_COPY_CLASS(LabelTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( LabelTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( LabelTestCase, "LabelTestCase" );
// ----------------------------------------------------------------------------
// test initialization
// ----------------------------------------------------------------------------
#define ORIGINAL_LABEL "original label"
void LabelTestCase::setUp()
// The actual testing function. It will change the label of the provided
// control, which is assumed to be ORIGINAL_LABEL initially.
void DoTestLabel(wxControl* c)
{
m_st = new wxStaticText(wxTheApp->GetTopWindow(), wxID_ANY, ORIGINAL_LABEL);
CHECK( c->GetLabel() == ORIGINAL_LABEL );
m_cb = new wxCheckBox(wxTheApp->GetTopWindow(), wxID_ANY, ORIGINAL_LABEL);
CPPUNIT_ASSERT_EQUAL( ORIGINAL_LABEL, m_st->GetLabel() );
CPPUNIT_ASSERT_EQUAL( ORIGINAL_LABEL, m_cb->GetLabel() );
}
void LabelTestCase::tearDown()
{
wxDELETE(m_st);
wxDELETE(m_cb);
}
// ----------------------------------------------------------------------------
// the tests themselves
// ----------------------------------------------------------------------------
#define SET_LABEL(str) \
m_st->SetLabel(str); \
m_cb->SetLabel(str);
#define SET_LABEL_TEXT(str) \
m_st->SetLabelText(str); \
m_cb->SetLabelText(str);
void LabelTestCase::GetLabel()
{
const wxString testLabelArray[] = {
"label without mnemonics and markup",
"label with &mnemonic",
"label with <span foreground='blue'>some</span> <b>markup</b>",
"label with <span foreground='blue'>some</span> <b>markup</b> and &mnemonic",
"label with an && (ampersand)",
"label with an && (&ampersand)",
"", // empty label should work too
};
// test calls to SetLabel() and then to GetLabel()
for ( unsigned int s = 0; s < WXSIZEOF(testLabelArray); s++ )
{
SET_LABEL(testLabelArray[s]);
const wxString& l = testLabelArray[s];
// GetLabel() should always return the string passed to SetLabel()
CPPUNIT_ASSERT_EQUAL( testLabelArray[s], m_st->GetLabel() );
CPPUNIT_ASSERT_EQUAL( testLabelArray[s], m_cb->GetLabel() );
}
c->SetLabel(l);
CHECK( c->GetLabel() == l );
// test calls to SetLabelText() and then to GetLabel()
const wxString& testLabel = "label without mnemonics and markup";
SET_LABEL_TEXT(testLabel);
CPPUNIT_ASSERT_EQUAL( testLabel, m_st->GetLabel() );
CPPUNIT_ASSERT_EQUAL( testLabel, m_cb->GetLabel() );
const wxString& testLabel2 = "label with &mnemonic";
const wxString& testLabelText2 = "label with &&mnemonic";
SET_LABEL_TEXT(testLabel2);
CPPUNIT_ASSERT_EQUAL( testLabelText2, m_st->GetLabel() );
CPPUNIT_ASSERT_EQUAL( testLabelText2, m_cb->GetLabel() );
const wxString& testLabel3 = "label with <span foreground='blue'>some</span> <b>markup</b>";
SET_LABEL_TEXT(testLabel3);
CPPUNIT_ASSERT_EQUAL( testLabel3, m_st->GetLabel() );
CPPUNIT_ASSERT_EQUAL( testLabel3, m_cb->GetLabel() );
const wxString& testLabel4 = "label with <span foreground='blue'>some</span> <b>markup</b> and &mnemonic";
const wxString& testLabelText4 = "label with <span foreground='blue'>some</span> <b>markup</b> and &&mnemonic";
SET_LABEL_TEXT(testLabel4);
CPPUNIT_ASSERT_EQUAL( testLabelText4, m_st->GetLabel() );
CPPUNIT_ASSERT_EQUAL( testLabelText4, m_cb->GetLabel() );
}
void LabelTestCase::GetLabelText()
{
// test calls to SetLabel() and then to GetLabelText()
const wxString& testLabel = "label without mnemonics and markup";
SET_LABEL(testLabel);
CPPUNIT_ASSERT_EQUAL( testLabel, m_st->GetLabelText() );
CPPUNIT_ASSERT_EQUAL( testLabel, m_cb->GetLabelText() );
const wxString& testLabel2 = "label with &mnemonic";
const wxString& testLabelText2 = "label with mnemonic";
SET_LABEL(testLabel2);
CPPUNIT_ASSERT_EQUAL( testLabelText2, m_st->GetLabelText() );
CPPUNIT_ASSERT_EQUAL( testLabelText2, m_cb->GetLabelText() );
const wxString& testLabel3 = "label with <span foreground='blue'>some</span> <b>markup</b>";
SET_LABEL(testLabel3);
CPPUNIT_ASSERT_EQUAL( testLabel3, m_st->GetLabelText() );
CPPUNIT_ASSERT_EQUAL( testLabel3, m_cb->GetLabelText() );
const wxString& testLabel4 = "label with <span foreground='blue'>some</span> <b>markup</b> and &mnemonic";
const wxString& testLabelText4 = "label with <span foreground='blue'>some</span> <b>markup</b> and mnemonic";
SET_LABEL(testLabel4);
CPPUNIT_ASSERT_EQUAL( testLabelText4, m_st->GetLabelText() );
CPPUNIT_ASSERT_EQUAL( testLabelText4, m_cb->GetLabelText() );
const wxString testLabelArray[] = {
"label without mnemonics and markup",
"label with &mnemonic",
"label with <span foreground='blue'>some</span> <b>markup</b>",
"label with <span foreground='blue'>some</span> <b>markup</b> and &mnemonic",
};
// test calls to SetLabelText() and then to GetLabelText()
for ( unsigned int s = 0; s < WXSIZEOF(testLabelArray); s++ )
{
SET_LABEL_TEXT(testLabelArray[s]);
// GetLabelText() should always return unescaped version of the label
CHECK( c->GetLabelText() == wxControl::RemoveMnemonics(l) );
// GetLabelText() should always return the string passed to SetLabelText()
CPPUNIT_ASSERT_EQUAL( testLabelArray[s], m_st->GetLabelText() );
CPPUNIT_ASSERT_EQUAL( testLabelArray[s], m_cb->GetLabelText() );
c->SetLabelText(l);
CHECK( c->GetLabelText() == l );
// And GetLabel() should be the escaped version of the text
CHECK( l == wxControl::RemoveMnemonics(c->GetLabel()) );
}
// Check that both "&" and "&amp;" work in markup.
#if wxUSE_MARKUP
c->SetLabelMarkup("mnemonic in &amp;markup");
CHECK( c->GetLabel() == "mnemonic in &markup" );
CHECK( c->GetLabelText() == "mnemonic in markup" );
c->SetLabelMarkup("mnemonic in &markup");
CHECK( c->GetLabel() == "mnemonic in &markup" );
CHECK( c->GetLabelText() == "mnemonic in markup" );
c->SetLabelMarkup("&amp;&amp; finally");
CHECK( c->GetLabel() == "&& finally" );
CHECK( c->GetLabelText() == "& finally" );
c->SetLabelMarkup("&& finally");
CHECK( c->GetLabel() == "&& finally" );
CHECK( c->GetLabelText() == "& finally" );
#endif // wxUSE_MARKUP
}
} // anonymous namespace
TEST_CASE("wxControl::Label", "[wxControl][label]")
{
SECTION("wxStaticText")
{
const wxScopedPtr<wxStaticText>
st(new wxStaticText(wxTheApp->GetTopWindow(), wxID_ANY, ORIGINAL_LABEL));
DoTestLabel(st.get());
}
SECTION("wxStaticText/ellipsized")
{
const wxScopedPtr<wxStaticText>
st(new wxStaticText(wxTheApp->GetTopWindow(), wxID_ANY, ORIGINAL_LABEL,
wxDefaultPosition, wxDefaultSize,
wxST_ELLIPSIZE_START));
DoTestLabel(st.get());
}
SECTION("wxGenericStaticText")
{
const wxScopedPtr<wxGenericStaticText>
gst(new wxGenericStaticText(wxTheApp->GetTopWindow(), wxID_ANY, ORIGINAL_LABEL));
DoTestLabel(gst.get());
}
SECTION("wxCheckBox")
{
const wxScopedPtr<wxCheckBox>
cb(new wxCheckBox(wxTheApp->GetTopWindow(), wxID_ANY, ORIGINAL_LABEL));
DoTestLabel(cb.get());
}
}
void LabelTestCase::Statics()
TEST_CASE("wxControl::RemoveMnemonics", "[wxControl][label][mnemonics]")
{
CPPUNIT_ASSERT_EQUAL( "mnemonic", wxControl::RemoveMnemonics("&mnemonic") );
CPPUNIT_ASSERT_EQUAL( "&mnemonic", wxControl::RemoveMnemonics("&&mnemonic") );
CPPUNIT_ASSERT_EQUAL( "&mnemonic", wxControl::RemoveMnemonics("&&&mnemonic") );
CHECK( "mnemonic" == wxControl::RemoveMnemonics("&mnemonic") );
CHECK( "&mnemonic" == wxControl::RemoveMnemonics("&&mnemonic") );
CHECK( "&mnemonic" == wxControl::RemoveMnemonics("&&&mnemonic") );
}
TEST_CASE("wxControl::FindAccelIndex", "[wxControl][label][mnemonics]")
{
CHECK( wxControl::FindAccelIndex("foo") == wxNOT_FOUND );
CHECK( wxControl::FindAccelIndex("&foo") == 0 );
CHECK( wxControl::FindAccelIndex("f&oo") == 1 );
CHECK( wxControl::FindAccelIndex("foo && bar") == wxNOT_FOUND );
CHECK( wxControl::FindAccelIndex("foo && &bar") == 6 );
}

View File

@@ -11,9 +11,6 @@
#if wxUSE_LISTCTRL
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -26,6 +23,7 @@
#include "wx/uiaction.h"
#include "wx/imaglist.h"
#include "wx/artprov.h"
#include "wx/stopwatch.h"
void ListBaseTestCase::ColumnsOrder()
{
@@ -177,6 +175,123 @@ void ListBaseTestCase::ChangeMode()
CPPUNIT_ASSERT_EQUAL( "First", list->GetItemText(0) );
}
#ifdef __WXGTK__
#define wxGTK_TIMED_YIELD(t) \
if ( !IsRunningUnderXVFB() ) \
for ( wxStopWatch sw; sw.Time() < t; ) wxYield()
#else // !__WXGTK__
#define wxGTK_TIMED_YIELD(t)
#endif // __WXGTK__
void ListBaseTestCase::MultiSelect()
{
#if wxUSE_UIACTIONSIMULATOR
#ifndef __WXMSW__
// FIXME: This test fails on Travis CI although works fine on
// development machine, no idea why though!
if ( IsAutomaticTest() )
return;
#endif // !__WXMSW__
wxListCtrl* const list = GetList();
EventCounter focused(list, wxEVT_LIST_ITEM_FOCUSED);
EventCounter selected(list, wxEVT_LIST_ITEM_SELECTED);
EventCounter deselected(list, wxEVT_LIST_ITEM_DESELECTED);
list->InsertColumn(0, "Header");
for ( int i = 0; i < 10; ++i )
list->InsertItem(i, wxString::Format("Item %d", i));
wxUIActionSimulator sim;
wxRect pos;
list->GetItemRect(2, pos); // Choose the third item as anchor
// We move in slightly so we are not on the edge
wxPoint point = list->ClientToScreen(pos.GetPosition()) + wxPoint(10, 10);
sim.MouseMove(point);
wxYield();
sim.MouseClick(); // select the anchor
wxYield();
wxGTK_TIMED_YIELD(50);
list->GetItemRect(5, pos);
point = list->ClientToScreen(pos.GetPosition()) + wxPoint(10, 10);
sim.MouseMove(point);
wxYield();
sim.KeyDown(WXK_SHIFT);
sim.MouseClick();
sim.KeyUp(WXK_SHIFT);
wxYield();
wxGTK_TIMED_YIELD(10);
// when the first item was selected the focus changes to it, but not
// on subsequent clicks
CPPUNIT_ASSERT_EQUAL(4, list->GetSelectedItemCount()); // item 2 to 5 (inclusive) are selected
CPPUNIT_ASSERT_EQUAL(2, focused.GetCount()); // count the focus which was on the anchor
CPPUNIT_ASSERT_EQUAL(4, selected.GetCount());
CPPUNIT_ASSERT_EQUAL(0, deselected.GetCount());
focused.Clear();
selected.Clear();
deselected.Clear();
sim.Char(WXK_END, wxMOD_SHIFT); // extend the selection to the last item
wxYield();
wxGTK_TIMED_YIELD(10);
CPPUNIT_ASSERT_EQUAL(8, list->GetSelectedItemCount()); // item 2 to 9 (inclusive) are selected
CPPUNIT_ASSERT_EQUAL(1, focused.GetCount()); // focus is on the last item
CPPUNIT_ASSERT_EQUAL(4, selected.GetCount()); // only newly selected items got the event
CPPUNIT_ASSERT_EQUAL(0, deselected.GetCount());
focused.Clear();
selected.Clear();
deselected.Clear();
sim.Char(WXK_HOME, wxMOD_SHIFT); // select from anchor to the first item
wxYield();
wxGTK_TIMED_YIELD(10);
CPPUNIT_ASSERT_EQUAL(3, list->GetSelectedItemCount()); // item 0 to 2 (inclusive) are selected
CPPUNIT_ASSERT_EQUAL(1, focused.GetCount()); // focus is on item 0
CPPUNIT_ASSERT_EQUAL(2, selected.GetCount()); // events are only generated for item 0 and 1
CPPUNIT_ASSERT_EQUAL(7, deselected.GetCount()); // item 2 (exclusive) to 9 are deselected
focused.Clear();
selected.Clear();
deselected.Clear();
list->EnsureVisible(0);
wxYield();
list->GetItemRect(2, pos);
point = list->ClientToScreen(pos.GetPosition()) + wxPoint(10, 10);
sim.MouseMove(point);
wxYield();
sim.MouseClick();
wxYield();
CPPUNIT_ASSERT_EQUAL(1, list->GetSelectedItemCount()); // anchor is the only selected item
CPPUNIT_ASSERT_EQUAL(1, focused.GetCount()); // because the focus changed from item 0 to anchor
CPPUNIT_ASSERT_EQUAL(0, selected.GetCount()); // anchor is already in selection state
CPPUNIT_ASSERT_EQUAL(2, deselected.GetCount()); // items 0 and 1 are deselected
#endif // wxUSE_UIACTIONSIMULATOR
}
void ListBaseTestCase::ItemClick()
{
#if wxUSE_UIACTIONSIMULATOR
@@ -203,6 +318,7 @@ void ListBaseTestCase::ItemClick()
EventCounter focused(list, wxEVT_LIST_ITEM_FOCUSED);
EventCounter activated(list, wxEVT_LIST_ITEM_ACTIVATED);
EventCounter rclick(list, wxEVT_LIST_ITEM_RIGHT_CLICK);
EventCounter deselected(list, wxEVT_LIST_ITEM_DESELECTED);
wxUIActionSimulator sim;
@@ -224,17 +340,20 @@ void ListBaseTestCase::ItemClick()
sim.MouseClick(wxMOUSE_BTN_RIGHT);
wxYield();
// We want a point within the listctrl but below any items
point = list->ClientToScreen(pos.GetPosition()) + wxPoint(10, 50);
sim.MouseMove(point);
wxYield();
sim.MouseClick();
wxYield();
// when the first item was selected the focus changes to it, but not
// on subsequent clicks
// FIXME: This test fail under wxGTK & wxOSX because we get 3 FOCUSED events and
// 2 SELECTED ones instead of the one of each we expect for some
// reason, this needs to be debugged as it may indicate a bug in the
// generic wxListCtrl implementation.
#ifndef _WX_GENERIC_LISTCTRL_H_
CPPUNIT_ASSERT_EQUAL(1, focused.GetCount());
CPPUNIT_ASSERT_EQUAL(1, selected.GetCount());
#endif
CPPUNIT_ASSERT_EQUAL(1, deselected.GetCount());
CPPUNIT_ASSERT_EQUAL(1, activated.GetCount());
CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
#endif // wxUSE_UIACTIONSIMULATOR
@@ -251,7 +370,7 @@ void ListBaseTestCase::KeyDown()
list->SetFocus();
wxYield();
sim.Text("aAbB");
sim.Text("aAbB"); // 4 letters + 2 shift mods.
wxYield();
CPPUNIT_ASSERT_EQUAL(6, keydown.GetCount());

View File

@@ -26,6 +26,7 @@ protected:
CPPUNIT_TEST( ChangeMode ); \
WXUISIM_TEST( ItemClick ); \
WXUISIM_TEST( KeyDown ); \
WXUISIM_TEST( MultiSelect ); \
CPPUNIT_TEST( DeleteItems ); \
CPPUNIT_TEST( InsertItem ); \
CPPUNIT_TEST( Find ); \
@@ -40,6 +41,7 @@ protected:
void ItemRect();
void ItemText();
void ChangeMode();
void MultiSelect();
void ItemClick();
void KeyDown();
void DeleteItems();

View File

@@ -10,9 +10,6 @@
#if wxUSE_LISTBOOK
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"

View File

@@ -10,9 +10,6 @@
#if wxUSE_LISTBOX
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -68,11 +65,8 @@ private:
wxDECLARE_NO_COPY_CLASS(ListBoxTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( ListBoxTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ListBoxTestCase, "ListBoxTestCase" );
wxREGISTER_UNIT_TEST_WITH_TAGS(ListBoxTestCase,
"[ListBoxTestCase][item-container]");
//initialise the static variable
bool ListBoxTestCase::ms_ownerdrawn = false;

View File

@@ -15,15 +15,14 @@
#if wxUSE_LISTCTRL
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
#endif // WX_PRECOMP
#include "wx/listctrl.h"
#include "wx/artprov.h"
#include "wx/imaglist.h"
#include "listbasetest.h"
#include "testableframe.h"
#include "wx/uiaction.h"
@@ -48,9 +47,11 @@ private:
CPPUNIT_TEST( EditLabel );
WXUISIM_TEST( ColumnClick );
WXUISIM_TEST( ColumnDrag );
CPPUNIT_TEST( SubitemRect );
CPPUNIT_TEST_SUITE_END();
void EditLabel();
void SubitemRect();
#if wxUSE_UIACTIONSIMULATOR
// Column events are only supported in wxListCtrl currently so we test them
// here rather than in ListBaseTest
@@ -93,6 +94,51 @@ void ListCtrlTestCase::EditLabel()
m_list->EditLabel(0);
}
void ListCtrlTestCase::SubitemRect()
{
wxBitmap bmp = wxArtProvider::GetBitmap(wxART_ERROR);
wxImageList* const iml = new wxImageList(bmp.GetWidth(), bmp.GetHeight());
iml->Add(bmp);
m_list->AssignImageList(iml, wxIMAGE_LIST_SMALL);
m_list->InsertColumn(0, "Column 0");
m_list->InsertColumn(1, "Column 1");
m_list->InsertColumn(2, "Column 2");
for ( int i = 0; i < 3; i++ )
{
long index = m_list->InsertItem(i, wxString::Format("This is item %d", i), 0);
m_list->SetItem(index, 1, wxString::Format("Column 1 item %d", i));
m_list->SetItem(index, 2, wxString::Format("Column 2 item %d", i));
}
wxRect rectLabel, rectIcon, rectItem;
// First check a subitem with an icon: it should have a valid icon
// rectangle and the label rectangle should be adjacent to it.
m_list->GetSubItemRect(1, 0, rectItem, wxLIST_RECT_BOUNDS);
m_list->GetSubItemRect(1, 0, rectIcon, wxLIST_RECT_ICON);
m_list->GetSubItemRect(1, 0, rectLabel, wxLIST_RECT_LABEL);
CHECK(!rectIcon.IsEmpty());
// Note that we can't use "==" here, in the native MSW version there is a
// gap between the item rectangle and the icon one.
CHECK(rectIcon.GetLeft() >= rectItem.GetLeft());
CHECK(rectLabel.GetLeft() == rectIcon.GetRight() + 1);
CHECK(rectLabel.GetRight() == rectItem.GetRight());
// For a subitem without an icon, label rectangle is the same one as the
// entire item one and the icon rectangle should be empty.
m_list->GetSubItemRect(1, 1, rectItem, wxLIST_RECT_BOUNDS);
m_list->GetSubItemRect(1, 1, rectIcon, wxLIST_RECT_ICON);
m_list->GetSubItemRect(1, 1, rectLabel, wxLIST_RECT_LABEL);
CHECK(rectIcon.IsEmpty());
// Here we can't check for exact equality neither as there can be a margin.
CHECK(rectLabel.GetLeft() >= rectItem.GetLeft());
CHECK(rectLabel.GetRight() == rectItem.GetRight());
}
#if wxUSE_UIACTIONSIMULATOR
void ListCtrlTestCase::ColumnDrag()
{

View File

@@ -8,9 +8,8 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_LISTCTRL
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -18,6 +17,7 @@
#include "wx/listctrl.h"
#include "listbasetest.h"
#include "testableframe.h"
class ListViewTestCase : public ListBaseTestCase, public CppUnit::TestCase
{
@@ -59,7 +59,8 @@ void ListViewTestCase::setUp()
void ListViewTestCase::tearDown()
{
wxDELETE(m_list);
DeleteTestWindow(m_list);
m_list = NULL;
}
void ListViewTestCase::Selection()
@@ -102,6 +103,8 @@ void ListViewTestCase::Selection()
void ListViewTestCase::Focus()
{
EventCounter focused(m_list, wxEVT_LIST_ITEM_FOCUSED);
m_list->InsertColumn(0, "Column 0");
m_list->InsertItem(0, "Item 0");
@@ -109,9 +112,13 @@ void ListViewTestCase::Focus()
m_list->InsertItem(2, "Item 2");
m_list->InsertItem(3, "Item 3");
CPPUNIT_ASSERT_EQUAL(0, focused.GetCount());
CPPUNIT_ASSERT_EQUAL(-1, m_list->GetFocusedItem());
m_list->Focus(0);
CPPUNIT_ASSERT_EQUAL(1, focused.GetCount());
CPPUNIT_ASSERT_EQUAL(0, m_list->GetFocusedItem());
}
#endif

View File

@@ -8,9 +8,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#endif // WX_PRECOMP

View File

@@ -10,9 +10,6 @@
#if wxUSE_NOTEBOOK
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -20,7 +17,10 @@
#endif // WX_PRECOMP
#include "wx/notebook.h"
#include "wx/scopedptr.h"
#include "bookctrlbasetest.h"
#include "testableframe.h"
class NotebookTestCase : public BookCtrlBaseTestCase, public CppUnit::TestCase
{
@@ -118,4 +118,49 @@ void NotebookTestCase::NoEventsOnDestruction()
CHECK( m_numPageChanges == 1 );
}
TEST_CASE("wxNotebook::AddPageEvents", "[wxNotebook][AddPage][event]")
{
wxNotebook* const
notebook = new wxNotebook(wxTheApp->GetTopWindow(), wxID_ANY,
wxDefaultPosition, wxSize(400, 200));
wxScopedPtr<wxNotebook> cleanup(notebook);
CHECK( notebook->GetSelection() == wxNOT_FOUND );
EventCounter countPageChanging(notebook, wxEVT_NOTEBOOK_PAGE_CHANGING);
EventCounter countPageChanged(notebook, wxEVT_NOTEBOOK_PAGE_CHANGED);
// Add the first page, it is special.
notebook->AddPage(new wxPanel(notebook), "Initial page");
// The selection should have been changed.
CHECK( notebook->GetSelection() == 0 );
// But no events should have been generated.
CHECK( countPageChanging.GetCount() == 0 );
CHECK( countPageChanged.GetCount() == 0 );
// Add another page without selecting it.
notebook->AddPage(new wxPanel(notebook), "Unselected page");
// Selection shouldn't have changed.
CHECK( notebook->GetSelection() == 0 );
// And no events should have been generated, of course.
CHECK( countPageChanging.GetCount() == 0 );
CHECK( countPageChanged.GetCount() == 0 );
// Finally add another page and do select it.
notebook->AddPage(new wxPanel(notebook), "Selected page", true);
// It should have become selected.
CHECK( notebook->GetSelection() == 2 );
// And events for the selection change should have been generated.
CHECK( countPageChanging.GetCount() == 1 );
CHECK( countPageChanged.GetCount() == 1 );
}
#endif //wxUSE_NOTEBOOK

View File

@@ -14,9 +14,6 @@
#if wxUSE_ODCOMBOBOX
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -75,12 +72,8 @@ private:
wxDECLARE_NO_COPY_CLASS(OwnerDrawnComboBoxTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( OwnerDrawnComboBoxTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( OwnerDrawnComboBoxTestCase,
"OwnerDrawnComboBoxTestCase" );
wxREGISTER_UNIT_TEST_WITH_TAGS(OwnerDrawnComboBoxTestCase,
"[OwnerDrawnComboBoxTestCase][item-container]");
// ----------------------------------------------------------------------------
// test initialization

View File

@@ -8,6 +8,11 @@
#include "testprec.h"
#if wxUSE_COLOURPICKERCTRL || \
wxUSE_DIRPICKERCTRL || \
wxUSE_FILEPICKERCTRL || \
wxUSE_FONTPICKERCTRL
#include "wx/pickerbase.h"
#include "pickerbasetest.h"
@@ -63,3 +68,5 @@ void PickerBaseTestCase::Controls()
CPPUNIT_ASSERT(base->GetTextCtrl() != NULL);
CPPUNIT_ASSERT(base->GetPickerCtrl() != NULL);
}
#endif

View File

@@ -8,9 +8,11 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_COLOURPICKERCTRL || \
wxUSE_DIRPICKERCTRL || \
wxUSE_FILEPICKERCTRL || \
wxUSE_FONTPICKERCTRL
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -215,3 +217,5 @@ void FontPickerCtrlTestCase::ColourSelection()
m_font->GetSelectedColour(), selectedColour);
}
#endif //wxUSE_FONTPICKERCTRL
#endif

View File

@@ -10,9 +10,6 @@
#if wxUSE_RADIOBOX
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"

View File

@@ -10,50 +10,33 @@
#if wxUSE_RADIOBTN
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/button.h"
#include "wx/panel.h"
#include "wx/radiobut.h"
#include "wx/sizer.h"
#include "wx/stattext.h"
#endif // WX_PRECOMP
#include "wx/uiaction.h"
#include "testableframe.h"
#include "testwindow.h"
class RadioButtonTestCase : public CppUnit::TestCase
class RadioButtonTestCase
{
public:
RadioButtonTestCase() { }
void setUp() wxOVERRIDE;
void tearDown() wxOVERRIDE;
private:
CPPUNIT_TEST_SUITE( RadioButtonTestCase );
WXUISIM_TEST( Click );
CPPUNIT_TEST( Value );
CPPUNIT_TEST( Group );
CPPUNIT_TEST_SUITE_END();
void Click();
void Value();
void Group();
RadioButtonTestCase();
~RadioButtonTestCase();
protected:
wxRadioButton* m_radio;
wxDECLARE_NO_COPY_CLASS(RadioButtonTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( RadioButtonTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( RadioButtonTestCase,
"RadioButtonTestCase" );
void RadioButtonTestCase::setUp()
RadioButtonTestCase::RadioButtonTestCase()
{
m_radio = new wxRadioButton(wxTheApp->GetTopWindow(), wxID_ANY,
"wxRadioButton");
@@ -61,15 +44,15 @@ void RadioButtonTestCase::setUp()
m_radio->Refresh();
}
void RadioButtonTestCase::tearDown()
RadioButtonTestCase::~RadioButtonTestCase()
{
wxDELETE(m_radio);
delete m_radio;
}
void RadioButtonTestCase::Click()
TEST_CASE_METHOD(RadioButtonTestCase, "RadioButton::Click", "[radiobutton]")
{
// GTK and OS X do not support selecting a single radio button
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__) && !defined(__WXOSX__)
// OS X doesn't support selecting a single radio button
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXOSX__)
EventCounter selected(m_radio, wxEVT_RADIOBUTTON);
wxUIActionSimulator sim;
@@ -80,74 +63,212 @@ void RadioButtonTestCase::Click()
wxYield();
CPPUNIT_ASSERT_EQUAL( 1, selected.GetCount() );
CHECK(selected.GetCount() == 1);
#endif
}
void RadioButtonTestCase::Value()
TEST_CASE_METHOD(RadioButtonTestCase, "RadioButton::Value", "[radiobutton]")
{
#ifndef __WXGTK__
EventCounter selected(m_radio, wxEVT_RADIOBUTTON);
m_radio->SetValue(true);
CPPUNIT_ASSERT(m_radio->GetValue());
CHECK(m_radio->GetValue());
m_radio->SetValue(false);
CPPUNIT_ASSERT(!m_radio->GetValue());
CHECK(!m_radio->GetValue());
CPPUNIT_ASSERT_EQUAL(0, selected.GetCount());
CHECK(selected.GetCount() == 0);
#endif
}
void RadioButtonTestCase::Group()
TEST_CASE_METHOD(RadioButtonTestCase, "RadioButton::Group", "[radiobutton]")
{
//Add another button to the first group and create another of two buttons
wxRadioButton* g1radio0 = new wxRadioButton(wxTheApp->GetTopWindow(),
wxID_ANY, "wxRadioButton",
wxDefaultPosition,
wxDefaultSize, wxRB_GROUP);
wxWindow* const parent = wxTheApp->GetTopWindow();
wxRadioButton* g1radio1 = new wxRadioButton(wxTheApp->GetTopWindow(),
wxID_ANY, "wxRadioButton");
// Create two different radio groups.
wxScopedPtr<wxRadioButton> g1radio0(new wxRadioButton(parent, wxID_ANY, "radio 1.0",
wxDefaultPosition, wxDefaultSize,
wxRB_GROUP));
wxRadioButton* g2radio0 = new wxRadioButton(wxTheApp->GetTopWindow(),
wxID_ANY, "wxRadioButton",
wxDefaultPosition,
wxDefaultSize, wxRB_GROUP);
wxScopedPtr<wxRadioButton> g1radio1(new wxRadioButton(parent, wxID_ANY, "radio 1.1"));
wxRadioButton* g2radio1 = new wxRadioButton(wxTheApp->GetTopWindow(),
wxID_ANY, "wxRadioButton");
wxScopedPtr<wxRadioButton> g2radio0(new wxRadioButton(parent, wxID_ANY, "radio 2.0",
wxDefaultPosition, wxDefaultSize,
wxRB_GROUP));
wxScopedPtr<wxRadioButton> g2radio1(new wxRadioButton(parent, wxID_ANY, "radio 2.1"));
// Check that having another control between radio buttons doesn't break
// grouping.
wxScopedPtr<wxStaticText> text(new wxStaticText(parent, wxID_ANY, "Label"));
wxScopedPtr<wxRadioButton> g2radio2(new wxRadioButton(parent, wxID_ANY, "radio 2.2"));
g1radio0->SetValue(true);
g2radio0->SetValue(true);
CPPUNIT_ASSERT(g1radio0->GetValue());
CPPUNIT_ASSERT(!g1radio1->GetValue());
CPPUNIT_ASSERT(g2radio0->GetValue());
CPPUNIT_ASSERT(!g2radio1->GetValue());
CHECK(g1radio0->GetValue());
CHECK(!g1radio1->GetValue());
CHECK(g2radio0->GetValue());
CHECK(!g2radio1->GetValue());
g1radio1->SetValue(true);
g2radio1->SetValue(true);
CPPUNIT_ASSERT(!g1radio0->GetValue());
CPPUNIT_ASSERT(g1radio1->GetValue());
CPPUNIT_ASSERT(!g2radio0->GetValue());
CPPUNIT_ASSERT(g2radio1->GetValue());
CHECK(!g1radio0->GetValue());
CHECK(g1radio1->GetValue());
CHECK(!g2radio0->GetValue());
CHECK(g2radio1->GetValue());
g2radio2->SetValue(true);
CHECK(!g2radio0->GetValue());
CHECK(!g2radio1->GetValue());
CHECK(g2radio2->GetValue());
g1radio0->SetValue(true);
g2radio0->SetValue(true);
CPPUNIT_ASSERT(g1radio0->GetValue());
CPPUNIT_ASSERT(!g1radio1->GetValue());
CPPUNIT_ASSERT(g2radio0->GetValue());
CPPUNIT_ASSERT(!g2radio1->GetValue());
CHECK(g1radio0->GetValue());
CHECK(!g1radio1->GetValue());
CHECK(g2radio0->GetValue());
CHECK(!g2radio1->GetValue());
wxDELETE(g1radio0);
wxDELETE(g1radio1);
wxDELETE(g2radio0);
wxDELETE(g2radio1);
// Check that group navigation functions behave as expected.
// GetFirstInGroup()
CHECK_SAME_WINDOW(g1radio0->GetFirstInGroup(), g1radio0);
CHECK_SAME_WINDOW(g1radio1->GetFirstInGroup(), g1radio0);
CHECK_SAME_WINDOW(g2radio0->GetFirstInGroup(), g2radio0);
CHECK_SAME_WINDOW(g2radio1->GetFirstInGroup(), g2radio0);
CHECK_SAME_WINDOW(g2radio2->GetFirstInGroup(), g2radio0);
// GetLastInGroup()
CHECK_SAME_WINDOW(g1radio0->GetLastInGroup(), g1radio1);
CHECK_SAME_WINDOW(g1radio1->GetLastInGroup(), g1radio1);
CHECK_SAME_WINDOW(g2radio0->GetLastInGroup(), g2radio2);
CHECK_SAME_WINDOW(g2radio1->GetLastInGroup(), g2radio2);
CHECK_SAME_WINDOW(g2radio2->GetLastInGroup(), g2radio2);
// GetNextInGroup()
CHECK_SAME_WINDOW(g1radio0->GetNextInGroup(), g1radio1);
CHECK_SAME_WINDOW(g1radio1->GetNextInGroup(), NULL);
CHECK_SAME_WINDOW(g2radio0->GetNextInGroup(), g2radio1);
CHECK_SAME_WINDOW(g2radio1->GetNextInGroup(), g2radio2);
CHECK_SAME_WINDOW(g2radio2->GetNextInGroup(), NULL);
// GetPreviousInGroup()
CHECK_SAME_WINDOW(g1radio0->GetPreviousInGroup(), NULL);
CHECK_SAME_WINDOW(g1radio1->GetPreviousInGroup(), g1radio0);
CHECK_SAME_WINDOW(g2radio0->GetPreviousInGroup(), NULL);
CHECK_SAME_WINDOW(g2radio1->GetPreviousInGroup(), g2radio0);
CHECK_SAME_WINDOW(g2radio2->GetPreviousInGroup(), g2radio1);
}
TEST_CASE_METHOD(RadioButtonTestCase, "RadioButton::Single", "[radiobutton]")
{
//Create a group of 2 buttons, having second button selected
wxScopedPtr<wxRadioButton> gradio0(new wxRadioButton(wxTheApp->GetTopWindow(),
wxID_ANY, "wxRadioButton",
wxDefaultPosition,
wxDefaultSize, wxRB_GROUP));
wxScopedPtr<wxRadioButton> gradio1(new wxRadioButton(wxTheApp->GetTopWindow(),
wxID_ANY, "wxRadioButton"));
gradio1->SetValue(true);
//Create a "single" button (by default it will not be selected)
wxScopedPtr<wxRadioButton> sradio(new wxRadioButton(wxTheApp->GetTopWindow(),
wxID_ANY, "wxRadioButton",
wxDefaultPosition,
wxDefaultSize, wxRB_SINGLE));
//Create a non-grouped button and select it
wxScopedPtr<wxRadioButton> ngradio(new wxRadioButton(wxTheApp->GetTopWindow(),
wxID_ANY, "wxRadioButton"));
ngradio->SetValue(true);
//Select the "single" button
sradio->SetValue(true);
CHECK(gradio1->GetValue());
CHECK(ngradio->GetValue());
// Also check that navigation works as expected with "single" buttons.
CHECK_SAME_WINDOW(sradio->GetFirstInGroup(), sradio);
CHECK_SAME_WINDOW(sradio->GetLastInGroup(), sradio);
CHECK_SAME_WINDOW(sradio->GetPreviousInGroup(), NULL);
CHECK_SAME_WINDOW(sradio->GetNextInGroup(), NULL);
}
TEST_CASE("RadioButton::Focus", "[radiobutton][focus]")
{
// Create a container panel just to be able to destroy all the windows
// created here at once by simply destroying it.
wxWindow* const tlw = wxTheApp->GetTopWindow();
wxScopedPtr<wxPanel> parentPanel(new wxPanel(tlw));
// Create a panel containing 2 radio buttons and another control outside
// this panel, so that we could give focus to something different and then
// return it back to the panel.
wxPanel* const radioPanel = new wxPanel(parentPanel.get());
wxRadioButton* const radio1 = new wxRadioButton(radioPanel, wxID_ANY, "1");
wxRadioButton* const radio2 = new wxRadioButton(radioPanel, wxID_ANY, "2");
wxSizer* const radioSizer = new wxBoxSizer(wxHORIZONTAL);
radioSizer->Add(radio1);
radioSizer->Add(radio2);
radioPanel->SetSizer(radioSizer);
wxButton* const dummyButton = new wxButton(parentPanel.get(), wxID_OK);
wxSizer* const sizer = new wxBoxSizer(wxVERTICAL);
sizer->Add(radioPanel, wxSizerFlags(1).Expand());
sizer->Add(dummyButton, wxSizerFlags().Expand());
parentPanel->SetSizer(sizer);
parentPanel->SetSize(tlw->GetClientSize());
parentPanel->Layout();
// Initially the first radio button should be checked.
radio1->SetFocus();
CHECK(radio1->GetValue());
CHECK_FOCUS_IS(radio1);
// Switching focus from it shouldn't change this.
dummyButton->SetFocus();
CHECK(radio1->GetValue());
// Checking another radio button should make it checked and uncheck the
// first one.
radio2->SetValue(true);
CHECK(!radio1->GetValue());
CHECK(radio2->GetValue());
// While not changing focus.
CHECK_FOCUS_IS(dummyButton);
// And giving the focus to the panel shouldn't change radio button
// selection.
radioPanel->SetFocus();
// Under MSW, focus is always on the selected button, but in the other
// ports this is not necessarily the case, i.e. under wxGTK this check
// would fail because focus gets set to the first button -- even though the
// second one remains checked.
#ifdef __WXMSW__
CHECK_FOCUS_IS(radio2);
#endif
CHECK(!radio1->GetValue());
CHECK(radio2->GetValue());
}
#endif //wxUSE_RADIOBTN

View File

@@ -8,9 +8,8 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef __WXOSX_IPHONE__
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -46,11 +45,8 @@ private:
wxDECLARE_NO_COPY_CLASS(RearrangeListTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( RearrangeListTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( RearrangeListTestCase, "RearrangeListTestCase" );
wxREGISTER_UNIT_TEST_WITH_TAGS(RearrangeListTestCase,
"[RearrangeListTestCase][item-container]");
void RearrangeListTestCase::setUp()
{
@@ -158,3 +154,5 @@ void RearrangeListTestCase::MoveClientData()
CPPUNIT_ASSERT_EQUAL("third", m_rearrange->GetString(1));
CPPUNIT_ASSERT_EQUAL("first", m_rearrange->GetString(2));
}
#endif

View File

@@ -10,9 +10,6 @@
#if wxUSE_RICHTEXT
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -34,6 +31,7 @@ public:
private:
CPPUNIT_TEST_SUITE( RichTextCtrlTestCase );
CPPUNIT_TEST( IsModified );
WXUISIM_TEST( CharacterEvent );
WXUISIM_TEST( DeleteEvent );
WXUISIM_TEST( ReturnEvent );
@@ -64,6 +62,7 @@ private:
CPPUNIT_TEST( Table );
CPPUNIT_TEST_SUITE_END();
void IsModified();
void CharacterEvent();
void DeleteEvent();
void ReturnEvent();
@@ -115,13 +114,17 @@ void RichTextCtrlTestCase::tearDown()
wxDELETE(m_rich);
}
void RichTextCtrlTestCase::IsModified()
{
CPPUNIT_ASSERT_EQUAL( false, m_rich->IsModified() );
m_rich->WriteText("abcdef");
CPPUNIT_ASSERT_EQUAL( true, m_rich->IsModified() );
}
void RichTextCtrlTestCase::CharacterEvent()
{
#if wxUSE_UIACTIONSIMULATOR
// There seems to be an event sequence problem on GTK+ that causes the events
// to be disconnected before they're processed, generating spurious errors.
#if !defined(__WXGTK__)
EventCounter character(m_rich, wxEVT_RICHTEXT_CHARACTER);
EventCounter content(m_rich, wxEVT_RICHTEXT_CONTENT_INSERTED);
@@ -145,15 +148,12 @@ void RichTextCtrlTestCase::CharacterEvent()
CPPUNIT_ASSERT_EQUAL(0, character.GetCount());
CPPUNIT_ASSERT_EQUAL(1, content.GetCount());
#endif
#endif
}
void RichTextCtrlTestCase::DeleteEvent()
{
#if wxUSE_UIACTIONSIMULATOR
// There seems to be an event sequence problem on GTK+ that causes the events
// to be disconnected before they're processed, generating spurious errors.
#if !defined(__WXGTK__)
EventCounter deleteevent(m_rich, wxEVT_RICHTEXT_DELETE);
EventCounter contentdelete(m_rich, wxEVT_RICHTEXT_CONTENT_DELETED);
@@ -169,15 +169,12 @@ void RichTextCtrlTestCase::DeleteEvent()
//Only one as the delete doesn't delete anthing
CPPUNIT_ASSERT_EQUAL(1, contentdelete.GetCount());
#endif
#endif
}
void RichTextCtrlTestCase::ReturnEvent()
{
#if wxUSE_UIACTIONSIMULATOR
// There seems to be an event sequence problem on GTK+ that causes the events
// to be disconnected before they're processed, generating spurious errors.
#if !defined(__WXGTK__)
EventCounter returnevent(m_rich, wxEVT_RICHTEXT_RETURN);
m_rich->SetFocus();
@@ -188,7 +185,6 @@ void RichTextCtrlTestCase::ReturnEvent()
CPPUNIT_ASSERT_EQUAL(1, returnevent.GetCount());
#endif
#endif
}
void RichTextCtrlTestCase::StyleEvent()
@@ -226,8 +222,7 @@ void RichTextCtrlTestCase::BufferResetEvent()
void RichTextCtrlTestCase::UrlEvent()
{
#if wxUSE_UIACTIONSIMULATOR
// Mouse up event not being caught on GTK+
#if !defined(__WXGTK__)
EventCounter url(m_rich, wxEVT_TEXT_URL);
m_rich->BeginURL("http://www.wxwidgets.org");
@@ -243,13 +238,11 @@ void RichTextCtrlTestCase::UrlEvent()
CPPUNIT_ASSERT_EQUAL(1, url.GetCount());
#endif
#endif
}
void RichTextCtrlTestCase::TextEvent()
{
#if wxUSE_UIACTIONSIMULATOR
#if !defined(__WXGTK__)
EventCounter updated(m_rich, wxEVT_TEXT);
m_rich->SetFocus();
@@ -261,7 +254,6 @@ void RichTextCtrlTestCase::TextEvent()
CPPUNIT_ASSERT_EQUAL("abcdef", m_rich->GetValue());
CPPUNIT_ASSERT_EQUAL(6, updated.GetCount());
#endif
#endif
}
void RichTextCtrlTestCase::CutCopyPaste()
@@ -409,7 +401,6 @@ void RichTextCtrlTestCase::Selection()
void RichTextCtrlTestCase::Editable()
{
#if wxUSE_UIACTIONSIMULATOR
#if !defined(__WXGTK__)
EventCounter updated(m_rich, wxEVT_TEXT);
m_rich->SetFocus();
@@ -429,7 +420,6 @@ void RichTextCtrlTestCase::Editable()
CPPUNIT_ASSERT_EQUAL("abcdef", m_rich->GetValue());
CPPUNIT_ASSERT_EQUAL(0, updated.GetCount());
#endif
#endif
}
void RichTextCtrlTestCase::Range()

View File

@@ -10,9 +10,6 @@
#if wxUSE_SEARCHCTRL
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -20,6 +17,8 @@
#include "wx/srchctrl.h"
#include "testwindow.h"
class SearchCtrlTestCase
{
public:
@@ -45,7 +44,7 @@ protected:
SEARCH_CTRL_TEST_CASE("wxSearchCtrl::Focus", "[wxSearchCtrl][focus]")
{
m_search->SetFocus();
CHECK( m_search->HasFocus() );
CHECK_FOCUS_IS( m_search );
}
#endif // !__WXOSX__

View File

@@ -10,9 +10,6 @@
#if wxUSE_BOOKCTRL
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"

View File

@@ -10,9 +10,6 @@
#if wxUSE_SLIDER
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -35,6 +32,7 @@ private:
#ifndef __WXOSX__
WXUISIM_TEST( PageUpDown );
WXUISIM_TEST( LineUpDown );
WXUISIM_TEST( EvtSlider );
WXUISIM_TEST( LinePageSize );
#endif
CPPUNIT_TEST( Value );
@@ -47,6 +45,7 @@ private:
void PageUpDown();
void LineUpDown();
void EvtSlider();
void LinePageSize();
void Value();
void Range();
@@ -125,6 +124,24 @@ void SliderTestCase::LineUpDown()
#endif
}
void SliderTestCase::EvtSlider()
{
#if wxUSE_UIACTIONSIMULATOR
EventCounter slider(m_slider, wxEVT_SLIDER);
wxUIActionSimulator sim;
wxYield();
m_slider->SetFocus();
sim.Char(WXK_UP);
sim.Char(WXK_DOWN);
wxYield();
CPPUNIT_ASSERT_EQUAL(2, slider.GetCount());
#endif
}
void SliderTestCase::LinePageSize()
{
#if wxUSE_UIACTIONSIMULATOR
@@ -188,7 +205,7 @@ void SliderTestCase::Range()
void SliderTestCase::Thumb()
{
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
#if wxUSE_UIACTIONSIMULATOR
EventCounter track(m_slider, wxEVT_SCROLL_THUMBTRACK);
EventCounter release(m_slider, wxEVT_SCROLL_THUMBRELEASE);
EventCounter changed(m_slider, wxEVT_SCROLL_CHANGED);
@@ -197,12 +214,14 @@ void SliderTestCase::Thumb()
m_slider->SetValue(0);
sim.MouseDragDrop(m_slider->ClientToScreen(wxPoint(10, 10)),m_slider->ClientToScreen(wxPoint(50, 10)));
// use the slider real position for dragging the mouse.
const int ypos = m_slider->GetSize().y / 2;
sim.MouseDragDrop(m_slider->ClientToScreen(wxPoint(10, ypos)),m_slider->ClientToScreen(wxPoint(50, ypos)));
wxYield();
CPPUNIT_ASSERT(track.GetCount() != 0);
CPPUNIT_ASSERT_EQUAL(1, release.GetCount());
#ifdef __WXMSW__
#if defined(__WXMSW__) || defined(__WXGTK__)
CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());
#endif
#endif

View File

@@ -8,9 +8,8 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_SPINCTRL
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -89,7 +88,7 @@ void SpinCtrlDoubleTestCase::NoEventsInCtor()
void SpinCtrlDoubleTestCase::Arrows()
{
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
#if wxUSE_UIACTIONSIMULATOR
EventCounter updated(m_spin, wxEVT_SPINCTRLDOUBLE);
wxUIActionSimulator sim;
@@ -194,9 +193,10 @@ void SpinCtrlDoubleTestCase::Value()
void SpinCtrlDoubleTestCase::Increment()
{
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
#if wxUSE_UIACTIONSIMULATOR
CPPUNIT_ASSERT_EQUAL(1.0, m_spin->GetIncrement());
m_spin->SetDigits(1);
m_spin->SetIncrement(0.1);
CPPUNIT_ASSERT_EQUAL(0.1, m_spin->GetIncrement());
@@ -220,3 +220,39 @@ void SpinCtrlDoubleTestCase::Digits()
CPPUNIT_ASSERT_EQUAL(5, m_spin->GetDigits());
}
static inline unsigned int GetInitialDigits(double inc)
{
wxSpinCtrlDouble* sc = new wxSpinCtrlDouble(wxTheApp->GetTopWindow(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS,
0, 50, 0, inc);
unsigned int digits = sc->GetDigits();
delete sc;
return digits;
}
TEST_CASE("SpinCtrlDoubleTestCase::InitialDigits", "[spinctrldouble][initialdigits]")
{
REQUIRE(GetInitialDigits(15) == 0);
REQUIRE(GetInitialDigits(10) == 0);
REQUIRE(GetInitialDigits(1) == 0);
REQUIRE(GetInitialDigits(0.999) == 1);
REQUIRE(GetInitialDigits(0.15) == 1);
REQUIRE(GetInitialDigits(0.11) == 1);
REQUIRE(GetInitialDigits(0.1) == 1);
REQUIRE(GetInitialDigits(0.0999) == 2);
REQUIRE(GetInitialDigits(0.015) == 2);
REQUIRE(GetInitialDigits(0.011) == 2);
REQUIRE(GetInitialDigits(0.01) == 2);
REQUIRE(GetInitialDigits(9.99e-5) == 5);
REQUIRE(GetInitialDigits(1e-5) == 5);
REQUIRE(GetInitialDigits(9.9999e-10) == 10);
REQUIRE(GetInitialDigits(1e-10) == 10);
REQUIRE(GetInitialDigits(9.9999e-20) == 20);
REQUIRE(GetInitialDigits(1e-20) == 20);
REQUIRE(GetInitialDigits(9.9999e-21) == 20);
REQUIRE(GetInitialDigits(1e-21) == 20);
REQUIRE(GetInitialDigits(9.9999e-22) == 20);
REQUIRE(GetInitialDigits(1e-22) == 20);
}
#endif

View File

@@ -10,9 +10,6 @@
#if wxUSE_SPINCTRL
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -21,108 +18,128 @@
#include "testableframe.h"
#include "wx/uiaction.h"
#include "wx/spinctrl.h"
#include "wx/textctrl.h"
class SpinCtrlTestCase : public CppUnit::TestCase
class SpinCtrlTestCase1
{
public:
SpinCtrlTestCase() { }
SpinCtrlTestCase1()
: m_spin(new wxSpinCtrl())
{
}
void setUp() wxOVERRIDE;
void tearDown() wxOVERRIDE;
private:
CPPUNIT_TEST_SUITE( SpinCtrlTestCase );
CPPUNIT_TEST( Initial );
CPPUNIT_TEST( NoEventsInCtor );
WXUISIM_TEST( Arrows );
WXUISIM_TEST( Wrap );
CPPUNIT_TEST( Range );
CPPUNIT_TEST( Value );
WXUISIM_TEST( SetValueInsideEventHandler );
CPPUNIT_TEST_SUITE_END();
void Initial();
void NoEventsInCtor();
void Arrows();
void Wrap();
void Range();
void Value();
void SetValueInsideEventHandler();
// Helper event handler for SetValueInsideEventHandler() test.
void OnSpinSetValue(wxSpinEvent &e);
~SpinCtrlTestCase1()
{
delete m_spin;
}
protected:
wxSpinCtrl* m_spin;
wxDECLARE_NO_COPY_CLASS(SpinCtrlTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( SpinCtrlTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SpinCtrlTestCase, "SpinCtrlTestCase" );
void SpinCtrlTestCase::setUp()
class SpinCtrlTestCase2
{
m_spin = new wxSpinCtrl(wxTheApp->GetTopWindow());
}
public:
SpinCtrlTestCase2()
: m_spin(new wxSpinCtrl(wxTheApp->GetTopWindow()))
{
}
void SpinCtrlTestCase::tearDown()
~SpinCtrlTestCase2()
{
delete m_spin;
}
protected:
wxSpinCtrl* m_spin;
};
class SpinCtrlTestCase3
{
wxDELETE(m_spin);
}
public:
SpinCtrlTestCase3()
: m_spin(new wxSpinCtrl(wxTheApp->GetTopWindow()))
{
m_spin->Bind(wxEVT_SPINCTRL, &SpinCtrlTestCase3::OnSpinSetValue, this);
}
void SpinCtrlTestCase::Initial()
~SpinCtrlTestCase3()
{
delete m_spin;
}
private:
void OnSpinSetValue(wxSpinEvent &e)
{
// Constrain the value to be in the 1..16 range or 32.
int newVal = e.GetValue();
if ( newVal == 31 )
m_spin->SetValue(16);
else if ( newVal > 16 )
m_spin->SetValue(32);
}
protected:
wxSpinCtrl* m_spin;
};
TEST_CASE_METHOD(SpinCtrlTestCase2, "SpinCtrl::Init", "[spinctrl]")
{
// Initial value is defined by "initial" argument which is 0 by default.
CPPUNIT_ASSERT_EQUAL( 0, m_spin->GetValue() );
wxWindow* const parent = m_spin->GetParent();
// Recreate the control with another "initial" to check this.
delete m_spin;
m_spin = new wxSpinCtrl(parent, wxID_ANY, "",
wxDefaultPosition, wxDefaultSize, 0,
0, 100, 17);
CPPUNIT_ASSERT_EQUAL( 17, m_spin->GetValue() );
// Recreate the control with another "initial" outside of standard spin
// ctrl range.
delete m_spin;
m_spin = new wxSpinCtrl(parent, wxID_ANY, "",
wxDefaultPosition, wxDefaultSize, 0,
0, 200, 150);
CPPUNIT_ASSERT_EQUAL( 150, m_spin->GetValue() );
// But if the text string is specified, it takes precedence.
delete m_spin;
m_spin = new wxSpinCtrl(parent, wxID_ANY, "99",
wxDefaultPosition, wxDefaultSize, 0,
0, 100, 17);
CPPUNIT_ASSERT_EQUAL( 99, m_spin->GetValue() );
CHECK(m_spin->GetValue() == 0);
}
void SpinCtrlTestCase::NoEventsInCtor()
TEST_CASE_METHOD(SpinCtrlTestCase1, "SpinCtrl::Init2", "[spinctrl]")
{
// Verify that creating the control does not generate any events. This is
// unexpected and shouldn't happen.
wxWindow* const parent = m_spin->GetParent();
delete m_spin;
m_spin = new wxSpinCtrl;
EventCounter updatedSpin(m_spin, wxEVT_SPINCTRL);
EventCounter updatedText(m_spin, wxEVT_TEXT);
m_spin->Create(parent, wxID_ANY, "",
m_spin->Create(wxTheApp->GetTopWindow(), wxID_ANY, "",
wxDefaultPosition, wxDefaultSize, 0,
0, 100, 17);
CPPUNIT_ASSERT_EQUAL(0, updatedSpin.GetCount());
CPPUNIT_ASSERT_EQUAL(0, updatedText.GetCount());
// Recreate the control with another "initial" to check this.
CHECK(m_spin->GetValue() == 17);
}
void SpinCtrlTestCase::Arrows()
TEST_CASE_METHOD(SpinCtrlTestCase1, "SpinCtrl::Init3", "[spinctrl]")
{
m_spin->Create(wxTheApp->GetTopWindow(), wxID_ANY, "",
wxDefaultPosition, wxDefaultSize, 0,
0, 200, 150);
// Recreate the control with another "initial" outside of standard spin
// ctrl range.
CHECK(m_spin->GetValue() == 150);
}
TEST_CASE_METHOD(SpinCtrlTestCase1, "SpinCtrl::Init4", "[spinctrl]")
{
m_spin->Create(wxTheApp->GetTopWindow(), wxID_ANY, "99",
wxDefaultPosition, wxDefaultSize, 0,
0, 100, 17);
// Recreate the control with another "initial" outside of standard spin
// ctrl range.
// But if the text string is specified, it takes precedence.
CHECK(m_spin->GetValue() == 99);
}
TEST_CASE_METHOD(SpinCtrlTestCase1, "SpinCtrl::NoEventsInCtor", "[spinctrl]")
{
// Verify that creating the control does not generate any events. This is
// unexpected and shouldn't happen.
EventCounter updatedSpin(m_spin, wxEVT_SPINCTRL);
EventCounter updatedText(m_spin, wxEVT_TEXT);
m_spin->Create(wxTheApp->GetTopWindow(), wxID_ANY, "",
wxDefaultPosition, wxDefaultSize, 0,
0, 100, 17);
CHECK(updatedSpin.GetCount() == 0);
CHECK(updatedText.GetCount() == 0);
}
TEST_CASE_METHOD(SpinCtrlTestCase2, "SpinCtrl::Arrows", "[spinctrl]")
{
#if wxUSE_UIACTIONSIMULATOR
EventCounter updated(m_spin, wxEVT_SPINCTRL);
@@ -136,26 +153,25 @@ void SpinCtrlTestCase::Arrows()
wxYield();
CPPUNIT_ASSERT_EQUAL(1, updated.GetCount());
CPPUNIT_ASSERT_EQUAL(1, m_spin->GetValue());
CHECK(updated.GetCount() == 1);
CHECK(m_spin->GetValue() == 1);
updated.Clear();
sim.Char(WXK_DOWN);
wxYield();
CPPUNIT_ASSERT_EQUAL(1, updated.GetCount());
CPPUNIT_ASSERT_EQUAL(0, m_spin->GetValue());
CHECK(updated.GetCount() == 1);
CHECK(m_spin->GetValue() == 0);
#endif
}
void SpinCtrlTestCase::Wrap()
TEST_CASE_METHOD(SpinCtrlTestCase1, "SpinCtrl::Wrap", "[spinctrl]")
{
#if wxUSE_UIACTIONSIMULATOR
wxDELETE(m_spin);
m_spin = new wxSpinCtrl(wxTheApp->GetTopWindow(), wxID_ANY, "",
wxDefaultPosition, wxDefaultSize,
wxSP_ARROW_KEYS | wxSP_WRAP);
m_spin->Create(wxTheApp->GetTopWindow(), wxID_ANY, "",
wxDefaultPosition, wxDefaultSize,
wxSP_ARROW_KEYS | wxSP_WRAP);
wxUIActionSimulator sim;
@@ -166,20 +182,21 @@ void SpinCtrlTestCase::Wrap()
wxYield();
CPPUNIT_ASSERT_EQUAL(100, m_spin->GetValue());
CHECK(m_spin->GetValue() == 100);
sim.Char(WXK_UP);
wxYield();
CPPUNIT_ASSERT_EQUAL(0, m_spin->GetValue());
CHECK(m_spin->GetValue() == 0);
#endif
}
void SpinCtrlTestCase::Range()
TEST_CASE_METHOD(SpinCtrlTestCase2, "SpinCtrl::Range", "[spinctrl]")
{
CPPUNIT_ASSERT_EQUAL(0, m_spin->GetMin());
CPPUNIT_ASSERT_EQUAL(100, m_spin->GetMax());
CHECK(m_spin->GetMin() == 0);
CHECK(m_spin->GetMax() == 100);
CHECK(m_spin->GetBase() == 10);
// Test that the value is adjusted to be inside the new valid range but
// that this doesn't result in any events (as this is not something done by
@@ -189,61 +206,116 @@ void SpinCtrlTestCase::Range()
EventCounter updatedText(m_spin, wxEVT_TEXT);
m_spin->SetRange(1, 10);
CPPUNIT_ASSERT_EQUAL(1, m_spin->GetValue());
CHECK(m_spin->GetValue() == 1);
CPPUNIT_ASSERT_EQUAL(0, updatedSpin.GetCount());
CPPUNIT_ASSERT_EQUAL(0, updatedText.GetCount());
CHECK(updatedSpin.GetCount() == 0);
CHECK(updatedText.GetCount() == 0);
}
//Test negative ranges
// Test negative ranges
m_spin->SetRange(-10, 10);
CPPUNIT_ASSERT_EQUAL(-10, m_spin->GetMin());
CPPUNIT_ASSERT_EQUAL(10, m_spin->GetMax());
CHECK(m_spin->GetMin() == -10);
CHECK(m_spin->GetMax() == 10);
// With base 16 only ranges including values >= 0 are allowed
m_spin->SetRange(0, 10);
int oldMinVal = m_spin->GetMin();
int oldMaxVal = m_spin->GetMax();
CHECK(oldMinVal == 0);
CHECK(oldMaxVal == 10);
CHECK(m_spin->SetBase(16) == true);
CHECK(m_spin->GetBase() == 16);
// New range should be silently ignored
m_spin->SetRange(-20, 20);
CHECK(m_spin->GetMin() == oldMinVal);
CHECK(m_spin->GetMax() == oldMaxVal);
// This range should be accepted
m_spin->SetRange(2, 8);
CHECK(m_spin->GetMin() == 2);
CHECK(m_spin->GetMax() == 8);
CHECK(m_spin->SetBase(10) == true);
CHECK(m_spin->GetBase() == 10);
//Test backwards ranges
m_spin->SetRange(75, 50);
CPPUNIT_ASSERT_EQUAL(75, m_spin->GetMin());
CPPUNIT_ASSERT_EQUAL(50, m_spin->GetMax());
CHECK(m_spin->GetMin() == 75);
CHECK(m_spin->GetMax() == 50);
}
void SpinCtrlTestCase::Value()
TEST_CASE_METHOD(SpinCtrlTestCase2, "SpinCtrl::Value", "[spinctrl]")
{
EventCounter updatedSpin(m_spin, wxEVT_SPINCTRL);
EventCounter updatedText(m_spin, wxEVT_TEXT);
CPPUNIT_ASSERT_EQUAL(0, m_spin->GetValue());
CHECK(m_spin->GetValue() == 0);
m_spin->SetValue(50);
CPPUNIT_ASSERT_EQUAL(50, m_spin->GetValue());
CHECK(m_spin->GetValue() == 50);
m_spin->SetValue(-10);
CPPUNIT_ASSERT_EQUAL(0, m_spin->GetValue());
CHECK(m_spin->GetValue() == 0);
m_spin->SetValue(110);
CPPUNIT_ASSERT_EQUAL(100, m_spin->GetValue());
CHECK(m_spin->GetValue() == 100);
// Calling SetValue() shouldn't have generated any events.
CPPUNIT_ASSERT_EQUAL(0, updatedSpin.GetCount());
CPPUNIT_ASSERT_EQUAL(0, updatedText.GetCount());
CHECK(updatedSpin.GetCount() == 0);
CHECK(updatedText.GetCount() == 0);
}
void SpinCtrlTestCase::OnSpinSetValue(wxSpinEvent &e)
TEST_CASE_METHOD(SpinCtrlTestCase2, "SpinCtrl::Base", "[spinctrl]")
{
// Constrain the value to be in the 1..16 range or 32.
int newVal = e.GetValue();
CHECK(m_spin->GetMin() == 0);
CHECK(m_spin->GetMax() == 100);
CHECK(m_spin->GetBase() == 10);
if ( newVal == 31 )
m_spin->SetValue(16);
else if ( newVal > 16 )
m_spin->SetValue(32);
// Only 10 and 16 bases are allowed
CHECK(m_spin->SetBase(10) == true);
CHECK(m_spin->GetBase() == 10);
CHECK_FALSE(m_spin->SetBase(8));
CHECK(m_spin->GetBase() == 10);
CHECK_FALSE(m_spin->SetBase(2));
CHECK(m_spin->GetBase() == 10);
CHECK(m_spin->SetBase(16) == true);
CHECK(m_spin->GetBase() == 16);
CHECK(m_spin->SetBase(10) == true);
CHECK(m_spin->GetBase() == 10);
// When range contains negative values only base 10 is allowed
m_spin->SetRange(-10, 10);
CHECK(m_spin->GetMin() == -10);
CHECK(m_spin->GetMax() == 10);
CHECK_FALSE(m_spin->SetBase(8));
CHECK(m_spin->GetBase() == 10);
CHECK_FALSE(m_spin->SetBase(2));
CHECK(m_spin->GetBase() == 10);
CHECK_FALSE(m_spin->SetBase(16));
CHECK(m_spin->GetBase() == 10);
CHECK(m_spin->SetBase(10) == true);
CHECK(m_spin->GetBase() == 10);
}
void SpinCtrlTestCase::SetValueInsideEventHandler()
TEST_CASE_METHOD(SpinCtrlTestCase3, "SpinCtrl::SetValueInsideEventHandler", "[spinctrl]")
{
#if wxUSE_UIACTIONSIMULATOR
m_spin->Bind(wxEVT_SPINCTRL, &SpinCtrlTestCase::OnSpinSetValue, this);
// A dummy control with which we change the focus.
wxTextCtrl* text = new wxTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY);
text->Move(m_spin->GetSize().x, m_spin->GetSize().y * 3);
wxUIActionSimulator sim;
@@ -258,11 +330,13 @@ void SpinCtrlTestCase::SetValueInsideEventHandler()
sim.Text("20");
wxYield();
wxTheApp->GetTopWindow()->SetFocus();
text->SetFocus();
wxYield();
CPPUNIT_ASSERT_EQUAL(32, m_spin->GetValue());
CHECK(m_spin->GetValue() == 32);
}
delete text;
#endif // wxUSE_UIACTIONSIMULATOR
}

View File

@@ -0,0 +1,170 @@
///////////////////////////////////////////////////////////////////////////////
// Name: tests/controls/styledtextctrltest.cpp
// Purpose: wxStyledTextCtrl unit test
// Author: New Pagodi
// Created: 2019-03-10
// Copyright: (c) 2019 wxWidgets development team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#include "testprec.h"
#if wxUSE_STC
#if defined(WXUSINGDLL)
#ifndef WX_PRECOMP
#include "wx/app.h"
#endif // WX_PRECOMP
#include "wx/stc/stc.h"
#include "wx/uiaction.h"
#include "testwindow.h"
#if defined(__WXOSX_COCOA__) || defined(__WXMSW__) || defined(__WXGTK__)
class StcPopupWindowsTestCase
{
public:
StcPopupWindowsTestCase()
: m_stc(new wxStyledTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY))
{
m_focusAlwaysRetained=true;
m_calltipClickReceived=false;
m_stc->Bind(wxEVT_KILL_FOCUS,
&StcPopupWindowsTestCase::OnKillSTCFocus, this);
m_stc->Bind(wxEVT_STC_CALLTIP_CLICK,
&StcPopupWindowsTestCase::OnCallTipClick, this);
}
~StcPopupWindowsTestCase()
{
delete m_stc;
}
void OnKillSTCFocus(wxFocusEvent& WXUNUSED(event))
{
m_focusAlwaysRetained=false;
}
void OnCallTipClick(wxStyledTextEvent& WXUNUSED(event))
{
m_calltipClickReceived=true;
}
protected:
wxStyledTextCtrl* const m_stc;
bool m_focusAlwaysRetained;
bool m_calltipClickReceived;
};
// This set of tests is used to verify that an autocompletion popup does not
// take focus from its parent styled text control.
TEST_CASE_METHOD(StcPopupWindowsTestCase,
"wxStyledTextCtrl::AutoComp",
"[wxStyledTextCtrl][focus]")
{
m_stc->SetFocus();
m_focusAlwaysRetained = true;
m_stc->AutoCompShow(0,"ability able about above abroad absence absent");
#if wxUSE_UIACTIONSIMULATOR
// Pressing the tab key should cause the current entry in the list to be
// entered into the styled text control. However with GTK+, characters sent
// with the UI simulator seem to arrive too late, so select the current
// entry with a double click instead.
wxUIActionSimulator sim;
#ifdef __WXGTK__
wxPoint zeroPosition = m_stc->PointFromPosition(0);
int textHt = m_stc->TextHeight(0);
int textWd = m_stc->TextWidth(0,"ability");
wxPoint autoCompPoint(zeroPosition.x + textWd/2,
zeroPosition.y + textHt + textHt/2);
wxPoint scrnPoint = m_stc->ClientToScreen(autoCompPoint);
sim.MouseMove(scrnPoint);
sim.MouseDblClick();
#else
sim.Char(WXK_TAB);
#endif // __WXGTK__
::wxYield();
CHECK( m_stc->GetText() == "ability" );
#endif //wxUSE_UIACTIONSIMULATOR
if ( m_stc->AutoCompActive() )
m_stc->AutoCompCancel();
CHECK_FOCUS_IS( m_stc );
// Unfortunately under GTK we do get focus loss events, at least sometimes
// (and actually more often than not, especially with GTK2, but this
// happens with GTK3 too).
#ifndef __WXGTK__
CHECK( m_focusAlwaysRetained );
#endif // !__WXGTK__
}
// This test is used to verify that a call tip receives mouse clicks. However
// the clicks do sent with the UI simulator do not seem to be received on
// cocoa for some reason, so skip the test there for now.
#if !defined(__WXOSX_COCOA__)
TEST_CASE_METHOD(StcPopupWindowsTestCase,
"wxStyledTextCtrl::Calltip",
"[wxStyledTextCtrl][focus]")
{
m_stc->SetFocus();
m_calltipClickReceived = false;
m_focusAlwaysRetained = true;
wxString calltipText = "This is a calltip.";
m_stc->CallTipShow(0,calltipText);
#if wxUSE_UIACTIONSIMULATOR
wxUIActionSimulator sim;
wxPoint zeroPosition = m_stc->PointFromPosition(0);
int textHt = m_stc->TextHeight(0);
int textWd = m_stc->TextWidth(0,calltipText);
// zeroPosition is the top left of position 0 and the call tip should have
// roughly the same height as textHt (there seems to be some extra padding
// that makes it a little taller, but it's roughly the same height),
// so (zeroPosition.x+textWd/2,zeroPosition.y+textHt+textHt/2) should
// be the middle of the calltip.
wxPoint calltipMidPoint(zeroPosition.x + textWd/2,
zeroPosition.y + textHt + textHt/2);
wxPoint scrnPoint = m_stc->ClientToScreen(calltipMidPoint);
sim.MouseMove(scrnPoint);
sim.MouseClick();
::wxYield();
CHECK( m_calltipClickReceived );
#endif // wxUSE_UIACTIONSIMULATOR
if ( m_stc->CallTipActive() )
m_stc->CallTipCancel();
// Verify that clicking the call tip did not take focus from the STC.
//
// Unfortunately this test fails for unknown reasons under Xvfb (but only
// there).
if ( !IsRunningUnderXVFB() )
CHECK_FOCUS_IS( m_stc );
// With wxGTK there is the same problem here as in the test above.
#ifndef __WXGTK__
CHECK( m_focusAlwaysRetained );
#endif // !__WXGTK__
}
#endif // !defined(__WXOSX_COCOA__)
#endif // defined(__WXOSX_COCOA__) || defined(__WXMSW__) || defined(__WXGTK__)
#endif // WXUSINGDLL
#endif // wxUSE_STC

View File

@@ -14,21 +14,27 @@
#if wxUSE_TEXTCTRL
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/textctrl.h"
#endif // WX_PRECOMP
#include "wx/scopeguard.h"
#include "wx/scopedptr.h"
#include "wx/uiaction.h"
#if wxUSE_CLIPBOARD
#include "wx/clipbrd.h"
#include "wx/dataobj.h"
#endif // wxUSE_CLIPBOARD
#ifdef __WXGTK__
#include "wx/stopwatch.h"
#endif
#include "textentrytest.h"
#include "testableframe.h"
#include "asserthelper.h"
#include "wx/uiaction.h"
static const int TEXT_HEIGHT = 200;
@@ -78,7 +84,9 @@ private:
CPPUNIT_TEST( Style );
CPPUNIT_TEST( FontStyle );
CPPUNIT_TEST( Lines );
#if wxUSE_LOG
CPPUNIT_TEST( LogTextCtrl );
#endif // wxUSE_LOG
CPPUNIT_TEST( LongText );
CPPUNIT_TEST( PositionToCoords );
CPPUNIT_TEST( PositionToCoordsRich );
@@ -109,7 +117,9 @@ private:
void Style();
void FontStyle();
void Lines();
#if wxUSE_LOG
void LogTextCtrl();
#endif // wxUSE_LOG
void LongText();
void PositionToCoords();
void PositionToCoordsRich();
@@ -276,8 +286,7 @@ void TextCtrlTestCase::StreamInput()
#ifndef __WXOSX__
{
// Ensure we use decimal point and not a comma.
char * const locOld = setlocale(LC_NUMERIC, "C");
wxON_BLOCK_EXIT2( setlocale, (int)LC_NUMERIC, locOld );
LocaleSetter setCLocale("C");
*m_text << "stringinput"
<< 10
@@ -332,6 +341,9 @@ void TextCtrlTestCase::Redirector()
void TextCtrlTestCase::HitTestSingleLine()
{
#ifdef __WXQT__
WARN("Does not work under WxQt");
#else
m_text->ChangeValue("Hit me");
// We don't know the size of the text borders, so we can't really do any
@@ -342,6 +354,10 @@ void TextCtrlTestCase::HitTestSingleLine()
long pos = -1;
#ifdef __WXGTK__
wxYield();
#endif
// Hitting a point near the left side of the control should find one of the
// first few characters under it.
SECTION("Normal")
@@ -367,12 +383,23 @@ void TextCtrlTestCase::HitTestSingleLine()
m_text->ChangeValue(wxString(200, 'X'));
m_text->SetInsertionPointEnd();
#ifdef __WXGTK__
// wxGTK must be given an opportunity to lay the text out.
wxYield();
for ( wxStopWatch sw; sw.Time() < 50; )
wxYield();
#endif
REQUIRE( m_text->HitTest(wxPoint(2*sizeChar.x, yMid), &pos) == wxTE_HT_ON_TEXT );
CHECK( pos > 3 );
// Using negative coordinates works even under Xvfb, so test at least
// for this -- however this only works in wxGTK, not wxMSW.
#ifdef __WXGTK__
REQUIRE( m_text->HitTest(wxPoint(-2*sizeChar.x, yMid), &pos) == wxTE_HT_ON_TEXT );
CHECK( pos > 3 );
#endif // __WXGTK__
}
#endif
}
#if 0
@@ -433,7 +460,7 @@ void TextCtrlTestCase::Url()
void TextCtrlTestCase::Style()
{
#ifndef __WXOSX__
#if !defined(__WXOSX__) && !defined(__WXQT__)
delete m_text;
// We need wxTE_RICH under windows for style support
CreateText(wxTE_MULTILINE|wxTE_RICH);
@@ -485,6 +512,8 @@ void TextCtrlTestCase::Style()
REQUIRE( m_text->GetStyle(17, style) );
CHECK( style.GetTextColour() == *wxRED );
CHECK( style.GetBackgroundColour() == *wxWHITE );
#else
WARN("Does not work under WxQt or OSX");
#endif
}
@@ -566,13 +595,14 @@ void TextCtrlTestCase::Lines()
// #12366, where GetNumberOfLines() always returns the number of logical,
// not physical, lines.
m_text->AppendText("\n" + wxString(50, '1') + ' ' + wxString(50, '2'));
#if defined(__WXGTK__) || defined(__WXOSX_COCOA__) || defined(__WXUNIVERSAL__)
#if defined(__WXGTK__) || defined(__WXOSX_COCOA__) || defined(__WXUNIVERSAL__) || defined(__WXQT__)
CPPUNIT_ASSERT_EQUAL(6, m_text->GetNumberOfLines());
#else
CPPUNIT_ASSERT(m_text->GetNumberOfLines() > 6);
#endif
}
#if wxUSE_LOG
void TextCtrlTestCase::LogTextCtrl()
{
CPPUNIT_ASSERT(m_text->IsEmpty());
@@ -587,6 +617,7 @@ void TextCtrlTestCase::LogTextCtrl()
CPPUNIT_ASSERT(!m_text->IsEmpty());
}
#endif // wxUSE_LOG
void TextCtrlTestCase::LongText()
{
@@ -1239,4 +1270,194 @@ void TextCtrlTestCase::XYToPositionSingleLine()
}
}
TEST_CASE("wxTextCtrl::ProcessEnter", "[wxTextCtrl][enter]")
{
class TextCtrlCreator : public TextLikeControlCreator
{
public:
explicit TextCtrlCreator(int styleToAdd = 0)
: m_styleToAdd(styleToAdd)
{
}
virtual wxControl* Create(wxWindow* parent, int style) const wxOVERRIDE
{
return new wxTextCtrl(parent, wxID_ANY, wxString(),
wxDefaultPosition, wxDefaultSize,
style | m_styleToAdd);
}
virtual TextLikeControlCreator* CloneAsMultiLine() const wxOVERRIDE
{
return new TextCtrlCreator(wxTE_MULTILINE);
}
private:
int m_styleToAdd;
};
TestProcessEnter(TextCtrlCreator());
}
TEST_CASE("wxTextCtrl::GetBestSize", "[wxTextCtrl][best-size]")
{
struct GetBestSizeFor
{
wxSize operator()(const wxString& text) const
{
wxScopedPtr<wxTextCtrl>
t(new wxTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY, text,
wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE));
return t->GetBestSize();
}
} getBestSizeFor;
wxString s;
const wxSize sizeEmpty = getBestSizeFor(s);
// Empty control should have some reasonable vertical size.
CHECK( sizeEmpty.y > 0 );
s += "1\n2\n3\n4\n5\n";
const wxSize sizeMedium = getBestSizeFor(s);
// Control with a few lines of text in it should be taller.
CHECK( sizeMedium.y > sizeEmpty.y );
s += "6\n7\n8\n9\n10\n";
const wxSize sizeLong = getBestSizeFor(s);
// And a control with many lines in it should be even more so.
CHECK( sizeLong.y > sizeMedium.y );
s += s;
s += s;
s += s;
const wxSize sizeVeryLong = getBestSizeFor(s);
// However there is a cutoff at 10 lines currently, so anything longer than
// that should still have the same best size.
CHECK( sizeVeryLong.y == sizeLong.y );
}
#if wxUSE_CLIPBOARD
TEST_CASE("wxTextCtrl::LongPaste", "[wxTextCtrl][clipboard][paste]")
{
long style = 0;
SECTION("Plain")
{
style = wxTE_MULTILINE;
}
// wxTE_RICH[2] style only makes any different under MSW, so don't bother
// testing it under the other platforms.
#ifdef __WXMSW__
SECTION("Rich")
{
style = wxTE_MULTILINE | wxTE_RICH;
}
SECTION("Rich v2")
{
style = wxTE_MULTILINE | wxTE_RICH2;
}
#endif // __WXMSW__
if ( !style )
{
// This can happen when explicitly selecting just a single section to
// execute -- this code still runs even if the corresponding section is
// skipped, so we have to explicitly skip it too in this case.
return;
}
wxScopedPtr<wxTextCtrl>
text(new wxTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY, wxString(),
wxDefaultPosition, wxDefaultSize, style));
// This could actually be much higher, but it makes the test proportionally
// slower, so use a relatively small (but still requiring more space than
// the default maximum length under MSW) number here.
const int NUM_LINES = 10000;
{
wxClipboardLocker lock;
// Build a longish string.
wxString s;
s.reserve(NUM_LINES*5 + 10);
for ( int n = 0; n < NUM_LINES; ++n )
{
s += wxString::Format("%04d\n", n);
}
s += "THE END";
wxTheClipboard->AddData(new wxTextDataObject(s));
}
text->ChangeValue("THE BEGINNING\n");
text->SetInsertionPointEnd();
text->Paste();
const int numLines = text->GetNumberOfLines();
CHECK( numLines == NUM_LINES + 2 );
CHECK( text->GetLineText(numLines - 1) == "THE END" );
}
#endif // wxUSE_CLIPBOARD
TEST_CASE("wxTextCtrl::EventsOnCreate", "[wxTextCtrl][event]")
{
wxWindow* const parent = wxTheApp->GetTopWindow();
EventCounter updated(parent, wxEVT_TEXT);
wxScopedPtr<wxTextCtrl> text(new wxTextCtrl(parent, wxID_ANY, "Hello"));
// Creating the control shouldn't result in any wxEVT_TEXT events.
CHECK( updated.GetCount() == 0 );
// Check that modifying using SetValue() it does generate the event, just
// to verify that this test works (there are more detailed tests for this
// in TextEntryTestCase::TextChangeEvents()).
text->SetValue("Bye");
CHECK( updated.GetCount() == 1 );
}
TEST_CASE("wxTextCtrl::InitialCanUndo", "[wxTextCtrl][undo]")
{
wxWindow* const parent = wxTheApp->GetTopWindow();
const long styles[] = { 0, wxTE_RICH, wxTE_RICH2 };
for ( size_t n = 0; n < WXSIZEOF(styles); n++ )
{
const long style = styles[n];
#ifdef __MINGW32_TOOLCHAIN__
if ( style == wxTE_RICH2 )
{
// We can't call ITextDocument::Undo() in wxMSW code when using
// MinGW32, so this test would always fail with it.
WARN("Skipping test known to fail with MinGW-32.");
}
continue;
#endif // __MINGW32_TOOLCHAIN__
INFO("wxTextCtrl with style " << style);
wxScopedPtr<wxTextCtrl> text(new wxTextCtrl(parent, wxID_ANY, "",
wxDefaultPosition,
wxDefaultSize,
style));
CHECK( !text->CanUndo() );
}
}
#endif //wxUSE_TEXTCTRL

View File

@@ -10,13 +10,19 @@
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/dialog.h"
#include "wx/event.h"
#include "wx/sizer.h"
#include "wx/textctrl.h"
#include "wx/textentry.h"
#include "wx/timer.h"
#include "wx/window.h"
#endif // WX_PRECOMP
#include "textentrytest.h"
#include "testableframe.h"
#include "wx/scopedptr.h"
#include "wx/uiaction.h"
void TextEntryTestCase::SetValue()
@@ -45,17 +51,25 @@ void TextEntryTestCase::TextChangeEvents()
wxTextEntry * const entry = GetTestEntry();
// notice that SetValue() generates an event even if the text didn't change
#ifndef __WXQT__
entry->SetValue("");
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
updated.Clear();
#else
WARN("Events are only sent when text changes in WxQt");
#endif
entry->SetValue("foo");
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
updated.Clear();
#ifndef __WXQT__
entry->SetValue("foo");
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
updated.Clear();
#else
WARN("Events are only sent when text changes in WxQt");
#endif
entry->SetValue("");
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
@@ -157,6 +171,12 @@ void TextEntryTestCase::InsertionPoint()
CPPUNIT_ASSERT_EQUAL( 3, entry->GetLastPosition() );
CPPUNIT_ASSERT_EQUAL( 1, entry->GetInsertionPoint() );
entry->SetValue("012"); // shouldn't change the position if no real change
CPPUNIT_ASSERT_EQUAL( 1, entry->GetInsertionPoint() );
entry->ChangeValue("012"); // same as for SetValue()
CPPUNIT_ASSERT_EQUAL( 1, entry->GetInsertionPoint() );
entry->SetInsertionPointEnd();
CPPUNIT_ASSERT_EQUAL( 3, entry->GetInsertionPoint() );
@@ -193,6 +213,28 @@ void TextEntryTestCase::Replace()
CPPUNIT_ASSERT_EQUAL(2, entry->GetInsertionPoint());
}
void TextEntryTestCase::WriteText()
{
wxTextEntry * const entry = GetTestEntry();
entry->SetValue("foo");
entry->SetInsertionPoint(3);
entry->WriteText("bar");
CPPUNIT_ASSERT_EQUAL( "foobar", entry->GetValue() );
entry->SetValue("foo");
entry->SetInsertionPoint(0);
entry->WriteText("bar");
CPPUNIT_ASSERT_EQUAL( "barfoo", entry->GetValue() );
entry->SetValue("abxxxhi");
entry->SetSelection(2, 5);
entry->WriteText("cdefg");
CPPUNIT_ASSERT_EQUAL( "abcdefghi", entry->GetValue() );
CPPUNIT_ASSERT_EQUAL( 7, entry->GetInsertionPoint() );
CPPUNIT_ASSERT_EQUAL( false, entry->HasSelection() );
}
#if wxUSE_UIACTIONSIMULATOR
class TextEventHandler
@@ -250,6 +292,7 @@ void TextEntryTestCase::Editable()
CPPUNIT_ASSERT_EQUAL("abcdef", entry->GetValue());
CPPUNIT_ASSERT_EQUAL(6, updated.GetCount());
wxYield();
// And that the event carries the right value.
TextEventHandler handler(window);
@@ -328,3 +371,193 @@ void TextEntryTestCase::UndoRedo()
}
}
}
#if wxUSE_UIACTIONSIMULATOR
namespace
{
enum ProcessEnter
{
ProcessEnter_No,
ProcessEnter_ButSkip,
ProcessEnter_WithoutSkipping
};
class TestDialog : public wxDialog
{
public:
explicit TestDialog(const TextLikeControlCreator& controlCreator,
ProcessEnter processEnter)
: wxDialog(wxTheApp->GetTopWindow(), wxID_ANY, "Test dialog"),
m_control
(
controlCreator.Create
(
this,
processEnter == ProcessEnter_No ? 0 : wxTE_PROCESS_ENTER
)
),
m_processEnter(processEnter),
m_gotEnter(false)
{
wxSizer* const sizer = new wxBoxSizer(wxVERTICAL);
sizer->Add(m_control, wxSizerFlags().Expand());
sizer->Add(CreateStdDialogButtonSizer(wxOK));
SetSizerAndFit(sizer);
CallAfter(&TestDialog::SimulateEnter);
m_timer.Bind(wxEVT_TIMER, &TestDialog::OnTimeOut, this);
m_timer.StartOnce(2000);
}
bool GotEnter() const { return m_gotEnter; }
private:
void OnTextEnter(wxCommandEvent& e)
{
m_gotEnter = true;
switch ( m_processEnter )
{
case ProcessEnter_No:
FAIL("Shouldn't be getting wxEVT_TEXT_ENTER at all");
break;
case ProcessEnter_ButSkip:
e.Skip();
break;
case ProcessEnter_WithoutSkipping:
// Close the dialog with a different exit code than what
// pressing the OK button would have generated.
EndModal(wxID_APPLY);
break;
}
}
void OnText(wxCommandEvent& WXUNUSED(e))
{
// This should only happen for the multiline text controls.
switch ( m_processEnter )
{
case ProcessEnter_No:
case ProcessEnter_ButSkip:
// We consider that the text succeeded, but in a different way,
// so use a different ID to be able to distinguish between this
// scenario and Enter activating the default button.
EndModal(wxID_CLOSE);
break;
case ProcessEnter_WithoutSkipping:
FAIL("Shouldn't be getting wxEVT_TEXT if handled");
break;
}
}
void OnTimeOut(wxTimerEvent&)
{
EndModal(wxID_CANCEL);
}
void SimulateEnter()
{
wxUIActionSimulator sim;
m_control->SetFocus();
sim.Char(WXK_RETURN);
}
wxControl* const m_control;
const ProcessEnter m_processEnter;
wxTimer m_timer;
bool m_gotEnter;
wxDECLARE_EVENT_TABLE();
};
// Note that we must use event table macros here instead of Bind() because
// binding wxEVT_TEXT_ENTER handler for a control without wxTE_PROCESS_ENTER
// style would fail with an assertion failure, due to wx helpfully complaining
// about it.
wxBEGIN_EVENT_TABLE(TestDialog, wxDialog)
EVT_TEXT(wxID_ANY, TestDialog::OnText)
EVT_TEXT_ENTER(wxID_ANY, TestDialog::OnTextEnter)
wxEND_EVENT_TABLE()
} // anonymous namespace
void TestProcessEnter(const TextLikeControlCreator& controlCreator)
{
if ( !EnableUITests() )
{
WARN("Skipping wxTE_PROCESS_ENTER tests: wxUIActionSimulator use disabled");
return;
}
SECTION("Without wxTE_PROCESS_ENTER")
{
TestDialog dlg(controlCreator, ProcessEnter_No);
REQUIRE( dlg.ShowModal() == wxID_OK );
CHECK( !dlg.GotEnter() );
}
SECTION("With wxTE_PROCESS_ENTER but skipping")
{
TestDialog dlgProcessEnter(controlCreator, ProcessEnter_ButSkip);
REQUIRE( dlgProcessEnter.ShowModal() == wxID_OK );
CHECK( dlgProcessEnter.GotEnter() );
}
SECTION("With wxTE_PROCESS_ENTER without skipping")
{
TestDialog dlgProcessEnter(controlCreator, ProcessEnter_WithoutSkipping);
REQUIRE( dlgProcessEnter.ShowModal() == wxID_APPLY );
CHECK( dlgProcessEnter.GotEnter() );
}
SECTION("Without wxTE_PROCESS_ENTER but with wxTE_MULTILINE")
{
wxScopedPtr<TextLikeControlCreator>
multiLineCreator(controlCreator.CloneAsMultiLine());
if ( !multiLineCreator )
return;
TestDialog dlg(*multiLineCreator, ProcessEnter_No);
REQUIRE( dlg.ShowModal() == wxID_CLOSE );
CHECK( !dlg.GotEnter() );
}
SECTION("With wxTE_PROCESS_ENTER and wxTE_MULTILINE but skipping")
{
wxScopedPtr<TextLikeControlCreator>
multiLineCreator(controlCreator.CloneAsMultiLine());
if ( !multiLineCreator )
return;
TestDialog dlg(*multiLineCreator, ProcessEnter_ButSkip);
REQUIRE( dlg.ShowModal() == wxID_CLOSE );
CHECK( dlg.GotEnter() );
}
SECTION("With wxTE_PROCESS_ENTER and wxTE_MULTILINE without skipping")
{
wxScopedPtr<TextLikeControlCreator>
multiLineCreator(controlCreator.CloneAsMultiLine());
if ( !multiLineCreator )
return;
TestDialog dlg(*multiLineCreator, ProcessEnter_WithoutSkipping);
REQUIRE( dlg.ShowModal() == wxID_APPLY );
CHECK( dlg.GotEnter() );
}
}
#else // !wxUSE_UIACTIONSIMULATOR
void TestProcessEnter(const TextLikeControlCreator& WXUNUSED(controlCreator))
{
WARN("Skipping wxTE_PROCESS_ENTER tests: wxUIActionSimulator not available");
}
#endif // wxUSE_UIACTIONSIMULATOR/!wxUSE_UIACTIONSIMULATOR

View File

@@ -44,7 +44,8 @@ protected:
WXUISIM_TEST( Editable ); \
CPPUNIT_TEST( Hint ); \
CPPUNIT_TEST( CopyPaste ); \
CPPUNIT_TEST( UndoRedo )
CPPUNIT_TEST( UndoRedo ); \
CPPUNIT_TEST( WriteText )
void SetValue();
void TextChangeEvents();
@@ -55,6 +56,7 @@ protected:
void Hint();
void CopyPaste();
void UndoRedo();
void WriteText();
private:
// Selection() test helper: verify that selection is as described by the
@@ -73,4 +75,32 @@ private:
wxDECLARE_NO_COPY_CLASS(TextEntryTestCase);
};
// Helper used for creating the control of the specific type (currently either
// wxTextCtrl or wxComboBox) with the given flag.
class TextLikeControlCreator
{
public:
TextLikeControlCreator() {}
// Create the control of the right type using the given parent and style.
virtual wxControl* Create(wxWindow* parent, int style) const = 0;
// Return another creator similar to this one, but creating multiline
// version of the control. If the returned pointer is non-null, it must be
// deleted by the caller.
virtual TextLikeControlCreator* CloneAsMultiLine() const { return NULL; }
// Give it a virtual dtor to avoid warnings even though this class is not
// supposed to be used polymorphically.
virtual ~TextLikeControlCreator() {}
private:
wxDECLARE_NO_COPY_CLASS(TextLikeControlCreator);
};
// Use the given control creator to check that various combinations of
// specifying and not specifying wxTE_PROCESS_ENTER and handling or not
// handling the resulting event work as expected.
void TestProcessEnter(const TextLikeControlCreator& controlCreator);
#endif // _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_

View File

@@ -10,9 +10,6 @@
#if wxUSE_TOGGLEBTN
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"

View File

@@ -10,9 +10,6 @@
#if wxUSE_TOOLBOOK
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"

View File

@@ -10,9 +10,6 @@
#if wxUSE_TREEBOOK
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"

View File

@@ -15,9 +15,6 @@
#if wxUSE_TREECTRL
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -49,10 +46,8 @@ private:
CPPUNIT_TEST( DeleteAllItems );
WXUISIM_TEST( LabelEdit );
WXUISIM_TEST( KeyDown );
#ifndef __WXGTK__
WXUISIM_TEST( CollapseExpandEvents );
WXUISIM_TEST( SelectionChange );
#endif // !__WXGTK__
WXUISIM_TEST( Menu );
CPPUNIT_TEST( ItemData );
CPPUNIT_TEST( Iteration );
@@ -70,6 +65,7 @@ private:
CPPUNIT_TEST( SelectItemMulti );
CPPUNIT_TEST( PseudoTest_SetHiddenRoot );
CPPUNIT_TEST( HasChildren );
CPPUNIT_TEST( GetCount );
CPPUNIT_TEST_SUITE_END();
void ItemClick();
@@ -78,10 +74,8 @@ private:
void DeleteAllItems();
void LabelEdit();
void KeyDown();
#ifndef __WXGTK__
void CollapseExpandEvents();
void SelectionChange();
#endif // !__WXGTK__
void Menu();
void ItemData();
void Iteration();
@@ -94,6 +88,7 @@ private:
void Sort();
void KeyNavigation();
void HasChildren();
void GetCount();
void SelectItemSingle();
void SelectItemMulti();
void PseudoTest_MultiSelect() { ms_multiSelect = true; }
@@ -175,6 +170,11 @@ void TreeCtrlTestCase::HasChildren()
CPPUNIT_ASSERT( !m_tree->HasChildren(m_grandchild) );
}
void TreeCtrlTestCase::GetCount()
{
CPPUNIT_ASSERT_EQUAL(3, m_tree->GetCount());
}
void TreeCtrlTestCase::SelectItemSingle()
{
// this test should be only ran in single-selection control
@@ -237,6 +237,15 @@ void TreeCtrlTestCase::SelectItemMulti()
m_tree->UnselectItem(m_child1);
CPPUNIT_ASSERT( !m_tree->IsSelected(m_child1) );
CPPUNIT_ASSERT( m_tree->IsSelected(m_child2) );
// collapsing a branch with selected items should still leave them selected
m_tree->Expand(m_child1);
m_tree->SelectItem(m_grandchild);
CHECK( m_tree->IsSelected(m_grandchild) );
m_tree->Collapse(m_child1);
CHECK( m_tree->IsSelected(m_grandchild) );
m_tree->Expand(m_child1);
CHECK( m_tree->IsSelected(m_grandchild) );
}
void TreeCtrlTestCase::ItemClick()
@@ -272,9 +281,10 @@ void TreeCtrlTestCase::DeleteItem()
EventCounter deleteitem(m_tree, wxEVT_TREE_DELETE_ITEM);
wxTreeItemId todelete = m_tree->AppendItem(m_root, "deleteme");
m_tree->AppendItem(todelete, "deleteme2");
m_tree->Delete(todelete);
CPPUNIT_ASSERT_EQUAL(1, deleteitem.GetCount());
CPPUNIT_ASSERT_EQUAL(2, deleteitem.GetCount());
}
void TreeCtrlTestCase::DeleteChildren()
@@ -332,10 +342,14 @@ void TreeCtrlTestCase::KeyDown()
CPPUNIT_ASSERT_EQUAL(6, keydown.GetCount());
}
#if !defined(__WXGTK__)
void TreeCtrlTestCase::CollapseExpandEvents()
{
#ifdef __WXGTK20__
// Works locally, but not when run on Travis CI.
if ( IsAutomaticTest() )
return;
#endif
m_tree->CollapseAll();
EventCounter collapsed(m_tree, wxEVT_TREE_ITEM_COLLAPSED);
@@ -360,6 +374,12 @@ void TreeCtrlTestCase::CollapseExpandEvents()
CPPUNIT_ASSERT_EQUAL(1, expanding.GetCount());
CPPUNIT_ASSERT_EQUAL(1, expanded.GetCount());
#ifdef __WXGTK__
// Don't even know the reason why, but GTK has to sleep
// no less than 1200 for the test case to succeed.
wxMilliSleep(1200);
#endif
sim.MouseDblClick();
wxYield();
@@ -411,8 +431,6 @@ void TreeCtrlTestCase::SelectionChange()
CPPUNIT_ASSERT_EQUAL(2, changing.GetCount());
}
#endif // !__WXGTK__
void TreeCtrlTestCase::Menu()
{
EventCounter menu(m_tree, wxEVT_TREE_ITEM_MENU);
@@ -595,12 +613,13 @@ void TreeCtrlTestCase::Sort()
void TreeCtrlTestCase::KeyNavigation()
{
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
#if wxUSE_UIACTIONSIMULATOR
wxUIActionSimulator sim;
m_tree->CollapseAll();
m_tree->SelectItem(m_root);
wxYield();
m_tree->SetFocus();
sim.Char(WXK_RIGHT);
@@ -618,6 +637,8 @@ void TreeCtrlTestCase::KeyNavigation()
CPPUNIT_ASSERT(!m_tree->IsExpanded(m_root));
wxYield();
sim.Char(WXK_RIGHT);
sim.Char(WXK_DOWN);
wxYield();

View File

@@ -14,9 +14,6 @@
#if wxUSE_TREELISTCTRL
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/treelist.h"

View File

@@ -14,15 +14,14 @@
#if wxUSE_LISTCTRL
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
#endif // WX_PRECOMP
#include "wx/listctrl.h"
#include "testableframe.h"
#include "wx/uiaction.h"
// ----------------------------------------------------------------------------
// test class
@@ -39,9 +38,11 @@ public:
private:
CPPUNIT_TEST_SUITE( VirtListCtrlTestCase );
CPPUNIT_TEST( UpdateSelection );
WXUISIM_TEST( DeselectedEvent );
CPPUNIT_TEST_SUITE_END();
void UpdateSelection();
void DeselectedEvent();
wxListCtrl *m_list;
@@ -105,4 +106,42 @@ void VirtListCtrlTestCase::UpdateSelection()
CPPUNIT_ASSERT_EQUAL( 1, m_list->GetSelectedItemCount() );
}
void VirtListCtrlTestCase::DeselectedEvent()
{
#if wxUSE_UIACTIONSIMULATOR
m_list->AppendColumn("Col0");
m_list->SetItemCount(1);
wxListCtrl* const list = m_list;
EventCounter selected(list, wxEVT_LIST_ITEM_SELECTED);
EventCounter deselected(list, wxEVT_LIST_ITEM_DESELECTED);
wxUIActionSimulator sim;
wxRect pos;
list->GetItemRect(0, pos);
//We move in slightly so we are not on the edge
wxPoint point = list->ClientToScreen(pos.GetPosition()) + wxPoint(10, 10);
sim.MouseMove(point);
wxYield();
sim.MouseClick();
wxYield();
// We want a point within the listctrl but below any items
point = list->ClientToScreen(pos.GetPosition()) + wxPoint(10, 50);
sim.MouseMove(point);
wxYield();
sim.MouseClick();
wxYield();
CPPUNIT_ASSERT_EQUAL(1, selected.GetCount());
CPPUNIT_ASSERT_EQUAL(1, deselected.GetCount());
#endif
}
#endif // wxUSE_LISTCTRL

View File

@@ -10,381 +10,370 @@
#if wxUSE_WEBVIEW && (wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_WEBKIT2 || wxUSE_WEBVIEW_IE)
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
#endif // WX_PRECOMP
#include "testableframe.h"
#include "wx/uiaction.h"
#include "wx/webview.h"
#include "asserthelper.h"
#if wxUSE_WEBVIEW_IE
#include "wx/msw/webview_ie.h"
#endif
class WebTestCase : public CppUnit::TestCase
{
public:
WebTestCase() { }
void setUp() wxOVERRIDE;
void tearDown() wxOVERRIDE;
private:
CPPUNIT_TEST_SUITE( WebTestCase );
CPPUNIT_TEST( Title );
CPPUNIT_TEST( Url );
CPPUNIT_TEST( History );
#if !wxUSE_WEBVIEW_WEBKIT2
//This is not implemented on WEBKIT2. See implementation.
CPPUNIT_TEST( HistoryEnable );
CPPUNIT_TEST( HistoryClear );
#if wxUSE_WEBVIEW_WEBKIT2
#include "wx/stopwatch.h"
#endif
CPPUNIT_TEST( HistoryList );
CPPUNIT_TEST( Editable );
CPPUNIT_TEST( Selection );
CPPUNIT_TEST( Zoom );
CPPUNIT_TEST( RunScript );
CPPUNIT_TEST( SetPage );
CPPUNIT_TEST_SUITE_END();
void Title();
void Url();
void History();
void HistoryEnable();
void HistoryClear();
void HistoryList();
void Editable();
void Selection();
void Zoom();
void RunScript();
void SetPage();
void LoadUrl(int times = 1);
wxWebView* m_browser;
EventCounter* m_loaded;
wxDECLARE_NO_COPY_CLASS(WebTestCase);
};
//Convenience macro
#define ENSURE_LOADED WX_ASSERT_EVENT_OCCURS_IN((*m_loaded), 1, 1000)
#define ENSURE_LOADED CHECK( m_loaded->WaitEvent() )
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( WebTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( WebTestCase, "WebTestCase" );
void WebTestCase::setUp()
class WebViewTestCase
{
m_browser = wxWebView::New();
m_loaded = new EventCounter(m_browser, wxEVT_WEBVIEW_LOADED);
public:
WebViewTestCase()
: m_browser(wxWebView::New()),
m_loaded(new EventCounter(m_browser, wxEVT_WEBVIEW_LOADED))
{
}
~WebViewTestCase()
{
delete m_loaded;
delete m_browser;
}
protected:
void LoadUrl(int times = 1)
{
//We alternate between urls as otherwise webkit merges them in the history
//we use about and about blank to avoid the need for a network connection
for(int i = 0; i < times; i++)
{
if(i % 2 == 1)
m_browser->LoadURL("about:blank");
else
m_browser->LoadURL("about:");
ENSURE_LOADED;
}
}
wxWebView* const m_browser;
EventCounter* const m_loaded;
};
TEST_CASE_METHOD(WebViewTestCase, "WebView", "[wxWebView]")
{
#if defined(__WXGTK__) && !defined(__WXGTK3__)
wxString value;
if ( !wxGetEnv("wxTEST_WEBVIEW_GTK2", &value) || value != "1" )
{
WARN("Skipping WebView tests known to fail with wxGTK 2, set "
"wxTEST_WEBVIEW_GTK2=1 to force running them.");
return;
}
#endif
m_browser -> Create(wxTheApp->GetTopWindow(), wxID_ANY);
ENSURE_LOADED;
}
void WebTestCase::tearDown()
{
wxDELETE(m_loaded);
wxDELETE(m_browser);
}
void WebTestCase::LoadUrl(int times)
{
//We alternate between urls as otherwise webkit merges them in the history
//we use about and about blank to avoid the need for a network connection
for(int i = 0; i < times; i++)
SECTION("Title")
{
if(i % 2 == 1)
m_browser->LoadURL("about:blank");
else
m_browser->LoadURL("about:");
CHECK(m_browser->GetCurrentTitle() == "");
//Test title after loading raw html
m_browser->SetPage("<html><title>Title</title><body>Text</body></html>", "");
ENSURE_LOADED;
}
}
CHECK(m_browser->GetCurrentTitle() == "Title");
void WebTestCase::Title()
{
CPPUNIT_ASSERT_EQUAL("", m_browser->GetCurrentTitle());
//Test title after loading raw html
m_browser->SetPage("<html><title>Title</title><body>Text</body></html>", "");
ENSURE_LOADED;
CPPUNIT_ASSERT_EQUAL("Title", m_browser->GetCurrentTitle());
//Test title after loading a url, we yield to let events process
LoadUrl();
CPPUNIT_ASSERT_EQUAL("", m_browser->GetCurrentTitle());
}
void WebTestCase::Url()
{
CPPUNIT_ASSERT_EQUAL("about:blank", m_browser->GetCurrentURL());
//After first loading about:blank the next in the sequence is about:
LoadUrl();
CPPUNIT_ASSERT_EQUAL("about:", m_browser->GetCurrentURL());
}
void WebTestCase::History()
{
LoadUrl(3);
CPPUNIT_ASSERT(m_browser->CanGoBack());
CPPUNIT_ASSERT(!m_browser->CanGoForward());
m_browser->GoBack();
ENSURE_LOADED;
CPPUNIT_ASSERT(m_browser->CanGoBack());
CPPUNIT_ASSERT(m_browser->CanGoForward());
m_browser->GoBack();
ENSURE_LOADED;
m_browser->GoBack();
ENSURE_LOADED;
//We should now be at the start of the history
CPPUNIT_ASSERT(!m_browser->CanGoBack());
CPPUNIT_ASSERT(m_browser->CanGoForward());
}
void WebTestCase::HistoryEnable()
{
LoadUrl();
m_browser->EnableHistory(false);
CPPUNIT_ASSERT(!m_browser->CanGoForward());
CPPUNIT_ASSERT(!m_browser->CanGoBack());
LoadUrl();
CPPUNIT_ASSERT(!m_browser->CanGoForward());
CPPUNIT_ASSERT(!m_browser->CanGoBack());
}
void WebTestCase::HistoryClear()
{
LoadUrl(2);
//Now we are in the 'middle' of the history
m_browser->GoBack();
ENSURE_LOADED;
CPPUNIT_ASSERT(m_browser->CanGoForward());
CPPUNIT_ASSERT(m_browser->CanGoBack());
m_browser->ClearHistory();
CPPUNIT_ASSERT(!m_browser->CanGoForward());
CPPUNIT_ASSERT(!m_browser->CanGoBack());
}
void WebTestCase::HistoryList()
{
LoadUrl(2);
m_browser->GoBack();
ENSURE_LOADED;
CPPUNIT_ASSERT_EQUAL(1, m_browser->GetBackwardHistory().size());
CPPUNIT_ASSERT_EQUAL(1, m_browser->GetForwardHistory().size());
m_browser->LoadHistoryItem(m_browser->GetForwardHistory()[0]);
ENSURE_LOADED;
CPPUNIT_ASSERT(!m_browser->CanGoForward());
CPPUNIT_ASSERT_EQUAL(2, m_browser->GetBackwardHistory().size());
}
void WebTestCase::Editable()
{
CPPUNIT_ASSERT(!m_browser->IsEditable());
m_browser->SetEditable(true);
CPPUNIT_ASSERT(m_browser->IsEditable());
m_browser->SetEditable(false);
CPPUNIT_ASSERT(!m_browser->IsEditable());
}
void WebTestCase::Selection()
{
m_browser->SetPage("<html><body>Some <strong>strong</strong> text</body></html>", "");
ENSURE_LOADED;
CPPUNIT_ASSERT(!m_browser->HasSelection());
m_browser->SelectAll();
CPPUNIT_ASSERT(m_browser->HasSelection());
CPPUNIT_ASSERT_EQUAL("Some strong text", m_browser->GetSelectedText());
// The web engine doesn't necessarily represent the HTML in the same way as
// we used above, e.g. IE uses upper case for all the tags while WebKit
// under OS X inserts plenty of its own <span> tags, so don't test for
// equality and just check that the source contains things we'd expect it
// to.
const wxString selSource = m_browser->GetSelectedSource();
WX_ASSERT_MESSAGE
(
("Unexpected selection source: \"%s\"", selSource),
selSource.Lower().Matches("*some*<strong*strong</strong>*text*")
);
m_browser->ClearSelection();
CPPUNIT_ASSERT(!m_browser->HasSelection());
}
void WebTestCase::Zoom()
{
if(m_browser->CanSetZoomType(wxWEBVIEW_ZOOM_TYPE_LAYOUT))
{
m_browser->SetZoomType(wxWEBVIEW_ZOOM_TYPE_LAYOUT);
CPPUNIT_ASSERT_EQUAL(wxWEBVIEW_ZOOM_TYPE_LAYOUT, m_browser->GetZoomType());
m_browser->SetZoom(wxWEBVIEW_ZOOM_TINY);
CPPUNIT_ASSERT_EQUAL(wxWEBVIEW_ZOOM_TINY, m_browser->GetZoom());
//Test title after loading a url, we yield to let events process
LoadUrl();
CHECK(m_browser->GetCurrentTitle() == "");
}
//Reset the zoom level
m_browser->SetZoom(wxWEBVIEW_ZOOM_MEDIUM);
if(m_browser->CanSetZoomType(wxWEBVIEW_ZOOM_TYPE_TEXT))
SECTION("URL")
{
m_browser->SetZoomType(wxWEBVIEW_ZOOM_TYPE_TEXT);
CPPUNIT_ASSERT_EQUAL(wxWEBVIEW_ZOOM_TYPE_TEXT, m_browser->GetZoomType());
CHECK(m_browser->GetCurrentURL() == "about:blank");
m_browser->SetZoom(wxWEBVIEW_ZOOM_TINY);
CPPUNIT_ASSERT_EQUAL(wxWEBVIEW_ZOOM_TINY, m_browser->GetZoom());
//After first loading about:blank the next in the sequence is about:
LoadUrl();
CHECK(m_browser->GetCurrentURL() == "about:");
}
}
void WebTestCase::RunScript()
{
m_browser->
SetPage("<html><head><script></script></head><body></body></html>", "");
ENSURE_LOADED;
wxString result;
#if wxUSE_WEBVIEW_IE
CPPUNIT_ASSERT(wxWebViewIE::MSWSetModernEmulationLevel());
// Define a specialized scope guard ensuring that we reset the emulation
// level to its default value even if any asserts below fail.
class ResetEmulationLevel
SECTION("History")
{
public:
ResetEmulationLevel()
LoadUrl(3);
CHECK(m_browser->CanGoBack());
CHECK(!m_browser->CanGoForward());
m_browser->GoBack();
ENSURE_LOADED;
CHECK(m_browser->CanGoBack());
CHECK(m_browser->CanGoForward());
m_browser->GoBack();
ENSURE_LOADED;
m_browser->GoBack();
ENSURE_LOADED;
//We should now be at the start of the history
CHECK(!m_browser->CanGoBack());
CHECK(m_browser->CanGoForward());
}
#if !wxUSE_WEBVIEW_WEBKIT2
SECTION("HistoryEnable")
{
LoadUrl();
m_browser->EnableHistory(false);
CHECK(!m_browser->CanGoForward());
CHECK(!m_browser->CanGoBack());
LoadUrl();
CHECK(!m_browser->CanGoForward());
CHECK(!m_browser->CanGoBack());
}
#endif
#if !wxUSE_WEBVIEW_WEBKIT2
SECTION("HistoryClear")
{
LoadUrl(2);
//Now we are in the 'middle' of the history
m_browser->GoBack();
ENSURE_LOADED;
CHECK(m_browser->CanGoForward());
CHECK(m_browser->CanGoBack());
m_browser->ClearHistory();
CHECK(!m_browser->CanGoForward());
CHECK(!m_browser->CanGoBack());
}
#endif
SECTION("HistoryList")
{
LoadUrl(2);
m_browser->GoBack();
ENSURE_LOADED;
CHECK(m_browser->GetBackwardHistory().size() == 1);
CHECK(m_browser->GetForwardHistory().size() == 1);
m_browser->LoadHistoryItem(m_browser->GetForwardHistory()[0]);
ENSURE_LOADED;
CHECK(!m_browser->CanGoForward());
CHECK(m_browser->GetBackwardHistory().size() == 2);
}
SECTION("Editable")
{
CHECK(!m_browser->IsEditable());
m_browser->SetEditable(true);
CHECK(m_browser->IsEditable());
m_browser->SetEditable(false);
CHECK(!m_browser->IsEditable());
}
SECTION("Selection")
{
m_browser->SetPage("<html><body>Some <strong>strong</strong> text</body></html>", "");
ENSURE_LOADED;
CHECK(!m_browser->HasSelection());
m_browser->SelectAll();
#if wxUSE_WEBVIEW_WEBKIT2
// With WebKit SelectAll() sends a request to perform the selection to
// another process via proxy and there doesn't seem to be any way to
// wait until this request is actually handled, so loop here for some a
// bit before giving up.
for ( wxStopWatch sw; !m_browser->HasSelection() && sw.Time() < 50; )
wxMilliSleep(1);
#endif // wxUSE_WEBVIEW_WEBKIT2
CHECK(m_browser->HasSelection());
CHECK(m_browser->GetSelectedText() == "Some strong text");
// The web engine doesn't necessarily represent the HTML in the same way as
// we used above, e.g. IE uses upper case for all the tags while WebKit
// under OS X inserts plenty of its own <span> tags, so don't test for
// equality and just check that the source contains things we'd expect it
// to.
const wxString selSource = m_browser->GetSelectedSource();
WX_ASSERT_MESSAGE
(
("Unexpected selection source: \"%s\"", selSource),
selSource.Lower().Matches("*some*<strong*strong</strong>*text*")
);
m_browser->ClearSelection();
CHECK(!m_browser->HasSelection());
}
SECTION("Zoom")
{
if(m_browser->CanSetZoomType(wxWEBVIEW_ZOOM_TYPE_LAYOUT))
{
m_reset = true;
m_browser->SetZoomType(wxWEBVIEW_ZOOM_TYPE_LAYOUT);
CHECK(m_browser->GetZoomType() == wxWEBVIEW_ZOOM_TYPE_LAYOUT);
m_browser->SetZoom(wxWEBVIEW_ZOOM_TINY);
CHECK(m_browser->GetZoom() == wxWEBVIEW_ZOOM_TINY);
}
bool DoReset()
//Reset the zoom level
m_browser->SetZoom(wxWEBVIEW_ZOOM_MEDIUM);
if(m_browser->CanSetZoomType(wxWEBVIEW_ZOOM_TYPE_TEXT))
{
m_reset = false;
return wxWebViewIE::MSWSetModernEmulationLevel(false);
}
m_browser->SetZoomType(wxWEBVIEW_ZOOM_TYPE_TEXT);
CHECK(m_browser->GetZoomType() == wxWEBVIEW_ZOOM_TYPE_TEXT);
~ResetEmulationLevel()
m_browser->SetZoom(wxWEBVIEW_ZOOM_TINY);
CHECK(m_browser->GetZoom() == wxWEBVIEW_ZOOM_TINY);
}
}
SECTION("RunScript")
{
m_browser->
SetPage("<html><head><script></script></head><body></body></html>", "");
ENSURE_LOADED;
wxString result;
#if wxUSE_WEBVIEW_IE
CHECK(wxWebViewIE::MSWSetModernEmulationLevel());
// Define a specialized scope guard ensuring that we reset the emulation
// level to its default value even if any asserts below fail.
class ResetEmulationLevel
{
if ( m_reset )
DoReset();
}
public:
ResetEmulationLevel()
{
m_reset = true;
}
private:
bool m_reset;
} resetEmulationLevel;
bool DoReset()
{
m_reset = false;
return wxWebViewIE::MSWSetModernEmulationLevel(false);
}
CPPUNIT_ASSERT(m_browser->RunScript("function f(){var person = new Object();person.name = 'Bar'; \
person.lastName = 'Foo';return person;}f();", &result));
CPPUNIT_ASSERT_EQUAL("{\"name\":\"Bar\",\"lastName\":\"Foo\"}", result);
~ResetEmulationLevel()
{
if ( m_reset )
DoReset();
}
CPPUNIT_ASSERT(m_browser->RunScript("function f(){ return [\"foo\", \"bar\"]; }f();", &result));
CPPUNIT_ASSERT_EQUAL("[\"foo\",\"bar\"]", result);
private:
bool m_reset;
} resetEmulationLevel;
CPPUNIT_ASSERT(m_browser->RunScript("function f(){var d = new Date('10/08/2017 21:30:40'); \
var tzoffset = d.getTimezoneOffset() * 60000; return new Date(d.getTime() - tzoffset);}f();",
&result));
CPPUNIT_ASSERT_EQUAL("\"2017-10-08T21:30:40.000Z\"", result);
CHECK(m_browser->RunScript("function f(){var person = new Object();person.name = 'Bar'; \
person.lastName = 'Foo';return person;}f();", &result));
CHECK(result == "{\"name\":\"Bar\",\"lastName\":\"Foo\"}");
CPPUNIT_ASSERT(resetEmulationLevel.DoReset());
#endif // wxUSE_WEBVIEW_IE
CHECK(m_browser->RunScript("function f(){ return [\"foo\", \"bar\"]; }f();", &result));
CHECK(result == "[\"foo\",\"bar\"]");
CPPUNIT_ASSERT(m_browser->RunScript("document.write(\"Hello World!\");"));
CPPUNIT_ASSERT_EQUAL("Hello World!", m_browser->GetPageText());
CHECK(m_browser->RunScript("function f(){var d = new Date('10/08/2017 21:30:40'); \
var tzoffset = d.getTimezoneOffset() * 60000; return new Date(d.getTime() - tzoffset);}f();",
&result));
CHECK(result == "\"2017-10-08T21:30:40.000Z\"");
CPPUNIT_ASSERT(m_browser->RunScript("function f(a){return a;}f('Hello World!');", &result));
CPPUNIT_ASSERT_EQUAL(_("Hello World!"), result);
CHECK(resetEmulationLevel.DoReset());
#endif // wxUSE_WEBVIEW_IE
CPPUNIT_ASSERT(m_browser->RunScript("function f(a){return a;}f('a\\\'aa\\n\\rb\vb\\tb\\\\ccc\\\"ddd\\b\\fx');", &result));
CPPUNIT_ASSERT_EQUAL(_("a\'aa\n\rb\vb\tb\\ccc\"ddd\b\fx"), result);
CHECK(m_browser->RunScript("document.write(\"Hello World!\");"));
CHECK(m_browser->GetPageText() == "Hello World!");
CPPUNIT_ASSERT(m_browser->RunScript("function f(a){return a;}f(123);", &result));
CPPUNIT_ASSERT_EQUAL(123, wxAtoi(result));
CHECK(m_browser->RunScript("function f(a){return a;}f('Hello World!');", &result));
CHECK(result == _("Hello World!"));
CPPUNIT_ASSERT(m_browser->
RunScript("function f(a){return a;}f(2.34);", &result));
double value;
result.ToDouble(&value);
CPPUNIT_ASSERT_EQUAL(2.34, value);
CHECK(m_browser->RunScript("function f(a){return a;}f('a\\\'aa\\n\\rb\\tb\\\\ccc\\\"ddd\\b\\fx');", &result));
CHECK(result == _("a\'aa\n\rb\tb\\ccc\"ddd\b\fx"));
CPPUNIT_ASSERT(m_browser->RunScript("function f(a){return a;}f(false);", &result));
CPPUNIT_ASSERT_EQUAL("false", result);
CHECK(m_browser->RunScript("function f(a){return a;}f(123);", &result));
CHECK(wxAtoi(result) == 123);
CPPUNIT_ASSERT(m_browser->RunScript("function f(){var person = new Object();person.name = 'Foo'; \
person.lastName = 'Bar';return person;}f();", &result));
CPPUNIT_ASSERT_EQUAL("{\"name\":\"Foo\",\"lastName\":\"Bar\"}", result);
CHECK(m_browser->
RunScript("function f(a){return a;}f(2.34);", &result));
double value;
result.ToDouble(&value);
CHECK(value == 2.34);
CPPUNIT_ASSERT(m_browser->RunScript("function f(){ return [\"foo\", \"bar\"]; }f();", &result));
CPPUNIT_ASSERT_EQUAL("[\"foo\",\"bar\"]", result);
CHECK(m_browser->RunScript("function f(a){return a;}f(false);", &result));
CHECK(result == "false");
CPPUNIT_ASSERT(m_browser->RunScript("function f(){var person = new Object();}f();", &result));
CPPUNIT_ASSERT_EQUAL("undefined", result);
CHECK(m_browser->RunScript("function f(){var person = new Object();person.name = 'Foo'; \
person.lastName = 'Bar';return person;}f();", &result));
CHECK(result == "{\"name\":\"Foo\",\"lastName\":\"Bar\"}");
CPPUNIT_ASSERT(m_browser->RunScript("function f(){return null;}f();", &result));
CPPUNIT_ASSERT_EQUAL("null", result);
CHECK(m_browser->RunScript("function f(){ return [\"foo\", \"bar\"]; }f();", &result));
CHECK(result == "[\"foo\",\"bar\"]");
result = "";
CPPUNIT_ASSERT(!m_browser->RunScript("int main() { return 0; }", &result));
CPPUNIT_ASSERT(!result);
CHECK(m_browser->RunScript("function f(){var person = new Object();}f();", &result));
CHECK(result == "undefined");
CPPUNIT_ASSERT(m_browser->RunScript("function a() { return eval(\"function b() { \
return eval(\\\"function c() { return eval(\\\\\\\"function d() { \
return \\\\\\\\\\\\\\\"test\\\\\\\\\\\\\\\"; } d();\\\\\\\"); } \
c();\\\"); } b();\"); } a();", &result));
CPPUNIT_ASSERT_EQUAL("test", result);
CHECK(m_browser->RunScript("function f(){return null;}f();", &result));
CHECK(result == "null");
CPPUNIT_ASSERT(m_browser->RunScript("function f(a){return a;}f(\"This is a backslash: \\\\\");",
&result));
CPPUNIT_ASSERT_EQUAL("This is a backslash: \\", result);
result = "";
CHECK(!m_browser->RunScript("int main() { return 0; }", &result));
CHECK(!result);
CPPUNIT_ASSERT(m_browser->RunScript("function f(){var d = new Date('10/08/2016 21:30:40'); \
var tzoffset = d.getTimezoneOffset() * 60000; return new Date(d.getTime() - tzoffset);}f();",
&result));
CPPUNIT_ASSERT_EQUAL("\"2016-10-08T21:30:40.000Z\"", result);
CHECK(m_browser->RunScript("function a() { return eval(\"function b() { \
return eval(\\\"function c() { return eval(\\\\\\\"function d() { \
return \\\\\\\\\\\\\\\"test\\\\\\\\\\\\\\\"; } d();\\\\\\\"); } \
c();\\\"); } b();\"); } a();", &result));
CHECK(result == "test");
// Check for errors too.
CPPUNIT_ASSERT(!m_browser->RunScript("syntax(error"));
CPPUNIT_ASSERT(!m_browser->RunScript("syntax(error", &result));
CPPUNIT_ASSERT(!m_browser->RunScript("x.y.z"));
}
CHECK(m_browser->RunScript("function f(a){return a;}f(\"This is a backslash: \\\\\");",
&result));
CHECK(result == "This is a backslash: \\");
void WebTestCase::SetPage()
{
m_browser->SetPage("<html><body>text</body></html>", "");
ENSURE_LOADED;
CPPUNIT_ASSERT_EQUAL("text", m_browser->GetPageText());
CHECK(m_browser->RunScript("function f(){var d = new Date('10/08/2016 21:30:40'); \
var tzoffset = d.getTimezoneOffset() * 60000; return new Date(d.getTime() - tzoffset);}f();",
&result));
CHECK(result == "\"2016-10-08T21:30:40.000Z\"");
m_browser->SetPage("<html><body>other text</body></html>", "");
ENSURE_LOADED;
CPPUNIT_ASSERT_EQUAL("other text", m_browser->GetPageText());
// Check for C++-style comments which used to be broken.
CHECK(m_browser->RunScript("function f() {\n"
" // A C++ style comment\n"
" return 17;\n"
"}f();", &result));
CHECK(result == "17");
// Check for errors too.
CHECK(!m_browser->RunScript("syntax(error"));
CHECK(!m_browser->RunScript("syntax(error", &result));
CHECK(!m_browser->RunScript("x.y.z"));
}
SECTION("SetPage")
{
m_browser->SetPage("<html><body>text</body></html>", "");
ENSURE_LOADED;
CHECK(m_browser->GetPageText() == "text");
m_browser->SetPage("<html><body>other text</body></html>", "");
ENSURE_LOADED;
CHECK(m_browser->GetPageText() == "other text");
}
}
#endif //wxUSE_WEBVIEW && (wxUSE_WEBVIEW_WEBKIT || wxUSE_WEBVIEW_WEBKIT2 || wxUSE_WEBVIEW_IE)

View File

@@ -8,9 +8,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -21,103 +18,66 @@
#include "asserthelper.h"
#include "testableframe.h"
#include "testwindow.h"
#include "wx/uiaction.h"
#include "wx/caret.h"
#include "wx/cshelp.h"
#include "wx/scopedptr.h"
#include "wx/stopwatch.h"
#include "wx/tooltip.h"
class WindowTestCase : public CppUnit::TestCase
class WindowTestCase
{
public:
WindowTestCase() { }
WindowTestCase()
: m_window(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY))
{
#ifdef __WXGTK3__
// Without this, when running this test suite solo it succeeds,
// but not when running it together with the other tests !!
// Not needed when run under Xvfb display.
for ( wxStopWatch sw; sw.Time() < 50; )
wxYield();
#endif
}
void setUp() wxOVERRIDE;
void tearDown() wxOVERRIDE;
~WindowTestCase()
{
wxTheApp->GetTopWindow()->DestroyChildren();
}
private:
CPPUNIT_TEST_SUITE( WindowTestCase );
CPPUNIT_TEST( ShowHideEvent );
WXUISIM_TEST( KeyEvent );
CPPUNIT_TEST( FocusEvent );
CPPUNIT_TEST( Mouse );
CPPUNIT_TEST( Properties );
#if wxUSE_TOOLTIPS
CPPUNIT_TEST( ToolTip );
#endif // wxUSE_TOOLTIPS
CPPUNIT_TEST( Help );
CPPUNIT_TEST( Parent );
CPPUNIT_TEST( Siblings );
CPPUNIT_TEST( Children );
CPPUNIT_TEST( Focus );
CPPUNIT_TEST( Positioning );
CPPUNIT_TEST( PositioningBeyondShortLimit );
CPPUNIT_TEST( Show );
CPPUNIT_TEST( Enable );
CPPUNIT_TEST( FindWindowBy );
CPPUNIT_TEST_SUITE_END();
void ShowHideEvent();
void KeyEvent();
void FocusEvent();
void Mouse();
void Properties();
#if wxUSE_TOOLTIPS
void ToolTip();
#endif // wxUSE_TOOLTIPS
void Help();
void Parent();
void Siblings();
void Children();
void Focus();
void Positioning();
void PositioningBeyondShortLimit();
void Show();
void Enable();
void FindWindowBy();
wxWindow *m_window;
protected:
wxWindow* const m_window;
wxDECLARE_NO_COPY_CLASS(WindowTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( WindowTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( WindowTestCase, "WindowTestCase" );
void WindowTestCase::setUp()
{
m_window = new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY);
}
void WindowTestCase::tearDown()
{
wxTheApp->GetTopWindow()->DestroyChildren();
}
void WindowTestCase::ShowHideEvent()
TEST_CASE_METHOD(WindowTestCase, "Window::ShowHideEvent", "[window]")
{
#if defined(__WXMSW__)
EventCounter show(m_window, wxEVT_SHOW);
CPPUNIT_ASSERT(m_window->IsShown());
CHECK(m_window->IsShown());
m_window->Show(false);
CPPUNIT_ASSERT(!m_window->IsShown());
CHECK(!m_window->IsShown());
m_window->Show();
CPPUNIT_ASSERT(m_window->IsShown());
CHECK(m_window->IsShown());
CPPUNIT_ASSERT_EQUAL(2, show.GetCount());
CHECK( show.GetCount() == 2 );
#endif // __WXMSW__
}
void WindowTestCase::KeyEvent()
TEST_CASE_METHOD(WindowTestCase, "Window::KeyEvent", "[window]")
{
#if wxUSE_UIACTIONSIMULATOR
if ( !EnableUITests() )
return;
EventCounter keydown(m_window, wxEVT_KEY_DOWN);
EventCounter keyup(m_window, wxEVT_KEY_UP);
EventCounter keychar(m_window, wxEVT_CHAR);
@@ -131,13 +91,13 @@ void WindowTestCase::KeyEvent()
sim.Char(WXK_SHIFT);
wxYield();
CPPUNIT_ASSERT_EQUAL(5, keydown.GetCount());
CPPUNIT_ASSERT_EQUAL(5, keyup.GetCount());
CPPUNIT_ASSERT_EQUAL(4, keychar.GetCount());
CHECK( keydown.GetCount() == 5 );
CHECK( keyup.GetCount() == 5 );
CHECK( keychar.GetCount() == 4 );
#endif
}
void WindowTestCase::FocusEvent()
TEST_CASE_METHOD(WindowTestCase, "Window::FocusEvent", "[window]")
{
#ifndef __WXOSX__
if ( IsAutomaticTest() )
@@ -152,153 +112,169 @@ void WindowTestCase::FocusEvent()
m_window->SetFocus();
WX_ASSERT_EVENT_OCCURS_IN(setfocus, 1, 500);
CPPUNIT_ASSERT(m_window->HasFocus());
CHECK(setfocus.WaitEvent(500));
CHECK_FOCUS_IS( m_window );
wxButton* button = new wxButton(wxTheApp->GetTopWindow(), wxID_ANY);
wxYield();
button->SetFocus();
CPPUNIT_ASSERT_EQUAL(1, killfocus.GetCount());
CPPUNIT_ASSERT(!m_window->HasFocus());
CHECK( killfocus.GetCount() == 1 );
CHECK(!m_window->HasFocus());
#endif
}
void WindowTestCase::Mouse()
TEST_CASE_METHOD(WindowTestCase, "Window::Mouse", "[window]")
{
wxCursor cursor(wxCURSOR_CHAR);
m_window->SetCursor(cursor);
CPPUNIT_ASSERT(m_window->GetCursor().IsOk());
CHECK(m_window->GetCursor().IsOk());
//A plain window doesn't have a caret
CPPUNIT_ASSERT(!m_window->GetCaret());
#if wxUSE_CARET
CHECK(!m_window->GetCaret());
wxCaret* caret = NULL;
// Try creating the caret in two different, but normally equivalent, ways.
SECTION("Caret 1-step")
{
caret = new wxCaret(m_window, 16, 16);
}
SECTION("Caret 2-step")
{
caret = new wxCaret();
caret->Create(m_window, 16, 16);
}
wxCaret* caret = new wxCaret(m_window, 16, 16);
m_window->SetCaret(caret);
CPPUNIT_ASSERT(m_window->GetCaret()->IsOk());
CHECK(m_window->GetCaret()->IsOk());
#endif
m_window->CaptureMouse();
CPPUNIT_ASSERT(m_window->HasCapture());
CHECK(m_window->HasCapture());
m_window->ReleaseMouse();
CPPUNIT_ASSERT(!m_window->HasCapture());
CHECK(!m_window->HasCapture());
}
void WindowTestCase::Properties()
TEST_CASE_METHOD(WindowTestCase, "Window::Properties", "[window]")
{
m_window->SetLabel("label");
CPPUNIT_ASSERT_EQUAL("label", m_window->GetLabel());
CHECK( m_window->GetLabel() == "label" );
m_window->SetName("name");
CPPUNIT_ASSERT_EQUAL("name", m_window->GetName());
CHECK( m_window->GetName() == "name" );
//As we used wxID_ANY we should have a negative id
CPPUNIT_ASSERT(m_window->GetId() < 0);
CHECK(m_window->GetId() < 0);
m_window->SetId(wxID_HIGHEST + 10);
CPPUNIT_ASSERT_EQUAL(wxID_HIGHEST + 10, m_window->GetId());
CHECK( m_window->GetId() == wxID_HIGHEST + 10 );
}
#if wxUSE_TOOLTIPS
void WindowTestCase::ToolTip()
TEST_CASE_METHOD(WindowTestCase, "Window::ToolTip", "[window]")
{
CPPUNIT_ASSERT(!m_window->GetToolTip());
CPPUNIT_ASSERT_EQUAL("", m_window->GetToolTipText());
CHECK(!m_window->GetToolTip());
CHECK( m_window->GetToolTipText() == "" );
m_window->SetToolTip("text tip");
CPPUNIT_ASSERT_EQUAL("text tip", m_window->GetToolTipText());
CHECK( m_window->GetToolTipText() == "text tip" );
m_window->UnsetToolTip();
CPPUNIT_ASSERT(!m_window->GetToolTip());
CPPUNIT_ASSERT_EQUAL("", m_window->GetToolTipText());
CHECK(!m_window->GetToolTip());
CHECK( m_window->GetToolTipText() == "" );
wxToolTip* tip = new wxToolTip("other tip");
m_window->SetToolTip(tip);
CPPUNIT_ASSERT_EQUAL(tip, m_window->GetToolTip());
CPPUNIT_ASSERT_EQUAL("other tip", m_window->GetToolTipText());
CHECK( m_window->GetToolTip() == tip );
CHECK( m_window->GetToolTipText() == "other tip" );
}
#endif // wxUSE_TOOLTIPS
void WindowTestCase::Help()
TEST_CASE_METHOD(WindowTestCase, "Window::Help", "[window]")
{
#if wxUSE_HELP
wxHelpProvider::Set(new wxSimpleHelpProvider());
CPPUNIT_ASSERT_EQUAL("", m_window->GetHelpText());
CHECK( m_window->GetHelpText() == "" );
m_window->SetHelpText("helptext");
CPPUNIT_ASSERT_EQUAL("helptext", m_window->GetHelpText());
CHECK( m_window->GetHelpText() == "helptext" );
#endif
}
void WindowTestCase::Parent()
TEST_CASE_METHOD(WindowTestCase, "Window::Parent", "[window]")
{
CPPUNIT_ASSERT_EQUAL(static_cast<wxWindow*>(NULL), m_window->GetGrandParent());
CPPUNIT_ASSERT_EQUAL(wxTheApp->GetTopWindow(), m_window->GetParent());
CHECK( m_window->GetGrandParent() == static_cast<wxWindow*>(NULL) );
CHECK( m_window->GetParent() == wxTheApp->GetTopWindow() );
}
void WindowTestCase::Siblings()
TEST_CASE_METHOD(WindowTestCase, "Window::Siblings", "[window]")
{
CPPUNIT_ASSERT_EQUAL(static_cast<wxWindow*>(NULL), m_window->GetNextSibling());
CPPUNIT_ASSERT_EQUAL(static_cast<wxWindow*>(NULL), m_window->GetPrevSibling());
CHECK( m_window->GetNextSibling() == static_cast<wxWindow*>(NULL) );
CHECK( m_window->GetPrevSibling() == static_cast<wxWindow*>(NULL) );
wxWindow* newwin = new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY);
CPPUNIT_ASSERT_EQUAL(newwin, m_window->GetNextSibling());
CPPUNIT_ASSERT_EQUAL(static_cast<wxWindow*>(NULL), m_window->GetPrevSibling());
CHECK( m_window->GetNextSibling() == newwin );
CHECK( m_window->GetPrevSibling() == static_cast<wxWindow*>(NULL) );
CPPUNIT_ASSERT_EQUAL(static_cast<wxWindow*>(NULL), newwin->GetNextSibling());
CPPUNIT_ASSERT_EQUAL(m_window, newwin->GetPrevSibling());
CHECK( newwin->GetNextSibling() == static_cast<wxWindow*>(NULL) );
CHECK( newwin->GetPrevSibling() == m_window );
wxDELETE(newwin);
}
void WindowTestCase::Children()
TEST_CASE_METHOD(WindowTestCase, "Window::Children", "[window]")
{
CPPUNIT_ASSERT_EQUAL(0, m_window->GetChildren().GetCount());
CHECK( m_window->GetChildren().GetCount() == 0 );
wxWindow* child1 = new wxWindow(m_window, wxID_ANY);
CPPUNIT_ASSERT_EQUAL(1, m_window->GetChildren().GetCount());
CHECK( m_window->GetChildren().GetCount() == 1 );
m_window->RemoveChild(child1);
CPPUNIT_ASSERT_EQUAL(0, m_window->GetChildren().GetCount());
CHECK( m_window->GetChildren().GetCount() == 0 );
child1->SetId(wxID_HIGHEST + 1);
child1->SetName("child1");
m_window->AddChild(child1);
CPPUNIT_ASSERT_EQUAL(1, m_window->GetChildren().GetCount());
CPPUNIT_ASSERT_EQUAL(child1, m_window->FindWindow(wxID_HIGHEST + 1));
CPPUNIT_ASSERT_EQUAL(child1, m_window->FindWindow("child1"));
CHECK( m_window->GetChildren().GetCount() == 1 );
CHECK( m_window->FindWindow(wxID_HIGHEST + 1) == child1 );
CHECK( m_window->FindWindow("child1") == child1 );
m_window->DestroyChildren();
CPPUNIT_ASSERT_EQUAL(0, m_window->GetChildren().GetCount());
CHECK( m_window->GetChildren().GetCount() == 0 );
}
void WindowTestCase::Focus()
TEST_CASE_METHOD(WindowTestCase, "Window::Focus", "[window]")
{
#ifndef __WXOSX__
CPPUNIT_ASSERT(!m_window->HasFocus());
CHECK(!m_window->HasFocus());
if ( m_window->AcceptsFocus() )
{
m_window->SetFocus();
CPPUNIT_ASSERT(m_window->HasFocus());
CHECK_FOCUS_IS(m_window);
}
//Set the focus back to the main window
@@ -307,30 +283,28 @@ void WindowTestCase::Focus()
if ( m_window->AcceptsFocusFromKeyboard() )
{
m_window->SetFocusFromKbd();
CPPUNIT_ASSERT(m_window->HasFocus());
CHECK_FOCUS_IS(m_window);
}
#endif
}
void WindowTestCase::Positioning()
TEST_CASE_METHOD(WindowTestCase, "Window::Positioning", "[window]")
{
//Some basic tests for consistency
int x, y;
m_window->GetPosition(&x, &y);
CPPUNIT_ASSERT_EQUAL(x, m_window->GetPosition().x);
CPPUNIT_ASSERT_EQUAL(y, m_window->GetPosition().y);
CPPUNIT_ASSERT_EQUAL(m_window->GetPosition(),
m_window->GetRect().GetTopLeft());
CHECK( m_window->GetPosition().x == x );
CHECK( m_window->GetPosition().y == y );
CHECK( m_window->GetRect().GetTopLeft() == m_window->GetPosition() );
m_window->GetScreenPosition(&x, &y);
CPPUNIT_ASSERT_EQUAL(x, m_window->GetScreenPosition().x);
CPPUNIT_ASSERT_EQUAL(y, m_window->GetScreenPosition().y);
CPPUNIT_ASSERT_EQUAL(m_window->GetScreenPosition(),
m_window->GetScreenRect().GetTopLeft());
CHECK( m_window->GetScreenPosition().x == x );
CHECK( m_window->GetScreenPosition().y == y );
CHECK( m_window->GetScreenRect().GetTopLeft() == m_window->GetScreenPosition() );
}
void WindowTestCase::PositioningBeyondShortLimit()
TEST_CASE_METHOD(WindowTestCase, "Window::PositioningBeyondShortLimit", "[window]")
{
#ifdef __WXMSW__
//Positioning under MSW is limited to short relative coordinates
@@ -341,19 +315,19 @@ void WindowTestCase::PositioningBeyondShortLimit()
wxWindow* w = new wxWindow(m_window, wxID_ANY,
wxPoint(0, SHRT_MAX + commonDim),
wxSize(commonDim, commonDim));
CPPUNIT_ASSERT_EQUAL(SHRT_MAX + commonDim, w->GetPosition().y);
CHECK( w->GetPosition().y == SHRT_MAX + commonDim );
w->Move(0, 0);
//
//Test window moving beyond SHRT_MAX
w->Move(0, SHRT_MAX + commonDim);
CPPUNIT_ASSERT_EQUAL(SHRT_MAX + commonDim, w->GetPosition().y);
CHECK( w->GetPosition().y == SHRT_MAX + commonDim );
//
//Test window moving below SHRT_MIN
w->Move(0, SHRT_MIN - commonDim);
CPPUNIT_ASSERT_EQUAL(SHRT_MIN - commonDim, w->GetPosition().y);
CHECK( w->GetPosition().y == SHRT_MIN - commonDim );
//
//Test deferred move beyond SHRT_MAX
@@ -367,66 +341,101 @@ void WindowTestCase::PositioningBeyondShortLimit()
sizer->Add(w);
m_window->SetSizer(sizer);
m_window->Layout();
CPPUNIT_ASSERT_EQUAL(SHRT_MAX + commonDim, w->GetPosition().y);
CHECK( w->GetPosition().y == SHRT_MAX + commonDim );
#endif
}
void WindowTestCase::Show()
TEST_CASE_METHOD(WindowTestCase, "Window::Show", "[window]")
{
CPPUNIT_ASSERT(m_window->IsShown());
CHECK(m_window->IsShown());
m_window->Hide();
CPPUNIT_ASSERT(!m_window->IsShown());
CHECK(!m_window->IsShown());
m_window->Show();
CPPUNIT_ASSERT(m_window->IsShown());
CHECK(m_window->IsShown());
m_window->Show(false);
CPPUNIT_ASSERT(!m_window->IsShown());
CHECK(!m_window->IsShown());
m_window->ShowWithEffect(wxSHOW_EFFECT_BLEND);
CPPUNIT_ASSERT(m_window->IsShown());
CHECK(m_window->IsShown());
m_window->HideWithEffect(wxSHOW_EFFECT_BLEND);
CPPUNIT_ASSERT(!m_window->IsShown());
CHECK(!m_window->IsShown());
}
void WindowTestCase::Enable()
TEST_CASE_METHOD(WindowTestCase, "Window::Enable", "[window]")
{
CPPUNIT_ASSERT(m_window->IsEnabled());
CHECK(m_window->IsEnabled());
m_window->Disable();
CPPUNIT_ASSERT(!m_window->IsEnabled());
CHECK(!m_window->IsEnabled());
m_window->Enable();
CPPUNIT_ASSERT(m_window->IsEnabled());
CHECK(m_window->IsEnabled());
m_window->Enable(false);
CPPUNIT_ASSERT(!m_window->IsEnabled());
CHECK(!m_window->IsEnabled());
m_window->Enable();
wxWindow* const child = new wxWindow(m_window, wxID_ANY);
CHECK(child->IsEnabled());
CHECK(child->IsThisEnabled());
m_window->Disable();
CHECK(!child->IsEnabled());
CHECK(child->IsThisEnabled());
child->Disable();
CHECK(!child->IsEnabled());
CHECK(!child->IsThisEnabled());
m_window->Enable();
CHECK(!child->IsEnabled());
CHECK(!child->IsThisEnabled());
child->Enable();
CHECK(child->IsEnabled());
CHECK(child->IsThisEnabled());
}
void WindowTestCase::FindWindowBy()
TEST_CASE_METHOD(WindowTestCase, "Window::FindWindowBy", "[window]")
{
m_window->SetId(wxID_HIGHEST + 1);
m_window->SetName("name");
m_window->SetLabel("label");
CPPUNIT_ASSERT_EQUAL(m_window, wxWindow::FindWindowById(wxID_HIGHEST + 1));
CPPUNIT_ASSERT_EQUAL(m_window, wxWindow::FindWindowByName("name"));
CPPUNIT_ASSERT_EQUAL(m_window, wxWindow::FindWindowByLabel("label"));
CHECK( wxWindow::FindWindowById(wxID_HIGHEST + 1) == m_window );
CHECK( wxWindow::FindWindowByName("name") == m_window );
CHECK( wxWindow::FindWindowByLabel("label") == m_window );
CPPUNIT_ASSERT_EQUAL(static_cast<wxWindow*>(NULL),
wxWindow::FindWindowById(wxID_HIGHEST + 3));
CPPUNIT_ASSERT_EQUAL(static_cast<wxWindow*>(NULL),
wxWindow::FindWindowByName("noname"));
CPPUNIT_ASSERT_EQUAL(static_cast<wxWindow*>(NULL),
wxWindow::FindWindowByLabel("nolabel"));
CHECK( wxWindow::FindWindowById(wxID_HIGHEST + 3) == NULL );
CHECK( wxWindow::FindWindowByName("noname") == NULL );
CHECK( wxWindow::FindWindowByLabel("nolabel") == NULL );
}
TEST_CASE_METHOD(WindowTestCase, "Window::SizerErrors", "[window][sizer][error]")
{
wxWindow* const child = new wxWindow(m_window, wxID_ANY);
wxScopedPtr<wxSizer> const sizer1(new wxBoxSizer(wxHORIZONTAL));
wxScopedPtr<wxSizer> const sizer2(new wxBoxSizer(wxHORIZONTAL));
REQUIRE_NOTHROW( sizer1->Add(child) );
CHECK_THROWS_AS( sizer1->Add(child), TestAssertFailure );
CHECK_THROWS_AS( sizer2->Add(child), TestAssertFailure );
CHECK_NOTHROW( sizer1->Detach(child) );
CHECK_NOTHROW( sizer2->Add(child) );
REQUIRE_NOTHROW( delete child );
}

View File

@@ -3,7 +3,7 @@
// Purpose: wxDateTime unit test
// Author: Vadim Zeitlin
// Created: 2004-06-23 (extracted from samples/console/console.cpp)
// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwidgets.org>
///////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------
@@ -12,14 +12,12 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_DATETIME
#ifndef WX_PRECOMP
#include "wx/time.h" // wxGetTimeZone()
#include "wx/utils.h" // wxMilliSleep()
#endif // WX_PRECOMP
#include "wx/wxcrt.h" // for wxStrstr()
@@ -699,6 +697,8 @@ void DateTimeTestCase::TestTimeFormat()
3*3600 + 30*60
};
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const Date formatTestDates[] =
{
{ 29, wxDateTime::May, 1976, 18, 30, 00, 0.0, wxDateTime::Inv_WeekDay },
@@ -717,6 +717,8 @@ void DateTimeTestCase::TestTimeFormat()
#endif
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
for ( unsigned idxtz = 0; idxtz < WXSIZEOF(timeZonesOffsets); ++idxtz )
{
wxDateTime::TimeZone tz(timeZonesOffsets[idxtz]);
@@ -863,10 +865,16 @@ void DateTimeTestCase::TestTimeFormat()
CPPUNIT_ASSERT( dt.ParseFormat("12:23:45.000", "%H:%M:%S.%l") );
CPPUNIT_ASSERT_EQUAL( 0, dt.GetMillisecond() );
// test another format modifier not testes above.
CPPUNIT_ASSERT( dt.ParseFormat("23", "%e") );
CPPUNIT_ASSERT_EQUAL( 23, dt.GetDay() );
// test partially specified dates too
wxDateTime dtDef(26, wxDateTime::Sep, 2008);
CPPUNIT_ASSERT( dt.ParseFormat("17", "%d") );
CPPUNIT_ASSERT( dt.ParseFormat("17", "%d", dtDef) );
CPPUNIT_ASSERT_EQUAL( 17, dt.GetDay() );
CPPUNIT_ASSERT_EQUAL( wxDateTime::Sep, dt.GetMonth() );
CPPUNIT_ASSERT_EQUAL( 2008, dt.GetYear() );
// test some degenerate cases
CPPUNIT_ASSERT( !dt.ParseFormat("", "%z") );
@@ -917,6 +925,8 @@ void DateTimeTestCase::TestTimeParse()
void DateTimeTestCase::TestTimeZoneParse()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const struct
{
const char *str;
@@ -964,6 +974,8 @@ void DateTimeTestCase::TestTimeZoneParse()
{ "17:37+04:0" },
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
for ( size_t n = 0; n < WXSIZEOF(parseTestTimeZones); ++n )
{
wxDateTime dt;
@@ -986,6 +998,8 @@ void DateTimeTestCase::TestTimeZoneParse()
void DateTimeTestCase::TestTimeSpanFormat()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const struct TimeSpanFormatTestData
{
long h, min, sec, msec;
@@ -1009,6 +1023,8 @@ void DateTimeTestCase::TestTimeSpanFormat()
{ 0, 0, -1, 0, "%H:%M:%S", "-00:00:01" },
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
for ( size_t n = 0; n < WXSIZEOF(testSpans); n++ )
{
const TimeSpanFormatTestData& td = testSpans[n];
@@ -1037,6 +1053,8 @@ void DateTimeTestCase::TestTimeTicks()
// test parsing dates in RFC822 format
void DateTimeTestCase::TestParseRFC822()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const struct ParseTestData
{
const char *rfc822;
@@ -1081,6 +1099,8 @@ void DateTimeTestCase::TestParseRFC822()
},
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
for ( unsigned n = 0; n < WXSIZEOF(parseTestDates); n++ )
{
const char * const datestr = parseTestDates[n].rfc822;
@@ -1109,6 +1129,8 @@ void DateTimeTestCase::TestParseRFC822()
// test parsing dates in free format
void DateTimeTestCase::TestDateParse()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const struct ParseTestData
{
const char *str;
@@ -1129,6 +1151,8 @@ void DateTimeTestCase::TestDateParse()
{ "2 . . " },
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
// special cases
wxDateTime dt;
CPPUNIT_ASSERT( dt.ParseDate(wxT("today")) );
@@ -1164,6 +1188,8 @@ void DateTimeTestCase::TestDateParse()
void DateTimeTestCase::TestDateParseISO()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const struct
{
const char *str;
@@ -1199,6 +1225,8 @@ void DateTimeTestCase::TestDateParseISO()
{ "" },
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
for ( size_t n = 0; n < WXSIZEOF(parseTestDates); n++ )
{
wxDateTime dt;
@@ -1238,6 +1266,8 @@ void DateTimeTestCase::TestDateParseISO()
void DateTimeTestCase::TestDateTimeParse()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const struct ParseTestData
{
const char *str;
@@ -1270,6 +1300,8 @@ void DateTimeTestCase::TestDateTimeParse()
},
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
// the test strings here use "PM" which is not available in all locales so
// we need to use "C" locale for them
CLocaleSetter cloc;
@@ -1673,4 +1705,52 @@ TEST_CASE("wxDateTime-BST-bugs", "[datetime][dst][BST][.]")
}
}
TEST_CASE("wxDateTime::UNow", "[datetime][now][unow]")
{
// It's unlikely, but possible, that the consecutive functions are called
// on different sides of some second boundary, but it really shouldn't
// happen more than once in a row.
wxDateTime now, unow;
for ( int i = 0; i < 3; ++i )
{
now = wxDateTime::Now();
unow = wxDateTime::UNow();
if ( now.GetSecond() == unow.GetSecond() )
break;
WARN("wxDateTime::Now() and UNow() returned different "
"second values ("
<< now.GetSecond() << " and " << unow.GetSecond() <<
"), retrying.");
wxMilliSleep(123);
}
CHECK( now.GetYear() == unow.GetYear() );
CHECK( now.GetMonth() == unow.GetMonth() );
CHECK( now.GetDay() == unow.GetDay() );
CHECK( now.GetHour() == unow.GetHour() );
CHECK( now.GetMinute() == unow.GetMinute() );
CHECK( now.GetSecond() == unow.GetSecond() );
CHECK( now.GetMillisecond() == 0 );
// Just checking unow.GetMillisecond() == 0 would fail once per 1000 test
// runs on average, which is certainly not a lot, but still try to avoid
// such spurious failures.
bool gotMS = false;
for ( int i = 0; i < 3; ++i )
{
if ( wxDateTime::UNow().GetMillisecond() != 0 )
{
gotMS = true;
break;
}
wxMilliSleep(123);
}
CHECK( gotMS );
}
#endif // wxUSE_DATETIME

View File

@@ -184,6 +184,7 @@ TEST_GUI_OBJECTS2=test_gui_richtextctrltest.obj,\
test_gui_slidertest.obj,\
test_gui_spinctrldbltest.obj,\
test_gui_spinctrltest.obj,\
test_gui_styledtextctrltest.obj,\
test_gui_textctrltest.obj,\
test_gui_textentrytest.obj,\
test_gui_togglebuttontest.obj,\
@@ -617,6 +618,9 @@ test_gui_spinctrldbltest.obj : [.controls]spinctrldbltest.cpp
test_gui_spinctrltest.obj : [.controls]spinctrltest.cpp
$(CXXC) /object=[]$@ $(TEST_GUI_CXXFLAGS) [.controls]spinctrltest.cpp
test_gui_styledtextctrltest.obj : [.controls]styledtextctrltest.cpp
$(CXXC) /object=[]$@ $(TEST_GUI_CXXFLAGS) [.controls]styledtextctrltest.cpp
test_gui_textctrltest.obj : [.controls]textctrltest.cpp
$(CXXC) /object=[]$@ $(TEST_GUI_CXXFLAGS) [.controls]textctrltest.cpp

View File

@@ -11,9 +11,6 @@
// ----------------------------------------------------------------------------
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"

View File

@@ -11,9 +11,6 @@
// ----------------------------------------------------------------------------
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "drawing.h"

View File

@@ -11,9 +11,6 @@
// ----------------------------------------------------------------------------
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"

View File

@@ -11,9 +11,6 @@
// ----------------------------------------------------------------------------
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/log.h"

View File

@@ -8,9 +8,6 @@
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// ----------------------------------------------------------------------------
// headers

View File

@@ -12,41 +12,17 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/event.h"
#include "wx/timer.h"
#endif // WX_PRECOMP
// --------------------------------------------------------------------------
// test class
// --------------------------------------------------------------------------
class EventCloneTestCase : public CppUnit::TestCase
TEST_CASE("EventClone", "[wxEvent][clone]")
{
public:
EventCloneTestCase() {}
// Dummy timer needed just to create a wxTimerEvent.
wxTimer dummyTimer;
private:
CPPUNIT_TEST_SUITE( EventCloneTestCase );
CPPUNIT_TEST( CheckAll );
CPPUNIT_TEST_SUITE_END();
void CheckAll();
wxDECLARE_NO_COPY_CLASS(EventCloneTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( EventCloneTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( EventCloneTestCase, "EventCloneTestCase" );
void EventCloneTestCase::CheckAll()
{
// check if event classes implement Clone() correctly
// NOTE: the check is done against _all_ event classes which are linked to
// the executable currently running, which are not necessarily all
@@ -61,20 +37,30 @@ void EventCloneTestCase::CheckAll()
cn == "wxEvent" )
continue;
const std::string
msg = std::string("Event class \"") +
std::string(cn.c_str()) + "\"";
INFO("Event class \"" << cn << "\"");
CPPUNIT_ASSERT_MESSAGE( msg, ci->IsDynamic() );
wxEvent* test;
if ( ci->IsDynamic() )
{
test = wxDynamicCast(ci->CreateObject(),wxEvent);
}
else if ( cn == "wxTimerEvent" )
{
test = new wxTimerEvent(dummyTimer);
}
else
{
FAIL("Can't create objects of type " + cn);
continue;
}
wxEvent * const test = wxDynamicCast(ci->CreateObject(),wxEvent);
CPPUNIT_ASSERT_MESSAGE( msg, test );
REQUIRE( test );
wxEvent * const cloned = test->Clone();
delete test;
CPPUNIT_ASSERT_MESSAGE( msg, cloned );
CPPUNIT_ASSERT_MESSAGE( msg, cloned->GetClassInfo() == ci );
REQUIRE( cloned );
CHECK( cloned->GetClassInfo() == ci );
delete cloned;
}

View File

@@ -12,9 +12,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/event.h"
@@ -104,6 +101,9 @@ public:
void OnEvent(wxEvent&) { g_called.method = true; }
void OnAnotherEvent(AnotherEvent&);
void OnIdle(wxIdleEvent&) { g_called.method = true; }
void OnOverloadedHandler(wxIdleEvent&) { }
void OnOverloadedHandler(wxThreadEvent&) { }
};
// we can also handle events in classes not deriving from wxEvtHandler
@@ -122,6 +122,9 @@ public:
void OnEvent(wxEvent&) { g_called.method = true; }
void OnAnotherEvent(AnotherEvent&);
void OnIdle(wxIdleEvent&) { g_called.method = true; }
#ifdef wxHAS_NOEXCEPT
void OnIdleNoExcept(wxIdleEvent&) noexcept { }
#endif
private:
wxDECLARE_EVENT_TABLE();
@@ -138,6 +141,10 @@ wxBEGIN_EVENT_TABLE(MyClassWithEventTable, wxEvtHandler)
EVT_MYEVENT(MyClassWithEventTable::OnMyEvent)
EVT_MYEVENT(MyClassWithEventTable::OnEvent)
#ifdef wxHAS_NOEXCEPT
EVT_IDLE(MyClassWithEventTable::OnIdleNoExcept)
#endif
// this shouldn't compile:
//EVT_MYEVENT(MyClassWithEventTable::OnIdle)
//EVT_IDLE(MyClassWithEventTable::OnAnotherEvent)
@@ -148,63 +155,10 @@ wxGCC_WARNING_RESTORE(unused-function)
} // anonymous namespace
// --------------------------------------------------------------------------
// test class
// --------------------------------------------------------------------------
class EvtHandlerTestCase : public CppUnit::TestCase
TEST_CASE("Event::BuiltinConnect", "[event][connect]")
{
public:
EvtHandlerTestCase() {}
private:
CPPUNIT_TEST_SUITE( EvtHandlerTestCase );
CPPUNIT_TEST( BuiltinConnect );
CPPUNIT_TEST( LegacyConnect );
CPPUNIT_TEST( DisconnectWildcard );
CPPUNIT_TEST( AutoDisconnect );
CPPUNIT_TEST( BindFunction );
CPPUNIT_TEST( BindStaticMethod );
CPPUNIT_TEST( BindFunctor );
CPPUNIT_TEST( BindMethod );
CPPUNIT_TEST( BindMethodUsingBaseEvent );
CPPUNIT_TEST( BindFunctionUsingBaseEvent );
CPPUNIT_TEST( BindNonHandler );
CPPUNIT_TEST( InvalidBind );
CPPUNIT_TEST( UnbindFromHandler );
CPPUNIT_TEST_SUITE_END();
void BuiltinConnect();
void LegacyConnect();
void DisconnectWildcard();
void AutoDisconnect();
void BindFunction();
void BindStaticMethod();
void BindFunctor();
void BindMethod();
void BindMethodUsingBaseEvent();
void BindFunctionUsingBaseEvent();
void BindNonHandler();
void InvalidBind();
void UnbindFromHandler();
// these member variables exceptionally don't use "m_" prefix because
// they're used so many times
MyHandler handler;
MyEvent e;
wxDECLARE_NO_COPY_CLASS(EvtHandlerTestCase);
};
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( EvtHandlerTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( EvtHandlerTestCase, "EvtHandlerTestCase" );
void EvtHandlerTestCase::BuiltinConnect()
{
handler.Connect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle));
handler.Disconnect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle));
@@ -230,8 +184,10 @@ void EvtHandlerTestCase::BuiltinConnect()
handler.Unbind(wxEVT_IDLE, &MyHandler::StaticOnIdle);
}
void EvtHandlerTestCase::LegacyConnect()
TEST_CASE("Event::LegacyConnect", "[event][connect]")
{
MyHandler handler;
handler.Connect( LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent );
handler.Connect( 0, LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent );
handler.Connect( 0, 0, LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent );
@@ -250,42 +206,55 @@ void EvtHandlerTestCase::LegacyConnect()
handler.Disconnect( 0, 0, LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent, NULL, &handler );
}
void EvtHandlerTestCase::DisconnectWildcard()
TEST_CASE("Event::ConnectOverloaded", "[event][connect]")
{
MyHandler handler;
handler.Connect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnOverloadedHandler));
handler.Connect(wxEVT_THREAD, wxThreadEventHandler(MyHandler::OnOverloadedHandler));
}
TEST_CASE("Event::DisconnectWildcard", "[event][connect][disconnect]")
{
MyHandler handler;
// should be able to disconnect a different handler using "wildcard search"
MyHandler sink;
wxEvtHandler source;
source.Connect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle), NULL, &sink);
CPPUNIT_ASSERT(source.Disconnect(wxID_ANY, wxEVT_IDLE));
CHECK(source.Disconnect(wxID_ANY, wxEVT_IDLE));
// destruction of source and sink here should properly clean up the
// wxEventConnectionRef without crashing
}
void EvtHandlerTestCase::AutoDisconnect()
TEST_CASE("Event::AutoDisconnect", "[event][connect][disconnect]")
{
wxEvtHandler source;
{
MyHandler sink;
source.Connect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle), NULL, &sink);
// mismatched event type, so nothing should be disconnected
CPPUNIT_ASSERT(!source.Disconnect(wxEVT_THREAD, wxIdleEventHandler(MyHandler::OnIdle), NULL, &sink));
CHECK(!source.Disconnect(wxEVT_THREAD, wxIdleEventHandler(MyHandler::OnIdle), NULL, &sink));
}
// destruction of sink should have automatically disconnected it, so
// there should be nothing to disconnect anymore
CPPUNIT_ASSERT(!source.Disconnect(wxID_ANY, wxEVT_IDLE));
CHECK(!source.Disconnect(wxID_ANY, wxEVT_IDLE));
}
void EvtHandlerTestCase::BindFunction()
TEST_CASE("Event::BindFunction", "[event][bind]")
{
MyHandler handler;
MyEvent e;
// function tests
handler.Bind( MyEventType, GlobalOnMyEvent );
g_called.Reset();
handler.ProcessEvent(e);
CPPUNIT_ASSERT( g_called.function );
CHECK( g_called.function );
handler.Unbind( MyEventType, GlobalOnMyEvent );
g_called.Reset();
handler.ProcessEvent(e);
CPPUNIT_ASSERT( !g_called.function ); // check that it was disconnected
CHECK( !g_called.function ); // check that it was disconnected
handler.Bind( MyEventType, GlobalOnMyEvent, 0 );
handler.Unbind( MyEventType, GlobalOnMyEvent, 0 );
@@ -294,18 +263,21 @@ void EvtHandlerTestCase::BindFunction()
handler.Unbind( MyEventType, GlobalOnMyEvent, 0, 0 );
}
void EvtHandlerTestCase::BindStaticMethod()
TEST_CASE("Event::BindStaticMethod", "[event][bind]")
{
MyHandler handler;
MyEvent e;
// static method tests (this is same as functions but still test it just in
// case we hit some strange compiler bugs)
handler.Bind( MyEventType, &MyHandler::StaticOnMyEvent );
g_called.Reset();
handler.ProcessEvent(e);
CPPUNIT_ASSERT( g_called.smethod );
CHECK( g_called.smethod );
handler.Unbind( MyEventType, &MyHandler::StaticOnMyEvent );
g_called.Reset();
handler.ProcessEvent(e);
CPPUNIT_ASSERT( !g_called.smethod );
CHECK( !g_called.smethod );
handler.Bind( MyEventType, &MyHandler::StaticOnMyEvent, 0 );
handler.Unbind( MyEventType, &MyHandler::StaticOnMyEvent, 0 );
@@ -314,19 +286,22 @@ void EvtHandlerTestCase::BindStaticMethod()
handler.Unbind( MyEventType, &MyHandler::StaticOnMyEvent, 0, 0 );
}
void EvtHandlerTestCase::BindFunctor()
TEST_CASE("Event::BindFunctor", "[event][bind]")
{
MyHandler handler;
MyEvent e;
// generalized functor tests
MyFunctor functor;
handler.Bind( MyEventType, functor );
g_called.Reset();
handler.ProcessEvent(e);
CPPUNIT_ASSERT( g_called.functor );
CHECK( g_called.functor );
handler.Unbind( MyEventType, functor );
g_called.Reset();
handler.ProcessEvent(e);
CPPUNIT_ASSERT( !g_called.functor );
CHECK( !g_called.functor );
handler.Bind( MyEventType, functor, 0 );
handler.Unbind( MyEventType, functor, 0 );
@@ -339,26 +314,29 @@ void EvtHandlerTestCase::BindFunctor()
// not work
MyFunctor func;
handler.Bind( MyEventType, MyFunctor() );
CPPUNIT_ASSERT( !handler.Unbind( MyEventType, func ));
CHECK( !handler.Unbind( MyEventType, func ));
handler.Bind( MyEventType, MyFunctor(), 0 );
CPPUNIT_ASSERT( !handler.Unbind( MyEventType, func, 0 ));
CHECK( !handler.Unbind( MyEventType, func, 0 ));
handler.Bind( MyEventType, MyFunctor(), 0, 0 );
CPPUNIT_ASSERT( !handler.Unbind( MyEventType, func, 0, 0 ));
CHECK( !handler.Unbind( MyEventType, func, 0, 0 ));
}
void EvtHandlerTestCase::BindMethod()
TEST_CASE("Event::BindMethod", "[event][bind]")
{
MyHandler handler;
MyEvent e;
// class method tests
handler.Bind( MyEventType, &MyHandler::OnMyEvent, &handler );
g_called.Reset();
handler.ProcessEvent(e);
CPPUNIT_ASSERT( g_called.method );
CHECK( g_called.method );
handler.Unbind( MyEventType, &MyHandler::OnMyEvent, &handler );
g_called.Reset();
handler.ProcessEvent(e);
CPPUNIT_ASSERT( !g_called.method );
CHECK( !g_called.method );
handler.Bind( MyEventType, &MyHandler::OnMyEvent, &handler, 0 );
handler.Unbind( MyEventType, &MyHandler::OnMyEvent, &handler, 0 );
@@ -367,19 +345,22 @@ void EvtHandlerTestCase::BindMethod()
handler.Unbind( MyEventType, &MyHandler::OnMyEvent, &handler, 0, 0 );
}
void EvtHandlerTestCase::BindMethodUsingBaseEvent()
TEST_CASE("Event::BindMethodUsingBaseEvent", "[event][bind]")
{
MyHandler handler;
MyEvent e;
// test connecting a method taking just wxEvent and not MyEvent: this
// should work too if we don't need any MyEvent-specific information in the
// handler
handler.Bind( MyEventType, &MyHandler::OnEvent, &handler );
g_called.Reset();
handler.ProcessEvent(e);
CPPUNIT_ASSERT( g_called.method );
CHECK( g_called.method );
handler.Unbind( MyEventType, &MyHandler::OnEvent, &handler );
g_called.Reset();
handler.ProcessEvent(e);
CPPUNIT_ASSERT( !g_called.method );
CHECK( !g_called.method );
handler.Bind( MyEventType, &MyHandler::OnEvent, &handler, 0 );
handler.Unbind( MyEventType, &MyHandler::OnEvent, &handler, 0 );
@@ -389,19 +370,22 @@ void EvtHandlerTestCase::BindMethodUsingBaseEvent()
}
void EvtHandlerTestCase::BindFunctionUsingBaseEvent()
TEST_CASE("Event::BindFunctionUsingBaseEvent", "[event][bind]")
{
MyHandler handler;
MyEvent e;
// test connecting a function taking just wxEvent and not MyEvent: this
// should work too if we don't need any MyEvent-specific information in the
// handler
handler.Bind( MyEventType, GlobalOnEvent );
g_called.Reset();
handler.ProcessEvent(e);
CPPUNIT_ASSERT( g_called.function );
CHECK( g_called.function );
handler.Unbind( MyEventType, GlobalOnEvent );
g_called.Reset();
handler.ProcessEvent(e);
CPPUNIT_ASSERT( !g_called.function );
CHECK( !g_called.function );
handler.Bind( MyEventType, GlobalOnEvent, 0 );
handler.Unbind( MyEventType, GlobalOnEvent, 0 );
@@ -412,22 +396,25 @@ void EvtHandlerTestCase::BindFunctionUsingBaseEvent()
void EvtHandlerTestCase::BindNonHandler()
TEST_CASE("Event::BindNonHandler", "[event][bind]")
{
MyHandler handler;
MyEvent e;
// class method tests for class not derived from wxEvtHandler
MySink sink;
handler.Bind( MyEventType, &MySink::OnMyEvent, &sink );
g_called.Reset();
handler.ProcessEvent(e);
CPPUNIT_ASSERT( g_called.method );
CHECK( g_called.method );
handler.Unbind( MyEventType, &MySink::OnMyEvent, &sink );
g_called.Reset();
handler.ProcessEvent(e);
CPPUNIT_ASSERT( !g_called.method );
CHECK( !g_called.method );
}
void EvtHandlerTestCase::InvalidBind()
TEST_CASE("Event::InvalidBind", "[event][bind]")
{
// these calls shouldn't compile but we unfortunately can't check this
// automatically, you need to uncomment them manually and test that
@@ -478,7 +465,7 @@ struct Handler1
// Although this handler is bound, the second one below is bound
// later and so will be called first and will disconnect this one
// before it has a chance to be called.
CPPUNIT_FAIL("shouldn't be called");
FAIL("shouldn't be called");
}
};
@@ -506,8 +493,11 @@ private:
wxDECLARE_NO_COPY_CLASS(Handler2);
};
void EvtHandlerTestCase::UnbindFromHandler()
TEST_CASE("Event::UnbindFromHandler", "[event][bind][unbind]")
{
MyHandler handler;
MyEvent e;
Handler1 h1;
handler.Bind(MyEventType, &Handler1::OnDontCall, &h1);
@@ -522,7 +512,7 @@ void EvtHandlerTestCase::UnbindFromHandler()
// result in compilation errors.
// Note that this test will work only on C++11 compilers, so we test this only
// for such compilers.
#if __cplusplus >= 201103
#if __cplusplus >= 201103 || wxCHECK_VISUALC_VERSION(14)
class HandlerNonPublic : protected wxEvtHandler
{
public:
@@ -534,3 +524,14 @@ public:
void OnIdle(wxIdleEvent&) { }
};
#endif // C++11
// Another compilation-time-only test, but this one checking that these event
// objects can't be created from outside of the library.
#ifdef TEST_INVALID_EVENT_CREATION
void TestEventCreation()
{
wxPaintEvent eventPaint;
}
#endif // TEST_INVALID_EVENT_CREATION

View File

@@ -12,9 +12,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/timer.h"

View File

@@ -12,7 +12,3 @@
// ----------------------------------------------------------------------------
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif

View File

@@ -12,9 +12,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_UIACTIONSIMULATOR
@@ -27,6 +24,10 @@
#include "wx/uiaction.h"
#include "wx/vector.h"
#ifdef __WXGTK__
#include "wx/stopwatch.h"
#endif
namespace
{
@@ -229,7 +230,11 @@ void KeyboardEventTestCase::setUp()
m_win = new KeyboardTestWindow(wxTheApp->GetTopWindow());
wxYield();
m_win->SetFocus();
wxYield(); // needed to show the new window
#ifdef __WXGTK__
for ( wxStopWatch sw; sw.Time() < 10; )
#endif
wxYield(); // needed to show the new window
// The window might get some key up events when it's being shown if the key
// was pressed when the program was started and released after the window

View File

@@ -12,9 +12,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -30,6 +27,7 @@
#include "wx/scopeguard.h"
#include "wx/toolbar.h"
#include "wx/uiaction.h"
#include "wx/stopwatch.h"
// FIXME: Currently under OS X testing paint event doesn't work because neither
// calling Refresh()+Update() nor even sending wxPaintEvent directly to
@@ -37,12 +35,7 @@
// some tests there. But this should be fixed and the tests reenabled
// because wxPaintEvent propagation in wxScrolledWindow is a perfect
// example of fragile code that could be broken under OS X.
//
// FIXME: Under GTK+ 3 the test is broken because a simple wxYield() is not
// enough to map the frame. It should be also fixed there by waiting for
// it to come up, with some timeout, but for now it always fails, so
// it's useless to run it.
#if !defined(__WXOSX__) && !defined(__WXGTK3__)
#if !defined(__WXOSX__)
#define CAN_TEST_PAINT_EVENTS
#endif
@@ -180,7 +173,8 @@ public:
#ifdef __WXGTK__
// We need to map the window, otherwise we're not going to get any
// paint events for it.
wxYield();
for ( wxStopWatch sw; sw.Time() < 50; )
wxYield();
// Ignore events generated during the initial mapping.
g_str.clear();
@@ -248,10 +242,12 @@ private:
CPPUNIT_TEST( ScrollWindowWithHandler );
// for unknown reason, this test will cause the tests segmentation failed
// under x11, disable it for now.
#if !defined (__WXX11__)
#if !defined (__WXX11__) && wxUSE_MENUS
CPPUNIT_TEST( MenuEvent );
#endif
#if wxUSE_DOC_VIEW_ARCHITECTURE
CPPUNIT_TEST( DocView );
#endif // wxUSE_DOC_VIEW_ARCHITECTURE
WXUISIM_TEST( ContextMenuEvent );
WXUISIM_TEST( PropagationLevel );
CPPUNIT_TEST_SUITE_END();
@@ -263,8 +259,12 @@ private:
void ForwardEvent();
void ScrollWindowWithoutHandler();
void ScrollWindowWithHandler();
#if wxUSE_MENUS
void MenuEvent();
#endif
#if wxUSE_DOC_VIEW_ARCHITECTURE
void DocView();
#endif // wxUSE_DOC_VIEW_ARCHITECTURE
#if wxUSE_UIACTIONSIMULATOR
void ContextMenuEvent();
void PropagationLevel();
@@ -425,16 +425,19 @@ void EventPropagationTestCase::ScrollWindowWithHandler()
CPPUNIT_ASSERT_EQUAL( "apA", g_str );
}
#if wxUSE_MENUS
// Create a menu bar with a single menu containing wxID_APPLY menu item and
// attach it to the specified frame.
wxMenu* CreateTestMenu(wxFrame* frame)
{
wxMenu* const menu = new wxMenu;
menu->Append(wxID_APPLY);
#if wxUSE_MENUBAR
wxMenuBar* const mb = new wxMenuBar;
mb->Append(menu, "&Menu");
frame->SetMenuBar(mb);
#endif
return menu;
}
@@ -459,10 +462,11 @@ void EventPropagationTestCase::MenuEvent()
// Create a minimal menu bar.
wxMenu* const menu = CreateTestMenu(frame);
#if wxUSE_MENUBAR
wxMenuBar* const mb = menu->GetMenuBar();
wxScopedPtr<wxMenuBar> ensureMenuBarDestruction(mb);
wxON_BLOCK_EXIT_OBJ1( *frame, wxFrame::SetMenuBar, (wxMenuBar*)NULL );
#endif
// Check that wxApp gets the event exactly once.
ASSERT_MENU_EVENT_RESULT( menu, "aA" );
@@ -486,13 +490,14 @@ void EventPropagationTestCase::MenuEvent()
wxEvtHandler::SetNextHandler, (wxEvtHandler*)NULL );
ASSERT_MENU_EVENT_RESULT_FOR( wxID_ABOUT, submenu, "aosomA" );
#if wxUSE_MENUBAR
// Test that the event handler associated with the menu bar gets the event.
TestMenuEvtHandler hb('b'); // 'b' for "menu Bar"
mb->PushEventHandler(&hb);
wxON_BLOCK_EXIT_OBJ1( *mb, wxWindow::PopEventHandler, false );
ASSERT_MENU_EVENT_RESULT( menu, "aomobA" );
#endif
// Also test that the window to which the menu belongs gets the event.
TestMenuEvtHandler hw('w'); // 'w' for "Window"
@@ -501,6 +506,9 @@ void EventPropagationTestCase::MenuEvent()
ASSERT_MENU_EVENT_RESULT( menu, "aomobowA" );
}
#endif
#if wxUSE_DOC_VIEW_ARCHITECTURE
// Minimal viable implementations of wxDocument and wxView.
class EventTestDocument : public wxDocument
@@ -613,6 +621,8 @@ void EventPropagationTestCase::DocView()
#endif // wxUSE_TOOLBAR
}
#endif // wxUSE_DOC_VIEW_ARCHITECTURE
#if wxUSE_UIACTIONSIMULATOR
class ContextMenuTestWindow : public wxWindow

View File

@@ -13,9 +13,6 @@
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#endif // WX_PRECOMP

Some files were not shown because too many files have changed in this diff Show More