diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..897130147a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "3rdparty/catch"] + path = 3rdparty/catch + url = https://github.com/wxWidgets/Catch.git diff --git a/3rdparty/catch b/3rdparty/catch new file mode 160000 index 0000000000..2d91035404 --- /dev/null +++ b/3rdparty/catch @@ -0,0 +1 @@ +Subproject commit 2d91035404884089d1faf038300e437963e0c2a4 diff --git a/build/aclocal/cppunit.m4 b/build/aclocal/cppunit.m4 deleted file mode 100644 index 1548a61b03..0000000000 --- a/build/aclocal/cppunit.m4 +++ /dev/null @@ -1,81 +0,0 @@ -dnl -dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) -dnl -AC_DEFUN([AM_PATH_CPPUNIT], -[ - -AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)], - cppunit_config_prefix="$withval", cppunit_config_prefix="") -AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)], - cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="") - - if test x$cppunit_config_exec_prefix != x ; then - cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix" - if test x${CPPUNIT_CONFIG+set} != xset ; then - CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config - fi - fi - if test x$cppunit_config_prefix != x ; then - cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix" - if test x${CPPUNIT_CONFIG+set} != xset ; then - CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config - fi - fi - - AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no) - cppunit_version_min=$1 - - AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min) - no_cppunit="" - if test "$CPPUNIT_CONFIG" = "no" ; then - AC_MSG_RESULT(no) - no_cppunit=yes - else - CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags` - CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs` - cppunit_version=`$CPPUNIT_CONFIG --version` - - cppunit_major_version=`echo $cppunit_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - cppunit_minor_version=`echo $cppunit_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - cppunit_micro_version=`echo $cppunit_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - - cppunit_major_min=`echo $cppunit_version_min | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - cppunit_minor_min=`echo $cppunit_version_min | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - cppunit_micro_min=`echo $cppunit_version_min | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - - cppunit_version_proper=`expr \ - $cppunit_major_version \> $cppunit_major_min \| \ - $cppunit_major_version \= $cppunit_major_min \& \ - $cppunit_minor_version \> $cppunit_minor_min \| \ - $cppunit_major_version \= $cppunit_major_min \& \ - $cppunit_minor_version \= $cppunit_minor_min \& \ - $cppunit_micro_version \>= $cppunit_micro_min ` - - if test "$cppunit_version_proper" = "1" ; then - AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version]) - else - AC_MSG_RESULT(no) - no_cppunit=yes - fi - fi - - if test "x$no_cppunit" = x ; then - ifelse([$2], , :, [$2]) - else - CPPUNIT_CFLAGS="" - CPPUNIT_LIBS="" - ifelse([$3], , :, [$3]) - fi - - AC_SUBST(CPPUNIT_CFLAGS) - AC_SUBST(CPPUNIT_LIBS) -]) - - - diff --git a/build/bakefiles/config.bkl b/build/bakefiles/config.bkl index 174a3dbeab..ad06b70a0b 100644 --- a/build/bakefiles/config.bkl +++ b/build/bakefiles/config.bkl @@ -374,24 +374,6 @@ compiled .lib files and setup.h under the lib/ toplevel directory. - - - - - - diff --git a/build/msw/config.bcc b/build/msw/config.bcc index a3692fd67e..85bd19c840 100644 --- a/build/msw/config.bcc +++ b/build/msw/config.bcc @@ -196,18 +196,6 @@ WX_LIB_FLAVOUR = CFG = !endif -# Compiler flags needed to compile test suite in tests directory. If you want -# to run the tests, set it so that the compiler can find CppUnit headers. -!ifndef CPPUNIT_CFLAGS -CPPUNIT_CFLAGS = -!endif - -# Linker flags needed to link test suite in tests directory. If you want -# to run the tests, include CppUnit library here. -!ifndef CPPUNIT_LIBS -CPPUNIT_LIBS = -!endif - # Version of C runtime library to use. You can change this to # static if SHARED=0, but it is highly recommended to not do # it if SHARED=1 unless you know what you are doing. [dynamic,static] diff --git a/build/msw/config.gcc b/build/msw/config.gcc index a04404e2d1..8b1daad5fe 100644 --- a/build/msw/config.gcc +++ b/build/msw/config.gcc @@ -130,14 +130,6 @@ WX_LIB_FLAVOUR ?= # compiled .lib files and setup.h under the lib/ toplevel directory. CFG ?= -# Compiler flags needed to compile test suite in tests directory. If you want -# to run the tests, set it so that the compiler can find CppUnit headers. -CPPUNIT_CFLAGS ?= - -# Linker flags needed to link test suite in tests directory. If you want -# to run the tests, include CppUnit library here. -CPPUNIT_LIBS ?= - # Version of C runtime library to use. You can change this to # static if SHARED=0, but it is highly recommended to not do # it if SHARED=1 unless you know what you are doing. [dynamic,static] diff --git a/build/msw/config.vc b/build/msw/config.vc index d559d2fefc..67ee0829e4 100644 --- a/build/msw/config.vc +++ b/build/msw/config.vc @@ -138,14 +138,6 @@ WX_LIB_FLAVOUR = # compiled .lib files and setup.h under the lib/ toplevel directory. CFG = -# Compiler flags needed to compile test suite in tests directory. If you want -# to run the tests, set it so that the compiler can find CppUnit headers. -CPPUNIT_CFLAGS = - -# Linker flags needed to link test suite in tests directory. If you want -# to run the tests, include CppUnit library here. -CPPUNIT_LIBS = - # Version of C runtime library to use. You can change this to # static if SHARED=0, but it is highly recommended to not do # it if SHARED=1 unless you know what you are doing. [dynamic,static] diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index a9c7e0dba0..870b4656f4 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -36,8 +36,7 @@ MAKEARGS = -DCC="$(CC)" -DCXX="$(CXX)" -DCFLAGS="$(CFLAGS)" \ -DUSE_THREADS="$(USE_THREADS)" -DUSE_CAIRO="$(USE_CAIRO)" \ -DOFFICIAL_BUILD="$(OFFICIAL_BUILD)" -DVENDOR="$(VENDOR)" \ -DWX_FLAVOUR="$(WX_FLAVOUR)" -DWX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" \ - -DCFG="$(CFG)" -DCPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" \ - -DCPPUNIT_LIBS="$(CPPUNIT_LIBS)" -DRUNTIME_LIBS="$(RUNTIME_LIBS)" + -DCFG="$(CFG)" -DRUNTIME_LIBS="$(RUNTIME_LIBS)" WX_RELEASE_NODOT = 31 WX_VERSION_NODOT = $(WX_RELEASE_NODOT)1 COMPILER_PREFIX = bcc diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index 67978cce40..5a59f1d807 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -28,7 +28,6 @@ MAKEARGS = LINK_DLL_FLAGS="$(LINK_DLL_FLAGS)" \ USE_THREADS="$(USE_THREADS)" USE_CAIRO="$(USE_CAIRO)" \ OFFICIAL_BUILD="$(OFFICIAL_BUILD)" VENDOR="$(VENDOR)" \ WX_FLAVOUR="$(WX_FLAVOUR)" WX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" CFG="$(CFG)" \ - CPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" CPPUNIT_LIBS="$(CPPUNIT_LIBS)" \ RUNTIME_LIBS="$(RUNTIME_LIBS)" GCC_VERSION="$(GCC_VERSION)" \ WINDRES="$(WINDRES)" CPPDEPS = -MT$@ -MF$@.d -MD -MP diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index 5f70539c5b..3882e7cc4f 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -27,7 +27,6 @@ MAKEARGS = CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \ USE_THREADS="$(USE_THREADS)" USE_CAIRO="$(USE_CAIRO)" \ OFFICIAL_BUILD="$(OFFICIAL_BUILD)" VENDOR="$(VENDOR)" \ WX_FLAVOUR="$(WX_FLAVOUR)" WX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" CFG="$(CFG)" \ - CPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" CPPUNIT_LIBS="$(CPPUNIT_LIBS)" \ RUNTIME_LIBS="$(RUNTIME_LIBS)" WX_RELEASE_NODOT = 31 WX_VERSION_NODOT = $(WX_RELEASE_NODOT)1 diff --git a/configure b/configure index 70d839e1c1..55d0fbb654 100755 --- a/configure +++ b/configure @@ -626,7 +626,6 @@ enable_option_checking=no enable_option_checking=fatal ac_subst_vars='LTLIBOBJS LIBOBJS -CPPUNIT_CONFIG RESCOMP DLLTOOL GCC @@ -891,8 +890,6 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM RANLIB -CPPUNIT_LIBS -CPPUNIT_CFLAGS HOST_SUFFIX HEADER_PAD_OPTION SAMPLES_CXXFLAGS @@ -1355,8 +1352,6 @@ with_sdl_exec_prefix enable_sdltest enable_dependency_tracking enable_precomp_headers -with_cppunit_prefix -with_cppunit_exec_prefix ' ac_precious_vars='build_alias host_alias @@ -1409,9 +1404,7 @@ WEBKIT_LIBS CAIRO_CFLAGS CAIRO_LIBS GST_CFLAGS -GST_LIBS -CPPUNIT_CFLAGS -CPPUNIT_LIBS' +GST_LIBS' ac_subdirs_all='src/tiff src/expat' @@ -2342,8 +2335,6 @@ Optional Packages: --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib --with-sdl-prefix=PFX Prefix where SDL is installed (optional) --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional) - --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional) - --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional) Some influential environment variables: CC C compiler command @@ -2417,10 +2408,6 @@ Some influential environment variables: CAIRO_LIBS linker flags for CAIRO, overriding pkg-config GST_CFLAGS C compiler flags for GST, overriding pkg-config GST_LIBS linker flags for GST, overriding pkg-config - CPPUNIT_CFLAGS - C compiler flags for CPPUNIT, overriding pkg-config - CPPUNIT_LIBS - linker flags for CPPUNIT, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -35891,8 +35878,6 @@ TOOLKIT_LOWERCASE=`echo $TOOLKIT | tr '[A-Z]' '[a-z]'` - - case "$TOOLKIT" in GTK) TOOLKIT_DESC="GTK+" @@ -38524,211 +38509,7 @@ if test "$wxUSE_GUI" = "yes"; then else SUBDIRS="samples utils" fi - - - -# Check whether --with-cppunit-prefix was given. -if test "${with_cppunit_prefix+set}" = set; then : - withval=$with_cppunit_prefix; cppunit_config_prefix="$withval" -else - cppunit_config_prefix="" -fi - - -# Check whether --with-cppunit-exec-prefix was given. -if test "${with_cppunit_exec_prefix+set}" = set; then : - withval=$with_cppunit_exec_prefix; cppunit_config_exec_prefix="$withval" -else - cppunit_config_exec_prefix="" -fi - - - if test x$cppunit_config_exec_prefix != x ; then - cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix" - if test x${CPPUNIT_CONFIG+set} != xset ; then - CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config - fi - fi - if test x$cppunit_config_prefix != x ; then - cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix" - if test x${CPPUNIT_CONFIG+set} != xset ; then - CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config - fi - fi - - # Extract the first word of "cppunit-config", so it can be a program name with args. -set dummy cppunit-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_CPPUNIT_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $CPPUNIT_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_CPPUNIT_CONFIG="$CPPUNIT_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_CPPUNIT_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_CPPUNIT_CONFIG" && ac_cv_path_CPPUNIT_CONFIG="no" - ;; -esac -fi -CPPUNIT_CONFIG=$ac_cv_path_CPPUNIT_CONFIG -if test -n "$CPPUNIT_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPPUNIT_CONFIG" >&5 -$as_echo "$CPPUNIT_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - cppunit_version_min=1.8.0 - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Cppunit - version >= $cppunit_version_min" >&5 -$as_echo_n "checking for Cppunit - version >= $cppunit_version_min... " >&6; } - no_cppunit="" - if test "$CPPUNIT_CONFIG" = "no" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - no_cppunit=yes - else - CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags` - CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs` - cppunit_version=`$CPPUNIT_CONFIG --version` - - cppunit_major_version=`echo $cppunit_version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` - cppunit_minor_version=`echo $cppunit_version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` - cppunit_micro_version=`echo $cppunit_version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` - - cppunit_major_min=`echo $cppunit_version_min | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` - cppunit_minor_min=`echo $cppunit_version_min | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` - cppunit_micro_min=`echo $cppunit_version_min | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` - - cppunit_version_proper=`expr \ - $cppunit_major_version \> $cppunit_major_min \| \ - $cppunit_major_version \= $cppunit_major_min \& \ - $cppunit_minor_version \> $cppunit_minor_min \| \ - $cppunit_major_version \= $cppunit_major_min \& \ - $cppunit_minor_version \= $cppunit_minor_min \& \ - $cppunit_micro_version \>= $cppunit_micro_min ` - - if test "$cppunit_version_proper" = "1" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version" >&5 -$as_echo "$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - no_cppunit=yes - fi - fi - - if test "x$no_cppunit" = x ; then - SUBDIRS="$SUBDIRS tests" - else - CPPUNIT_CFLAGS="" - CPPUNIT_LIBS="" - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CPPUNIT" >&5 -$as_echo_n "checking for CPPUNIT... " >&6; } - -if test -n "$PKG_CONFIG"; then - if test -n "$CPPUNIT_CFLAGS"; then - pkg_cv_CPPUNIT_CFLAGS="$CPPUNIT_CFLAGS" - else - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cppunit >= 1.8.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "cppunit >= 1.8.0") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_CPPUNIT_CFLAGS=`$PKG_CONFIG --cflags "cppunit >= 1.8.0" 2>/dev/null` -else - pkg_failed=yes -fi - fi -else - pkg_failed=untried -fi -if test -n "$PKG_CONFIG"; then - if test -n "$CPPUNIT_LIBS"; then - pkg_cv_CPPUNIT_LIBS="$CPPUNIT_LIBS" - else - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cppunit >= 1.8.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "cppunit >= 1.8.0") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_CPPUNIT_LIBS=`$PKG_CONFIG --libs "cppunit >= 1.8.0" 2>/dev/null` -else - pkg_failed=yes -fi - fi -else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - CPPUNIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "cppunit >= 1.8.0"` - else - CPPUNIT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "cppunit >= 1.8.0"` - fi - # Put the nasty error message in config.log where it belongs - echo "$CPPUNIT_PKG_ERRORS" >&5 - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cppunit not found" >&5 -$as_echo "$as_me: WARNING: cppunit not found" >&2;} - -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cppunit not found" >&5 -$as_echo "$as_me: WARNING: cppunit not found" >&2;} - -else - CPPUNIT_CFLAGS=$pkg_cv_CPPUNIT_CFLAGS - CPPUNIT_LIBS=$pkg_cv_CPPUNIT_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SUBDIRS="$SUBDIRS tests" -fi - - - fi - - - - +SUBDIRS="$SUBDIRS tests" for subdir in $SUBDIRS; do if test -d ${srcdir}/${subdir} ; then diff --git a/configure.in b/configure.in index 6c8c606061..a8bc2b94e3 100644 --- a/configure.in +++ b/configure.in @@ -7903,8 +7903,6 @@ AC_SUBST(SAMPLES_RPATH_FLAG) AC_SUBST(SAMPLES_CXXFLAGS) AC_SUBST(HEADER_PAD_OPTION) AC_SUBST(HOST_SUFFIX) -AC_SUBST(CPPUNIT_CFLAGS) -AC_SUBST(CPPUNIT_LIBS) case "$TOOLKIT" in GTK) @@ -8189,16 +8187,7 @@ else dnl there are no wxBase programs in demos SUBDIRS="samples utils" fi -dnl Add tests to the list of subdirs if cppunit 1.8.0+ is detected -AM_PATH_CPPUNIT(1.8.0, - [SUBDIRS="$SUBDIRS tests"], - [ - PKG_CHECK_MODULES(CPPUNIT, [cppunit >= 1.8.0], - [SUBDIRS="$SUBDIRS tests"], - [AC_MSG_WARN([cppunit not found])] - ) - ] -) +SUBDIRS="$SUBDIRS tests" for subdir in $SUBDIRS; do if test -d ${srcdir}/${subdir} ; then diff --git a/demos/makefile.bcc b/demos/makefile.bcc index 8f5637aa16..a3a9f2b534 100644 --- a/demos/makefile.bcc +++ b/demos/makefile.bcc @@ -36,8 +36,7 @@ MAKEARGS = -DCC="$(CC)" -DCXX="$(CXX)" -DCFLAGS="$(CFLAGS)" \ -DUSE_THREADS="$(USE_THREADS)" -DUSE_CAIRO="$(USE_CAIRO)" \ -DOFFICIAL_BUILD="$(OFFICIAL_BUILD)" -DVENDOR="$(VENDOR)" \ -DWX_FLAVOUR="$(WX_FLAVOUR)" -DWX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" \ - -DCFG="$(CFG)" -DCPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" \ - -DCPPUNIT_LIBS="$(CPPUNIT_LIBS)" -DRUNTIME_LIBS="$(RUNTIME_LIBS)" + -DCFG="$(CFG)" -DRUNTIME_LIBS="$(RUNTIME_LIBS)" ### Conditionally set variables: ### diff --git a/demos/makefile.gcc b/demos/makefile.gcc index 99ff9d97ef..b67300969b 100644 --- a/demos/makefile.gcc +++ b/demos/makefile.gcc @@ -28,7 +28,6 @@ MAKEARGS = LINK_DLL_FLAGS="$(LINK_DLL_FLAGS)" \ USE_THREADS="$(USE_THREADS)" USE_CAIRO="$(USE_CAIRO)" \ OFFICIAL_BUILD="$(OFFICIAL_BUILD)" VENDOR="$(VENDOR)" \ WX_FLAVOUR="$(WX_FLAVOUR)" WX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" CFG="$(CFG)" \ - CPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" CPPUNIT_LIBS="$(CPPUNIT_LIBS)" \ RUNTIME_LIBS="$(RUNTIME_LIBS)" GCC_VERSION="$(GCC_VERSION)" \ WINDRES="$(WINDRES)" diff --git a/demos/makefile.vc b/demos/makefile.vc index 98045b92c3..60e98d0fc2 100644 --- a/demos/makefile.vc +++ b/demos/makefile.vc @@ -27,7 +27,6 @@ MAKEARGS = CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \ USE_THREADS="$(USE_THREADS)" USE_CAIRO="$(USE_CAIRO)" \ OFFICIAL_BUILD="$(OFFICIAL_BUILD)" VENDOR="$(VENDOR)" \ WX_FLAVOUR="$(WX_FLAVOUR)" WX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" CFG="$(CFG)" \ - CPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" CPPUNIT_LIBS="$(CPPUNIT_LIBS)" \ RUNTIME_LIBS="$(RUNTIME_LIBS)" ### Conditionally set variables: ### diff --git a/docs/contributing/how-to-write-unit-tests.md b/docs/contributing/how-to-write-unit-tests.md index 152fdd21b3..867bcabbc0 100644 --- a/docs/contributing/how-to-write-unit-tests.md +++ b/docs/contributing/how-to-write-unit-tests.md @@ -1,144 +1,94 @@ How to write unit tests for wxWidgets ===================================== -Unit tests for wxWidgets are written using small cppunit framework. To compile -(but not to run) them you need to have it installed. Hence the first part of -this note explains how to do it while the second one explains how to write the -test. +wxWidgets unit tests use [Catch](http://catch-lib.net/) framework. It is +included in wxWidgets as a submodule, so you will need to run -I. CppUnit Installation ------------------------ + $ git submodule update --init 3rdparty/catch -1. Get it from http://www.sourceforge.net/projects/cppunit - (latest version as of the time of this writing is 1.10.2) +to get it before the first use. Catch is header-only and doesn't need to be +compiled. -2. Build the library: - - Under Windows using VC++: - - build everything in CppUnitLibraries.dsw work space - - add include and lib subdirectories of the directory - where you installed cppunit to the compiler search path - using "Tools|Options" menu in VC IDE +Testing with Catch +------------------ - - Under Unix: run `configure && make && make install` as usual +**WARNING**: Most of the existing tests are currently still written in the +CppUnit style, please do _not_ follow them when writing new tests, the old +style is too complex and unnecessary. + +Writing tests with Catch is almost embarrassingly simple: you need to just +add a new test case and use Catch assertion macros inside it, e.g. + + TEST_CASE("MyNewTest", "[my][new][another-tag]") + { + wxString s("Hello, world!"); + CHECK( s.BeforeFirst(",") == "Hello" ); + CHECK( s.AfterLast(" ") == "world!" ); + } + +This is all, the new test will be automatically run when you run the full test +suite or you can run just it using + + $ ./test MyNewTest + +(see below for more about running tests). + +See [Catch tutorial](hhttps://github.com/philsquared/Catch/blob/v1.11.0/docs/tutorial.md) +for more information. -II. Writing tests with CppUnit ------------------------------- +Tests physical structure +------------------------ -1. Create a new directory tests/foo +All (i.e. both GUI and non-GUI) unit tests are under `tests` subdirectory. When +adding a new test, try to find an existing file to add it to. If there are no +applicable files, try to add a new file to an existing directory. If there is +no applicable directory neither, create a new one and put the new file there +(i.e. do _not_ put new files directly under `tests`). If your test is small, +consider adding it to `tests/misc/misctests.cpp`. -2. Write a cpp file for the test copying, if you want, - from one of the existing tests. The things to look for: +If you add a new file, you need to update `tests/test.bkl` and add a +`` tag for your new file.bkl. Make sure it's in the correct section: +the one starting `GetTopWindow()`. This - class adds two new functions, GetEventCount, which takes an optional - wxEventType. It then returns the number of events of that type that it has - received since the last call. Passing nothing returns the total number of - event received since the last call. Also there is OnEvent, which counts the - events based on type that are passed to it. To make it easy to count events - there is also a new class called EventCounter which takes a window and event - type and connects the window to the top level wxTestableFrame with the specific - event type. It disconnects again once it is out of scope. It simply reduces - the amount of typing required to count events. - -3. add a `` tag for your source file to tests/test.bkl. Make sure it's - in the correct section: the one starting ` +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CATCH_CPPUNIT_H_ +#define _WX_CATCH_CPPUNIT_H_ + +#include "catch.hpp" + +// CppUnit-compatible macros. + +// CPPUNIT_ASSERTs are mapped to REQUIRE(), not CHECK(), as this is how CppUnit +// works but in many cases they really should be CHECK()s instead, i.e. the +// test should continue to run even if one assert failed. Unfortunately there +// is no automatic way to know it, so the existing code will need to be +// reviewed and CHECK() used explicitly where appropriate. +// +// Also notice that we don't use parentheses around x and y macro arguments in +// the macro expansion, as usual. This is because these parentheses would then +// appear in CATCH error messages if the assertion fails, making them much less +// readable and omitting should be fine here, exceptionally, as the arguments +// of these macros are usually just simple expressions. +#define CPPUNIT_ASSERT(cond) REQUIRE(cond) +#define CPPUNIT_ASSERT_EQUAL(x, y) REQUIRE(x == y) + +// Using INFO() disallows putting more than one of these macros on the same +// line but this can happen if they're used inside another macro, so wrap it +// inside a scope. +#define CPPUNIT_ASSERT_MESSAGE(msg, cond) \ + do { INFO(msg); REQUIRE(cond); } while (Catch::alwaysFalse()) + +#define CPPUNIT_ASSERT_EQUAL_MESSAGE(msg, x, y) \ + do { INFO(msg); REQUIRE(x == y); } while (Catch::alwaysFalse()) + +// CATCH Approx class uses the upper bound of "epsilon*(scale + max(|x|, |y|))" +// for |x - y| which is not really compatible with our fixed delta, so we can't +// use it here. +#define CPPUNIT_ASSERT_DOUBLES_EQUAL(x, y, delta) \ + REQUIRE(std::abs(x - y) < delta) + +#define CPPUNIT_FAIL(msg) FAIL(msg) + +#define CPPUNIT_ASSERT_THROW(expr, exception) \ + try \ + { \ + expr; \ + FAIL("Expected exception of type " #exception \ + " not thrown by " #expr); \ + } \ + catch ( exception& ) {} + +// Define conversions to strings for some common wxWidgets types. +namespace Catch +{ + template <> + struct StringMaker + { + static std::string convert(wxUniChar uc) + { + return wxString(uc).ToStdString(wxConvUTF8); + } + }; + + template <> + struct StringMaker + { + static std::string convert(wxUniCharRef ucr) + { + return wxString(ucr).ToStdString(wxConvUTF8); + } + }; +} + +// Use a different namespace for our mock ups of the real declarations in +// CppUnit namespace to avoid clashes if we end up being linked with the real +// CppUnit library, but bring it into scope with a using directive below to +// make it possible to compile the original code using CppUnit unmodified. +namespace CatchCppUnit +{ + +namespace CppUnit +{ + +// These classes don't really correspond to the real CppUnit ones, but contain +// just the minimum we need to make CPPUNIT_TEST() macro and our mock up of +// TestSuite class work. + +class Test +{ +public: + // Name argument exists only for compatibility with the real CppUnit but is + // not used here. + explicit Test(const std::string& name = std::string()) : m_name(name) { } + + virtual ~Test() { } + + virtual void runTest() = 0; + + const std::string& getName() const { return m_name; } + +private: + std::string m_name; +}; + +class TestCase : public Test +{ +public: + explicit TestCase(const std::string& name = std::string()) : Test(name) { } + + virtual void setUp() {} + virtual void tearDown() {} +}; + +class TestSuite : public Test +{ +public: + explicit TestSuite(const std::string& name = std::string()) : Test(name) { } + + ~TestSuite() + { + for ( size_t n = 0; n < m_tests.size(); ++n ) + { + delete m_tests[n]; + } + } + + void addTest(Test* test) { m_tests.push_back(test); } + size_t getChildTestCount() const { return m_tests.size(); } + + void runTest() wxOVERRIDE + { + for ( size_t n = 0; n < m_tests.size(); ++n ) + { + m_tests[n]->runTest(); + } + } + +private: + std::vector m_tests; + + wxDECLARE_NO_COPY_CLASS(TestSuite); +}; + +} // namespace CppUnit + +} // namespace CatchCppUnit + +using namespace CatchCppUnit; + +// Helpers used in the implementation of the macros below. +namespace wxPrivate +{ + +// An object which resets a string to its old value when going out of scope. +class TempStringAssign +{ +public: + explicit TempStringAssign(std::string& str, const char* value) + : m_str(str), + m_orig(str) + { + str = value; + } + + ~TempStringAssign() + { + m_str = m_orig; + } + +private: + std::string& m_str; + const std::string m_orig; + + wxDECLARE_NO_COPY_CLASS(TempStringAssign); +}; + +// These two strings are used to implement wxGetCurrentTestName() and must be +// defined in the test driver. +extern std::string wxTheCurrentTestClass, wxTheCurrentTestMethod; + +} // namespace wxPrivate + +inline std::string wxGetCurrentTestName() +{ + std::string s = wxPrivate::wxTheCurrentTestClass; + if ( !s.empty() && !wxPrivate::wxTheCurrentTestMethod.empty() ) + s += "::"; + s += wxPrivate::wxTheCurrentTestMethod; + + return s; +} + +// Notice that the use of this macro unconditionally changes the protection for +// everything that follows it to "public". This is necessary to allow taking +// the address of the runTest() method in CPPUNIT_TEST_SUITE_REGISTRATION() +// below and there just doesn't seem to be any way around it. +#define CPPUNIT_TEST_SUITE(testclass) \ + public: \ + void runTest() wxOVERRIDE \ + { \ + struct EatNextSemicolon + +#define CPPUNIT_TEST(testname) \ + SECTION(#testname " test") \ + { \ + setUp(); \ + try \ + { \ + testname(); \ + } \ + catch ( ... ) \ + { \ + tearDown(); \ + throw; \ + } \ + tearDown(); \ + } + +#define CPPUNIT_TEST_SUITE_END() \ + } \ + struct EatNextSemicolon + +#define wxREGISTER_UNIT_TEST_WITH_TAGS(testclass, tags) \ + METHOD_AS_TEST_CASE(testclass::runTest, #testclass, tags) \ + struct EatNextSemicolon + +#define CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(testclass, suitename) \ + wxREGISTER_UNIT_TEST_WITH_TAGS(testclass, "[" suitename "]") + +// Existings tests always use both this macro and the named registration one +// above, but we can't register the same test case twice with CATCH, so simply +// ignore this one. +#define CPPUNIT_TEST_SUITE_REGISTRATION(testclass) \ + struct EatNextSemicolon + +// ---------------------------------------------------------------------------- +// wxWidgets-specific macros +// ---------------------------------------------------------------------------- + +// Convenient variant of INFO() which uses wxString::Format() internally. +#define wxINFO_FMT_HELPER(fmt, ...) \ + wxString::Format(fmt, __VA_ARGS__).ToStdString(wxConvUTF8) + +#define wxINFO_FMT(...) INFO(wxINFO_FMT_HELPER(__VA_ARGS__)) + +// Use this macro to assert with the given formatted message (it should contain +// the format string and arguments in a separate pair of parentheses) +#define WX_ASSERT_MESSAGE(msg, cond) \ + CPPUNIT_ASSERT_MESSAGE(std::string(wxString::Format msg .mb_str()), (cond)) + +#define WX_ASSERT_EQUAL_MESSAGE(msg, expected, actual) \ + CPPUNIT_ASSERT_EQUAL_MESSAGE(std::string(wxString::Format msg .mb_str()), \ + (expected), (actual)) + +#endif // _WX_CATCH_CPPUNIT_H_ diff --git a/include/wx/cppunit.h b/include/wx/cppunit.h deleted file mode 100644 index 7922ba9ca6..0000000000 --- a/include/wx/cppunit.h +++ /dev/null @@ -1,222 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cppunit.h -// Purpose: wrapper header for CppUnit headers -// Author: Vadim Zeitlin -// Created: 15.02.04 -// Copyright: (c) 2004 Vadim Zeitlin -// Licence: wxWindows Licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CPPUNIT_H_ -#define _WX_CPPUNIT_H_ - -/////////////////////////////////////////////////////////////////////////////// -// using CPPUNIT_TEST() macro results in this warning, disable it as there is -// no other way to get rid of it and it's not very useful anyhow -#ifdef __VISUALC__ - // typedef-name 'foo' used as synonym for class-name 'bar' - #pragma warning(disable:4097) - - // unreachable code: we don't care about warnings in CppUnit headers - #pragma warning(disable:4702) - - // 'id': identifier was truncated to 'num' characters in the debug info - #pragma warning(disable:4786) -#endif // __VISUALC__ - -#ifdef __BORLANDC__ - #pragma warn -8022 -#endif - -#ifndef CPPUNIT_STD_NEED_ALLOCATOR - #define CPPUNIT_STD_NEED_ALLOCATOR 0 -#endif - -/////////////////////////////////////////////////////////////////////////////// -// Set the default format for the errors, which can be used by an IDE to jump -// to the error location. This default gets overridden by the cppunit headers -// for some compilers (e.g. VC++). - -#ifndef CPPUNIT_COMPILER_LOCATION_FORMAT - #define CPPUNIT_COMPILER_LOCATION_FORMAT "%p:%l:" -#endif - - -/////////////////////////////////////////////////////////////////////////////// -// Include all needed cppunit headers. -// - -#include "wx/beforestd.h" -#ifdef __VISUALC__ - #pragma warning(push) - - // with cppunit 1.12 we get many bogus warnings 4701 (local variable may be - // used without having been initialized) in TestAssert.h - #pragma warning(disable:4701) - - // and also 4100 (unreferenced formal parameter) in extensions/ - // ExceptionTestCaseDecorator.h - #pragma warning(disable:4100) -#endif - -#include -#include -#include -#include -#include - -#ifdef __VISUALC__ - #pragma warning(pop) -#endif -#include "wx/afterstd.h" - -#include "wx/string.h" - - -/////////////////////////////////////////////////////////////////////////////// -// Set of helpful test macros. -// - -CPPUNIT_NS_BEGIN - -// provide an overload of cppunit assertEquals(T, T) which can be used to -// compare wxStrings directly with C strings -inline void -assertEquals(const char *expected, - const char *actual, - CppUnit::SourceLine sourceLine, - const std::string& message) -{ - assertEquals(wxString(expected), wxString(actual), sourceLine, message); -} - -inline void -assertEquals(const char *expected, - const wxString& actual, - CppUnit::SourceLine sourceLine, - const std::string& message) -{ - assertEquals(wxString(expected), actual, sourceLine, message); -} - -inline void -assertEquals(const wxString& expected, - const char *actual, - CppUnit::SourceLine sourceLine, - const std::string& message) -{ - assertEquals(expected, wxString(actual), sourceLine, message); -} - -inline void -assertEquals(const wchar_t *expected, - const wxString& actual, - CppUnit::SourceLine sourceLine, - const std::string& message) -{ - assertEquals(wxString(expected), actual, sourceLine, message); -} - -inline void -assertEquals(const wxString& expected, - const wchar_t *actual, - CppUnit::SourceLine sourceLine, - const std::string& message) -{ - assertEquals(expected, wxString(actual), sourceLine, message); -} - -CPPUNIT_NS_END - -// define an assertEquals() overload for the given types, this is a helper used -// by WX_CPPUNIT_ALLOW_EQUALS_TO_INT() below -#define WX_CPPUNIT_ASSERT_EQUALS(T1, T2) \ - inline void \ - assertEquals(T1 expected, \ - T2 actual, \ - CppUnit::SourceLine sourceLine, \ - const std::string& message) \ - { \ - if ( !assertion_traits::equal(expected,actual) ) \ - { \ - Asserter::failNotEqual( assertion_traits::toString(expected), \ - assertion_traits::toString(actual), \ - sourceLine, \ - message ); \ - } \ - } - -// this macro allows us to specify (usually literal) ints as expected values -// for functions returning integral types different from "int" -#define WX_CPPUNIT_ALLOW_EQUALS_TO_INT(T) \ - CPPUNIT_NS_BEGIN \ - WX_CPPUNIT_ASSERT_EQUALS(int, T) \ - WX_CPPUNIT_ASSERT_EQUALS(T, int) \ - CPPUNIT_NS_END - -WX_CPPUNIT_ALLOW_EQUALS_TO_INT(long) -WX_CPPUNIT_ALLOW_EQUALS_TO_INT(short) -WX_CPPUNIT_ALLOW_EQUALS_TO_INT(unsigned) -WX_CPPUNIT_ALLOW_EQUALS_TO_INT(unsigned long) - -#if defined( __VMS ) && defined( __ia64 ) -WX_CPPUNIT_ALLOW_EQUALS_TO_INT(std::basic_streambuf::pos_type); -#endif - -#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG -WX_CPPUNIT_ALLOW_EQUALS_TO_INT(wxLongLong_t) -WX_CPPUNIT_ALLOW_EQUALS_TO_INT(unsigned wxLongLong_t) -#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG - -// Use this macro to assert with the given formatted message (it should contain -// the format string and arguments in a separate pair of parentheses) -#define WX_ASSERT_MESSAGE(msg, cond) \ - CPPUNIT_ASSERT_MESSAGE(std::string(wxString::Format msg .mb_str()), (cond)) - -#define WX_ASSERT_EQUAL_MESSAGE(msg, expected, actual) \ - CPPUNIT_ASSERT_EQUAL_MESSAGE(std::string(wxString::Format msg .mb_str()), \ - (expected), (actual)) - -/////////////////////////////////////////////////////////////////////////////// -// define stream inserter for wxString if it's not defined in the main library, -// we need it to output the test failures involving wxString -#if !wxUSE_STD_IOSTREAM - -#include "wx/string.h" - -#include - -inline std::ostream& operator<<(std::ostream& o, const wxString& s) -{ -#if wxUSE_UNICODE - return o << (const char *)wxSafeConvertWX2MB(s.wc_str()); -#else - return o << s.c_str(); -#endif -} - -#endif // !wxUSE_STD_IOSTREAM - -/////////////////////////////////////////////////////////////////////////////// -// Some more compiler warning tweaking and auto linking. -// - -#ifdef __BORLANDC__ - #pragma warn .8022 -#endif - -#ifdef _MSC_VER - #pragma warning(default:4702) -#endif // _MSC_VER - -// for VC++ automatically link in cppunit library -#ifdef __VISUALC__ - #ifdef NDEBUG - #pragma comment(lib, "cppunit.lib") - #else // Debug - #pragma comment(lib, "cppunitd.lib") - #endif // Release/Debug -#endif - -#endif // _WX_CPPUNIT_H_ - diff --git a/samples/html/makefile.bcc b/samples/html/makefile.bcc index 8920175db8..f65af1fe6a 100644 --- a/samples/html/makefile.bcc +++ b/samples/html/makefile.bcc @@ -36,8 +36,7 @@ MAKEARGS = -DCC="$(CC)" -DCXX="$(CXX)" -DCFLAGS="$(CFLAGS)" \ -DUSE_THREADS="$(USE_THREADS)" -DUSE_CAIRO="$(USE_CAIRO)" \ -DOFFICIAL_BUILD="$(OFFICIAL_BUILD)" -DVENDOR="$(VENDOR)" \ -DWX_FLAVOUR="$(WX_FLAVOUR)" -DWX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" \ - -DCFG="$(CFG)" -DCPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" \ - -DCPPUNIT_LIBS="$(CPPUNIT_LIBS)" -DRUNTIME_LIBS="$(RUNTIME_LIBS)" + -DCFG="$(CFG)" -DRUNTIME_LIBS="$(RUNTIME_LIBS)" ### Conditionally set variables: ### diff --git a/samples/html/makefile.gcc b/samples/html/makefile.gcc index 42d59e495a..556e0a25cc 100644 --- a/samples/html/makefile.gcc +++ b/samples/html/makefile.gcc @@ -28,7 +28,6 @@ MAKEARGS = LINK_DLL_FLAGS="$(LINK_DLL_FLAGS)" \ USE_THREADS="$(USE_THREADS)" USE_CAIRO="$(USE_CAIRO)" \ OFFICIAL_BUILD="$(OFFICIAL_BUILD)" VENDOR="$(VENDOR)" \ WX_FLAVOUR="$(WX_FLAVOUR)" WX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" CFG="$(CFG)" \ - CPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" CPPUNIT_LIBS="$(CPPUNIT_LIBS)" \ RUNTIME_LIBS="$(RUNTIME_LIBS)" GCC_VERSION="$(GCC_VERSION)" \ WINDRES="$(WINDRES)" diff --git a/samples/html/makefile.vc b/samples/html/makefile.vc index 14b2219897..e843ed1d9f 100644 --- a/samples/html/makefile.vc +++ b/samples/html/makefile.vc @@ -27,7 +27,6 @@ MAKEARGS = CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \ USE_THREADS="$(USE_THREADS)" USE_CAIRO="$(USE_CAIRO)" \ OFFICIAL_BUILD="$(OFFICIAL_BUILD)" VENDOR="$(VENDOR)" \ WX_FLAVOUR="$(WX_FLAVOUR)" WX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" CFG="$(CFG)" \ - CPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" CPPUNIT_LIBS="$(CPPUNIT_LIBS)" \ RUNTIME_LIBS="$(RUNTIME_LIBS)" ### Conditionally set variables: ### diff --git a/samples/makefile.bcc b/samples/makefile.bcc index db8f31e3ac..a8358a557f 100644 --- a/samples/makefile.bcc +++ b/samples/makefile.bcc @@ -36,8 +36,7 @@ MAKEARGS = -DCC="$(CC)" -DCXX="$(CXX)" -DCFLAGS="$(CFLAGS)" \ -DUSE_THREADS="$(USE_THREADS)" -DUSE_CAIRO="$(USE_CAIRO)" \ -DOFFICIAL_BUILD="$(OFFICIAL_BUILD)" -DVENDOR="$(VENDOR)" \ -DWX_FLAVOUR="$(WX_FLAVOUR)" -DWX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" \ - -DCFG="$(CFG)" -DCPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" \ - -DCPPUNIT_LIBS="$(CPPUNIT_LIBS)" -DRUNTIME_LIBS="$(RUNTIME_LIBS)" + -DCFG="$(CFG)" -DRUNTIME_LIBS="$(RUNTIME_LIBS)" ### Conditionally set variables: ### diff --git a/samples/makefile.gcc b/samples/makefile.gcc index 01c4b6e1f1..a2b888ebe7 100644 --- a/samples/makefile.gcc +++ b/samples/makefile.gcc @@ -28,7 +28,6 @@ MAKEARGS = LINK_DLL_FLAGS="$(LINK_DLL_FLAGS)" \ USE_THREADS="$(USE_THREADS)" USE_CAIRO="$(USE_CAIRO)" \ OFFICIAL_BUILD="$(OFFICIAL_BUILD)" VENDOR="$(VENDOR)" \ WX_FLAVOUR="$(WX_FLAVOUR)" WX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" CFG="$(CFG)" \ - CPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" CPPUNIT_LIBS="$(CPPUNIT_LIBS)" \ RUNTIME_LIBS="$(RUNTIME_LIBS)" GCC_VERSION="$(GCC_VERSION)" \ WINDRES="$(WINDRES)" diff --git a/samples/makefile.vc b/samples/makefile.vc index 120e60a236..ca0f0b1fc0 100644 --- a/samples/makefile.vc +++ b/samples/makefile.vc @@ -27,7 +27,6 @@ MAKEARGS = CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \ USE_THREADS="$(USE_THREADS)" USE_CAIRO="$(USE_CAIRO)" \ OFFICIAL_BUILD="$(OFFICIAL_BUILD)" VENDOR="$(VENDOR)" \ WX_FLAVOUR="$(WX_FLAVOUR)" WX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" CFG="$(CFG)" \ - CPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" CPPUNIT_LIBS="$(CPPUNIT_LIBS)" \ RUNTIME_LIBS="$(RUNTIME_LIBS)" ### Conditionally set variables: ### diff --git a/samples/opengl/makefile.bcc b/samples/opengl/makefile.bcc index 378104c434..a23138ce25 100644 --- a/samples/opengl/makefile.bcc +++ b/samples/opengl/makefile.bcc @@ -36,8 +36,7 @@ MAKEARGS = -DCC="$(CC)" -DCXX="$(CXX)" -DCFLAGS="$(CFLAGS)" \ -DUSE_THREADS="$(USE_THREADS)" -DUSE_CAIRO="$(USE_CAIRO)" \ -DOFFICIAL_BUILD="$(OFFICIAL_BUILD)" -DVENDOR="$(VENDOR)" \ -DWX_FLAVOUR="$(WX_FLAVOUR)" -DWX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" \ - -DCFG="$(CFG)" -DCPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" \ - -DCPPUNIT_LIBS="$(CPPUNIT_LIBS)" -DRUNTIME_LIBS="$(RUNTIME_LIBS)" + -DCFG="$(CFG)" -DRUNTIME_LIBS="$(RUNTIME_LIBS)" ### Conditionally set variables: ### diff --git a/samples/opengl/makefile.gcc b/samples/opengl/makefile.gcc index c7506234ac..bc7c65cc39 100644 --- a/samples/opengl/makefile.gcc +++ b/samples/opengl/makefile.gcc @@ -28,7 +28,6 @@ MAKEARGS = LINK_DLL_FLAGS="$(LINK_DLL_FLAGS)" \ USE_THREADS="$(USE_THREADS)" USE_CAIRO="$(USE_CAIRO)" \ OFFICIAL_BUILD="$(OFFICIAL_BUILD)" VENDOR="$(VENDOR)" \ WX_FLAVOUR="$(WX_FLAVOUR)" WX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" CFG="$(CFG)" \ - CPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" CPPUNIT_LIBS="$(CPPUNIT_LIBS)" \ RUNTIME_LIBS="$(RUNTIME_LIBS)" GCC_VERSION="$(GCC_VERSION)" \ WINDRES="$(WINDRES)" diff --git a/samples/opengl/makefile.vc b/samples/opengl/makefile.vc index 4f455e4ae8..0d6ecfb604 100644 --- a/samples/opengl/makefile.vc +++ b/samples/opengl/makefile.vc @@ -27,7 +27,6 @@ MAKEARGS = CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \ USE_THREADS="$(USE_THREADS)" USE_CAIRO="$(USE_CAIRO)" \ OFFICIAL_BUILD="$(OFFICIAL_BUILD)" VENDOR="$(VENDOR)" \ WX_FLAVOUR="$(WX_FLAVOUR)" WX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" CFG="$(CFG)" \ - CPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" CPPUNIT_LIBS="$(CPPUNIT_LIBS)" \ RUNTIME_LIBS="$(RUNTIME_LIBS)" ### Conditionally set variables: ### diff --git a/tests/Makefile.in b/tests/Makefile.in index 7f32cdbafb..09456fcfb3 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -28,8 +28,6 @@ CXXFLAGS = @CXXFLAGS@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ WX_LIB_FLAVOUR = @WX_LIB_FLAVOUR@ -CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ -CPPUNIT_LIBS = @CPPUNIT_LIBS@ TOOLKIT = @TOOLKIT@ TOOLKIT_LOWERCASE = @TOOLKIT_LOWERCASE@ TOOLKIT_VERSION = @TOOLKIT_VERSION@ @@ -55,7 +53,8 @@ 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 \ - $(CPPUNIT_CFLAGS) $(CXXWARNINGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) + -I$(top_srcdir)/3rdparty/catch/include $(CXXWARNINGS) $(SAMPLES_CXXFLAGS) \ + $(CPPFLAGS) $(CXXFLAGS) TEST_OBJECTS = \ test_test.o \ test_anytest.o \ @@ -115,7 +114,6 @@ TEST_OBJECTS = \ test_crt.o \ test_vsnprintf.o \ test_hexconv.o \ - test_bstream.o \ test_datastreamtest.o \ test_ffilestream.o \ test_fileback.o \ @@ -146,8 +144,8 @@ 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 $(CPPUNIT_CFLAGS) $(CXXWARNINGS) $(SAMPLES_CXXFLAGS) \ - $(CPPFLAGS) $(CXXFLAGS) + -DwxUSE_GUI=0 -I$(top_srcdir)/3rdparty/catch/include $(CXXWARNINGS) \ + $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) TEST_DRAWING_OBJECTS = \ test_drawing_test.o \ test_drawing_drawing.o \ @@ -165,8 +163,8 @@ TEST_DRAWINGPLUGIN_OBJECTS = \ TEST_GUI_CXXFLAGS = $(__test_gui_PCH_INC) -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 $(CPPUNIT_CFLAGS) $(CXXWARNINGS) $(SAMPLES_CXXFLAGS) \ - $(CPPFLAGS) $(CXXFLAGS) + -I$(srcdir)/../samples -I$(top_srcdir)/3rdparty/catch/include \ + $(CXXWARNINGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) TEST_GUI_OBJECTS = \ $(__test_gui___win32rc) \ test_gui_asserthelper.o \ @@ -303,7 +301,6 @@ TEST_GUI_ODEP = $(_____pch_testprec_test_gui_testprec_h_gch___depname) @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_WIN32_1@__test_gui___win32rc = test_gui_sample_rc.o @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 \ @@ -318,6 +315,7 @@ TEST_GUI_ODEP = $(_____pch_testprec_test_gui_testprec_h_gch___depname) @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 @@ -405,13 +403,13 @@ 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) $(CPPUNIT_LIBS) $(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) $(__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) $(CPPUNIT_LIBS) $(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) $(__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) @@ -420,7 +418,7 @@ test$(EXEEXT): $(TEST_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_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) $(CPPUNIT_LIBS) $(LDFLAGS) $(__WXLIB_WEBVIEW_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(EXTRALIBS_MEDIA) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__WXLIB_ADV_p) $(PLUGIN_ADV_EXTRALIBS) $(__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) $(__WXLIB_WEBVIEW_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(EXTRALIBS_MEDIA) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__WXLIB_ADV_p) $(PLUGIN_ADV_EXTRALIBS) $(__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 @@ -669,9 +667,6 @@ test_vsnprintf.o: $(srcdir)/strings/vsnprintf.cpp $(TEST_ODEP) test_hexconv.o: $(srcdir)/strings/hexconv.cpp $(TEST_ODEP) $(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/strings/hexconv.cpp -test_bstream.o: $(srcdir)/streams/bstream.cpp $(TEST_ODEP) - $(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/streams/bstream.cpp - test_datastreamtest.o: $(srcdir)/streams/datastreamtest.cpp $(TEST_ODEP) $(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/streams/datastreamtest.cpp @@ -769,7 +764,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 + $(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 test_gui_asserthelper.o: $(srcdir)/asserthelper.cpp $(TEST_GUI_ODEP) $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/asserthelper.cpp diff --git a/tests/any/anytest.cpp b/tests/any/anytest.cpp index 2503386fed..f35ff629ee 100644 --- a/tests/any/anytest.cpp +++ b/tests/any/anytest.cpp @@ -21,6 +21,18 @@ #include +namespace Catch +{ + template <> + struct StringMaker + { + static std::string convert(const wxVariant& v) + { + return v.MakeString().ToStdString(wxConvUTF8); + } + }; +} + // ---------------------------------------------------------------------------- // test class // ---------------------------------------------------------------------------- diff --git a/tests/archive/archivetest.cpp b/tests/archive/archivetest.cpp index d9b5568adf..7742b0caeb 100644 --- a/tests/archive/archivetest.cpp +++ b/tests/archive/archivetest.cpp @@ -808,8 +808,8 @@ void ArchiveTestCase::ExtractArchive(wxInputStream& in) // non-seekable entries are allowed to have GetSize == wxInvalidOffset // until the end of the entry's data has been read past CPPUNIT_ASSERT_MESSAGE("entry size check" + error_context, - testEntry.GetLength() == entry->GetSize() || - ((m_options & PipeIn) != 0 && entry->GetSize() == wxInvalidOffset)); + (testEntry.GetLength() == entry->GetSize() || + ((m_options & PipeIn) != 0 && entry->GetSize() == wxInvalidOffset))); CPPUNIT_ASSERT_MESSAGE( "arc->GetLength() == entry->GetSize()" + error_context, arc->GetLength() == entry->GetSize()); diff --git a/tests/archive/tartest.cpp b/tests/archive/tartest.cpp index 2580de4f57..b563ff57f7 100644 --- a/tests/archive/tartest.cpp +++ b/tests/archive/tartest.cpp @@ -70,7 +70,6 @@ CppUnit::Test *tartest::makeTest( } CPPUNIT_TEST_SUITE_REGISTRATION(tartest); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(tartest, "archive"); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(tartest, "archive/tar"); #endif // wxUSE_STREAMS diff --git a/tests/archive/ziptest.cpp b/tests/archive/ziptest.cpp index 3e9cff3063..cfd68ff091 100644 --- a/tests/archive/ziptest.cpp +++ b/tests/archive/ziptest.cpp @@ -124,9 +124,11 @@ void ZipTestCase::OnEntryExtracted(wxZipEntry& entry, CPPUNIT_ASSERT_MESSAGE("IsText" + error_context, entry.IsText() == testEntry.IsText()); - CPPUNIT_ASSERT_MESSAGE("Extra/LocalExtra mismatch for entry" + error_entry, - (entry.GetExtraLen() != 0 && entry.GetLocalExtraLen() != 0) || - (entry.GetExtraLen() == 0 && entry.GetLocalExtraLen() == 0)); + INFO("Extra/LocalExtra mismatch for entry" + error_entry); + if ( entry.GetExtraLen() ) + CHECK( entry.GetLocalExtraLen() != 0 ); + else + CHECK( entry.GetLocalExtraLen() == 0 ); } // check the notifier mechanism by using it to fold the entry comments to @@ -267,7 +269,6 @@ CppUnit::Test *ziptest::makeTest( } CPPUNIT_TEST_SUITE_REGISTRATION(ziptest); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(ziptest, "archive"); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(ziptest, "archive/zip"); #endif // wxUSE_STREAMS && wxUSE_ZIPSTREAM diff --git a/tests/arrays/arrays.cpp b/tests/arrays/arrays.cpp index db6a63eb88..e991f7fc56 100644 --- a/tests/arrays/arrays.cpp +++ b/tests/arrays/arrays.cpp @@ -65,8 +65,8 @@ COMPARE_VALUE( array , 9 , p9 ) #define COMPARE_COUNT( array , n ) \ - ( array.GetCount() == n ) && \ - ( array.Last() == array.Item( n - 1 ) ) + (( array.GetCount() == n ) && \ + ( array.Last() == array.Item( n - 1 ) )) // ---------------------------------------------------------------------------- // helpers for testing wxObjArray @@ -209,97 +209,97 @@ void ArraysTestCase::wxStringArrayTest() a1.Add(wxT("human")); a1.Add(wxT("alligator")); - CPPUNIT_ASSERT( COMPARE_8_VALUES( a1 , wxT("thermit") , + CPPUNIT_ASSERT((COMPARE_8_VALUES( a1 , wxT("thermit") , wxT("condor") , wxT("lion") , wxT("lion") , wxT("lion") , wxT("dog") , wxT("human") , - wxT("alligator") ) ); + wxT("alligator") ))); CPPUNIT_ASSERT( COMPARE_COUNT( a1 , 8 ) ); wxArrayString a2(a1); - CPPUNIT_ASSERT( COMPARE_8_VALUES( a2 , wxT("thermit") , + CPPUNIT_ASSERT((COMPARE_8_VALUES( a2 , wxT("thermit") , wxT("condor") , wxT("lion") , wxT("lion") , wxT("lion") , wxT("dog") , wxT("human") , - wxT("alligator") ) ); + wxT("alligator") ))); CPPUNIT_ASSERT( COMPARE_COUNT( a2 , 8 ) ); wxSortedArrayString a3(a1); - CPPUNIT_ASSERT( COMPARE_8_VALUES( a3 , wxT("alligator") , + CPPUNIT_ASSERT((COMPARE_8_VALUES( a3 , wxT("alligator") , wxT("condor") , wxT("dog") , wxT("human") , wxT("lion") , wxT("lion") , wxT("lion") , - wxT("thermit") ) ); + wxT("thermit") ))); CPPUNIT_ASSERT( COMPARE_COUNT( a3 , 8 ) ); wxSortedArrayString a4; for (wxArrayString::iterator it = a1.begin(), en = a1.end(); it != en; ++it) a4.Add(*it); - CPPUNIT_ASSERT( COMPARE_8_VALUES( a4 , wxT("alligator") , + CPPUNIT_ASSERT((COMPARE_8_VALUES( a4 , wxT("alligator") , wxT("condor") , wxT("dog") , wxT("human") , wxT("lion") , wxT("lion") , wxT("lion") , - wxT("thermit") ) ); + wxT("thermit") ))); CPPUNIT_ASSERT( COMPARE_COUNT( a4 , 8 ) ); a1.RemoveAt(2,3); - CPPUNIT_ASSERT( COMPARE_5_VALUES( a1 , wxT("thermit") , + CPPUNIT_ASSERT((COMPARE_5_VALUES( a1 , wxT("thermit") , wxT("condor") , wxT("dog") , wxT("human") , - wxT("alligator") ) ); + wxT("alligator") ))); CPPUNIT_ASSERT( COMPARE_COUNT( a1 , 5 ) ); a2 = a1; - CPPUNIT_ASSERT( COMPARE_5_VALUES( a2 , wxT("thermit") , + CPPUNIT_ASSERT((COMPARE_5_VALUES( a2 , wxT("thermit") , wxT("condor") , wxT("dog") , wxT("human") , - wxT("alligator") ) ); + wxT("alligator") ))); CPPUNIT_ASSERT( COMPARE_COUNT( a2 , 5 ) ); a1.Sort(false); - CPPUNIT_ASSERT( COMPARE_5_VALUES( a1 , wxT("alligator") , + CPPUNIT_ASSERT((COMPARE_5_VALUES( a1 , wxT("alligator") , wxT("condor") , wxT("dog") , wxT("human") , - wxT("thermit") ) ); + wxT("thermit") ))); CPPUNIT_ASSERT( COMPARE_COUNT( a1 , 5 ) ); a1.Sort(true); - CPPUNIT_ASSERT( COMPARE_5_VALUES( a1 , wxT("thermit") , + CPPUNIT_ASSERT((COMPARE_5_VALUES( a1 , wxT("thermit") , wxT("human") , wxT("dog") , wxT("condor") , - wxT("alligator") ) ); + wxT("alligator") ))); CPPUNIT_ASSERT( COMPARE_COUNT( a1 , 5 ) ); a1.Sort(&StringLenCompare); - CPPUNIT_ASSERT( COMPARE_5_VALUES( a1 , wxT("dog") , + CPPUNIT_ASSERT((COMPARE_5_VALUES( a1 , wxT("dog") , wxT("human") , wxT("condor") , wxT("thermit") , - wxT("alligator") ) ); + wxT("alligator") ))); CPPUNIT_ASSERT( COMPARE_COUNT( a1 , 5 ) ); CPPUNIT_ASSERT( a1.Index( wxT("dog") ) == 0 ); CPPUNIT_ASSERT( a1.Index( wxT("human") ) == 1 ); @@ -320,10 +320,10 @@ void ArraysTestCase::wxStringArrayTest() CPPUNIT_ASSERT( a5.Add( wxT("x"), 1 ) == 0 ); CPPUNIT_ASSERT( a5.Add( wxT("a"), 3 ) == 1 ); - CPPUNIT_ASSERT( COMPARE_4_VALUES( a5, wxT("x") , + CPPUNIT_ASSERT((COMPARE_4_VALUES( a5, wxT("x") , wxT("a") , wxT("a") , - wxT("a") ) ); + wxT("a") ))); a5.assign(a1.end(), a1.end()); CPPUNIT_ASSERT( a5.empty() ); @@ -334,7 +334,7 @@ void ArraysTestCase::wxStringArrayTest() const wxString months[] = { "Jan", "Feb", "Mar" }; a5.assign(months, months + WXSIZEOF(months)); CPPUNIT_ASSERT_EQUAL( WXSIZEOF(months), a5.size() ); - CPPUNIT_ASSERT( COMPARE_3_VALUES(a5, "Jan", "Feb", "Mar") ); + CPPUNIT_ASSERT((COMPARE_3_VALUES(a5, "Jan", "Feb", "Mar"))); a5.clear(); CPPUNIT_ASSERT_EQUAL( 0, a5.size() ); @@ -577,17 +577,17 @@ void ArraysTestCase::wxArray ## name ## Test() \ a.Add(5,3); \ a.Add(3,4); \ \ - CPPUNIT_ASSERT( COMPARE_10_VALUES(a,1,17,17,5,5,5,3,3,3,3) ); \ + CPPUNIT_ASSERT((COMPARE_10_VALUES(a,1,17,17,5,5,5,3,3,3,3))); \ CPPUNIT_ASSERT( COMPARE_COUNT( a , 10 ) ); \ \ a.Sort(name ## Compare); \ \ - CPPUNIT_ASSERT( COMPARE_10_VALUES(a,1,3,3,3,3,5,5,5,17,17) ); \ + CPPUNIT_ASSERT((COMPARE_10_VALUES(a,1,3,3,3,3,5,5,5,17,17))); \ CPPUNIT_ASSERT( COMPARE_COUNT( a , 10 ) ); \ \ a.Sort(name ## RevCompare); \ \ - CPPUNIT_ASSERT( COMPARE_10_VALUES(a,17,17,5,5,5,3,3,3,3,1) ); \ + CPPUNIT_ASSERT((COMPARE_10_VALUES(a,17,17,5,5,5,3,3,3,3,1))); \ CPPUNIT_ASSERT( COMPARE_COUNT( a , 10 ) ); \ \ wxSortedArray##name b; \ @@ -597,7 +597,7 @@ void ArraysTestCase::wxArray ## name ## Test() \ b.Add(5); \ b.Add(3); \ \ - CPPUNIT_ASSERT( COMPARE_4_VALUES(b,1,3,5,17) ); \ + CPPUNIT_ASSERT((COMPARE_4_VALUES(b,1,3,5,17))); \ CPPUNIT_ASSERT( COMPARE_COUNT( b , 4 ) ); \ CPPUNIT_ASSERT( b.Index( 0 ) == wxNOT_FOUND ); \ CPPUNIT_ASSERT( b.Index( 1 ) == 0 ); \ @@ -651,7 +651,8 @@ void DoTestSwap(T v1, T v2, T v3) { A a1, a2; a1.swap(a2); - CPPUNIT_ASSERT( a1.empty() && a2.empty() ); + CPPUNIT_ASSERT( a1.empty() ); + CPPUNIT_ASSERT( a2.empty() ); a1.push_back(v1); a1.swap(a2); @@ -711,15 +712,16 @@ void ArraysTestCase::TestSTL() CPPUNIT_ASSERT_EQUAL( 0, i ); - CPPUNIT_ASSERT( *list1.rbegin() == *(list1.end()-1) && - *list1.begin() == *(list1.rend()-1) ); + CPPUNIT_ASSERT( *list1.rbegin() == *(list1.end()-1) ); + CPPUNIT_ASSERT( *list1.begin() == *(list1.rend()-1) ); it = list1.begin()+1; rit = list1.rbegin()+1; - CPPUNIT_ASSERT( *list1.begin() == *(it-1) && - *list1.rbegin() == *(rit-1) ); + CPPUNIT_ASSERT( *list1.begin() == *(it-1) ); + CPPUNIT_ASSERT( *list1.rbegin() == *(rit-1) ); - CPPUNIT_ASSERT( ( list1.front() == 0 ) && ( list1.back() == COUNT - 1 ) ); + CPPUNIT_ASSERT( list1.front() == 0 ); + CPPUNIT_ASSERT( list1.back() == COUNT - 1 ); list1.erase(list1.begin()); list1.erase(list1.end()-1); diff --git a/tests/cmdline/cmdlinetest.cpp b/tests/cmdline/cmdlinetest.cpp index af3065138e..d68b57cd6b 100644 --- a/tests/cmdline/cmdlinetest.cpp +++ b/tests/cmdline/cmdlinetest.cpp @@ -339,7 +339,7 @@ void CmdLineTestCase::Usage() Line_Max }; - CPPUNIT_ASSERT_EQUAL(Line_Max, usageLines.size()); + CPPUNIT_ASSERT_EQUAL((size_t)Line_Max, usageLines.size()); CPPUNIT_ASSERT_EQUAL("Verbosity options", usageLines[Line_Text_Verbosity]); CPPUNIT_ASSERT_EQUAL("", usageLines[Line_Text_Dummy1]); CPPUNIT_ASSERT_EQUAL("Even more usage text", usageLines[Line_Text_Dummy2]); diff --git a/tests/controls/markuptest.cpp b/tests/controls/markuptest.cpp index d251565115..29df425228 100644 --- a/tests/controls/markuptest.cpp +++ b/tests/controls/markuptest.cpp @@ -105,8 +105,8 @@ void MarkupTestCase::RoundTrip() case wxMarkupSpanAttributes::Size_Symbolic: { - CPPUNIT_ASSERT( attrs.m_fontSize >= -3 && - attrs.m_fontSize <= 3 ); + CPPUNIT_ASSERT( attrs.m_fontSize >= -3 ); + CPPUNIT_ASSERT( attrs.m_fontSize <= 3 ); static const char *cssSizes[] = { "xx-small", "x-small", "small", diff --git a/tests/events/propagation.cpp b/tests/events/propagation.cpp index bb84cdfb25..3f3d1eb8d3 100644 --- a/tests/events/propagation.cpp +++ b/tests/events/propagation.cpp @@ -436,24 +436,14 @@ wxMenu* CreateTestMenu(wxFrame* frame) // Helper for checking that the menu event processing resulted in the expected // output from the handlers. // -// Notice that this is supposed to be used with ASSERT_MENU_EVENT_RESULT() -// macro to make the file name and line number of the caller appear in the -// failure messages. -void -CheckMenuEvent(wxMenu* menu, const char* result, CppUnit::SourceLine sourceLine) -{ - g_str.clear(); - - // Trigger the menu event: this is more reliable than using - // wxUIActionSimulator and currently works in all ports as they all call - // wxMenuBase::SendEvent() from their respective menu event handlers. - menu->SendEvent(wxID_APPLY); - - CPPUNIT_NS::assertEquals( result, g_str, sourceLine, "" ); -} - +// Note that we trigger the menu event by sending it directly as this is more +// reliable than using wxUIActionSimulator and currently works in all ports as +// they all call wxMenuBase::SendEvent() from their respective menu event +// handlers. #define ASSERT_MENU_EVENT_RESULT(menu, result) \ - CheckMenuEvent((menu), (result), CPPUNIT_SOURCELINE()) + g_str.clear(); \ + menu->SendEvent(wxID_APPLY); \ + CHECK( g_str == result ) void EventPropagationTestCase::MenuEvent() { diff --git a/tests/events/stopwatch.cpp b/tests/events/stopwatch.cpp index b7969c3fa1..7285d66306 100644 --- a/tests/events/stopwatch.cpp +++ b/tests/events/stopwatch.cpp @@ -134,7 +134,8 @@ void StopWatchTestCase::BackwardsClockBug() for ( size_t m = 0; m < 10000; m++ ) { - CPPUNIT_ASSERT ( sw.Time() >= 0 && sw2.Time() >= 0 ); + CPPUNIT_ASSERT( sw.Time() >= 0 ); + CPPUNIT_ASSERT( sw2.Time() >= 0 ); } } } diff --git a/tests/exec/exec.cpp b/tests/exec/exec.cpp index ca77c08783..e3be763544 100644 --- a/tests/exec/exec.cpp +++ b/tests/exec/exec.cpp @@ -185,13 +185,15 @@ void ExecTestCase::TestExecute() ASYNC_COMMAND, wxEXEC_ASYNC); CPPUNIT_ASSERT( pid != 0 ); - // NOTE: under Windows the first wxKill() invocation with wxSIGTERM - // may fail if the system is fast and the ASYNC_COMMAND app - // doesn't manage to create its HWND before our wxKill() is - // executed; in that case we "fall back" to the second invocation - // with wxSIGKILL (which should always succeed) - CPPUNIT_ASSERT( wxKill(pid, wxSIGTERM) == 0 || - wxKill(pid, wxSIGKILL) == 0 ); + // Give the system some time to launch the child. + wxMilliSleep(200); + + // Try to terminate it gently first, but fall back to killing it + // unconditionally if this fails. + const int rc = wxKill(pid, wxSIGTERM); + CHECK( rc == 0 ); + if ( rc != 0 ) + CHECK( wxKill(pid, wxSIGKILL) == 0 ); int useNoeventsFlag; @@ -249,13 +251,19 @@ void ExecTestCase::TestProcess() long pid = asyncInEventLoop.DoExecute(AsyncExec_ExitLoop, // Force exit of event loop right // after the call to wxExecute() ASYNC_COMMAND, wxEXEC_ASYNC, proc); - CPPUNIT_ASSERT( proc->GetPid() == pid && pid != 0 ); + CPPUNIT_ASSERT( proc->GetPid() == pid ); + CPPUNIT_ASSERT( pid != 0 ); + + // As above, give the system time to launch the process. + wxMilliSleep(200); // we're not going to process the wxEVT_END_PROCESS event, // so the proc instance will auto-delete itself after we kill // the asynch process: - CPPUNIT_ASSERT( wxKill(pid, wxSIGTERM) == 0 || - wxKill(pid, wxSIGKILL) == 0 ); + const int rc = wxKill(pid, wxSIGTERM); + CHECK( rc == 0 ); + if ( rc != 0 ) + CHECK( wxKill(pid, wxSIGKILL) == 0 ); // test wxExecute with wxProcess and REDIRECTION diff --git a/tests/file/filefn.cpp b/tests/file/filefn.cpp index ac07189fb4..49d8767dbd 100644 --- a/tests/file/filefn.cpp +++ b/tests/file/filefn.cpp @@ -162,13 +162,16 @@ void FileFunctionsTestCase::CopyFile() wxFFile f1(filename1, wxT("rb")), f2(filename2, wxT("rb")); - CPPUNIT_ASSERT_MESSAGE( msg, f1.IsOpened() && f2.IsOpened() ); + CPPUNIT_ASSERT_MESSAGE( msg, f1.IsOpened() ); + CPPUNIT_ASSERT_MESSAGE( msg, f2.IsOpened() ); wxString s1, s2; - CPPUNIT_ASSERT_MESSAGE( msg, f1.ReadAll(&s1) && f2.ReadAll(&s2) ); + CPPUNIT_ASSERT_MESSAGE( msg, f1.ReadAll(&s1) ); + CPPUNIT_ASSERT_MESSAGE( msg, f2.ReadAll(&s2) ); CPPUNIT_ASSERT_MESSAGE( msg, s1 == s2 ); - CPPUNIT_ASSERT_MESSAGE( msg, f1.Close() && f2.Close() ); + CPPUNIT_ASSERT_MESSAGE( msg, f1.Close() ); + CPPUNIT_ASSERT_MESSAGE( msg, f2.Close() ); CPPUNIT_ASSERT_MESSAGE( msg, wxRemoveFile(filename2) ); } @@ -394,14 +397,16 @@ void FileFunctionsTestCase::DoConcatFile(const wxString& filePath1, // Prepare source data wxFFile f1(filePath1, wxT("wb")), f2(filePath2, wxT("wb")); - CPPUNIT_ASSERT_MESSAGE( msg, f1.IsOpened() && f2.IsOpened() ); + CPPUNIT_ASSERT_MESSAGE( msg, f1.IsOpened() ); + CPPUNIT_ASSERT_MESSAGE( msg, f2.IsOpened() ); wxString s1(wxT("1234567890")); wxString s2(wxT("abcdefghij")); CPPUNIT_ASSERT_MESSAGE( msg, f1.Write(s1) ); CPPUNIT_ASSERT_MESSAGE( msg, f2.Write(s2) ); - CPPUNIT_ASSERT_MESSAGE( msg, f1.Close() && f2.Close() ); + CPPUNIT_ASSERT_MESSAGE( msg, f1.Close() ); + CPPUNIT_ASSERT_MESSAGE( msg, f2.Close() ); // Concatenate source files CPPUNIT_ASSERT_MESSAGE( msg, wxConcatFiles(filePath1, filePath2, destFilePath) ); @@ -412,8 +417,8 @@ void FileFunctionsTestCase::DoConcatFile(const wxString& filePath1, wxString s3; wxFFile f3(destFilePath, wxT("rb")); CPPUNIT_ASSERT_MESSAGE( msg, f3.ReadAll(&s3) ); - CPPUNIT_ASSERT_MESSAGE( msg, (sSrc.length() == s3.length()) && - (memcmp(sSrc.c_str(), s3.c_str(), sSrc.length()) == 0) ); + CPPUNIT_ASSERT_MESSAGE( msg, sSrc.length() == s3.length() ); + CPPUNIT_ASSERT_MESSAGE( msg, memcmp(sSrc.c_str(), s3.c_str(), sSrc.length()) == 0 ); CPPUNIT_ASSERT_MESSAGE( msg, f3.Close() ); CPPUNIT_ASSERT_MESSAGE( msg, wxRemoveFile(filePath1) ); @@ -515,8 +520,8 @@ void FileFunctionsTestCase::PathOnly() CPPUNIT_ASSERT( filename.MakeAbsolute() ); wxString pathOnly = wxPathOnly(filename.GetFullPath()); - const std::string msg = wxString::Format("Path: %s", pathOnly).ToStdString(); - CPPUNIT_ASSERT_MESSAGE( msg, wxDirExists(pathOnly) || pathOnly.empty() ); + if ( !wxDirExists(pathOnly) ) + CPPUNIT_ASSERT( pathOnly == wxString() ); } // Unit tests for Mkdir and Rmdir doesn't cover non-ASCII directory names. diff --git a/tests/file/filetest.cpp b/tests/file/filetest.cpp index 8a3618dd83..31870164c3 100644 --- a/tests/file/filetest.cpp +++ b/tests/file/filetest.cpp @@ -123,7 +123,8 @@ void FileTestCase::DoRoundTripTest(const wxMBConv& conv) void FileTestCase::TempFile() { wxTempFile tmpFile; - CPPUNIT_ASSERT( tmpFile.Open(wxT("test2")) && tmpFile.Write(wxT("the answer is 42")) ); + CPPUNIT_ASSERT( tmpFile.Open(wxT("test2")) ); + CPPUNIT_ASSERT( tmpFile.Write(wxT("the answer is 42")) ); CPPUNIT_ASSERT( tmpFile.Commit() ); CPPUNIT_ASSERT( wxRemoveFile(wxT("test2")) ); } diff --git a/tests/font/fonttest.cpp b/tests/font/fonttest.cpp index 3491af6fcf..62a53de69d 100644 --- a/tests/font/fonttest.cpp +++ b/tests/font/fonttest.cpp @@ -204,12 +204,11 @@ void FontTestCase::GetSet() test.SetStyle(wxFONTSTYLE_SLANT); CPPUNIT_ASSERT( test.IsOk() ); #ifdef __WXMSW__ - // on wxMSW wxFONTSTYLE_SLANT==wxFONTSTYLE_ITALIC - CPPUNIT_ASSERT( wxFONTSTYLE_SLANT == test.GetStyle() || - wxFONTSTYLE_ITALIC == test.GetStyle() ); -#else - CPPUNIT_ASSERT_EQUAL( wxFONTSTYLE_SLANT, test.GetStyle() ); + // on wxMSW wxFONTSTYLE_SLANT==wxFONTSTYLE_ITALIC, so accept the latter + // as a valid value too. + if ( test.GetStyle() != wxFONTSTYLE_ITALIC ) #endif + CPPUNIT_ASSERT_EQUAL( wxFONTSTYLE_SLANT, test.GetStyle() ); // test Get/SetUnderlined() diff --git a/tests/geometry/point.cpp b/tests/geometry/point.cpp index f15fc45506..637c14848d 100644 --- a/tests/geometry/point.cpp +++ b/tests/geometry/point.cpp @@ -72,8 +72,10 @@ void PointTestCase::Operators() wxPoint p4(5,1); wxPoint p5 = p2 + p1; wxPoint p6 = p2 - p1; - CPPUNIT_ASSERT( p3.x == p5.x && p3.y == p5.y ); - CPPUNIT_ASSERT( p4.x == p6.x && p4.y == p6.y ); + CPPUNIT_ASSERT( p3.x == p5.x ); + CPPUNIT_ASSERT( p3.y == p5.y ); + CPPUNIT_ASSERT( p4.x == p6.x ); + CPPUNIT_ASSERT( p4.y == p6.y ); CPPUNIT_ASSERT( p3 == p5 ); CPPUNIT_ASSERT( p4 == p6 ); CPPUNIT_ASSERT( p3 != p4 ); @@ -110,6 +112,8 @@ void RealPointTestCase::Operators() CPPUNIT_ASSERT( p4 == p6 ); CPPUNIT_ASSERT( p3 != p4 ); */ - CPPUNIT_ASSERT( fabs( p3.x - p5.x ) < EPSILON && fabs( p3.y - p5.y ) < EPSILON ); - CPPUNIT_ASSERT( fabs( p4.x - p6.x ) < EPSILON && fabs( p4.y - p6.y ) < EPSILON ); + CPPUNIT_ASSERT( fabs( p3.x - p5.x ) < EPSILON ); + CPPUNIT_ASSERT( fabs( p3.y - p5.y ) < EPSILON ); + CPPUNIT_ASSERT( fabs( p4.x - p6.x ) < EPSILON ); + CPPUNIT_ASSERT( fabs( p4.y - p6.y ) < EPSILON ); } diff --git a/tests/geometry/size.cpp b/tests/geometry/size.cpp index 885e262ab3..245aa28771 100644 --- a/tests/geometry/size.cpp +++ b/tests/geometry/size.cpp @@ -52,26 +52,33 @@ void SizeTestCase::Operators() wxSize s3; s3 = s1 + s2; - CPPUNIT_ASSERT( s3.GetWidth()==4 && s3.GetHeight()==6 ); + CPPUNIT_ASSERT( s3.GetWidth()==4 ); + CPPUNIT_ASSERT( s3.GetHeight()==6 ); s3 = s2 - s1; - CPPUNIT_ASSERT( s3.GetWidth()==2 && s3.GetHeight()==2 ); + CPPUNIT_ASSERT( s3.GetWidth()==2 ); + CPPUNIT_ASSERT( s3.GetHeight()==2 ); s3 = s1 * 2; - CPPUNIT_ASSERT( s3.GetWidth()==2 && s3.GetHeight()==4 ); + CPPUNIT_ASSERT( s3.GetWidth()==2 ); + CPPUNIT_ASSERT( s3.GetHeight()==4 ); s3 = 2 * s1; - CPPUNIT_ASSERT( s3.GetWidth()==2 && s3.GetHeight()==4 ); + CPPUNIT_ASSERT( s3.GetWidth()==2 ); + CPPUNIT_ASSERT( s3.GetHeight()==4 ); s3 = s3 / 2; - CPPUNIT_ASSERT( s3.GetWidth()==1 && s3.GetHeight()==2 ); + CPPUNIT_ASSERT( s3.GetWidth()==1 ); + CPPUNIT_ASSERT( s3.GetHeight()==2 ); s3 = s2; CPPUNIT_ASSERT( s3 != s1 ); s3 = s1; CPPUNIT_ASSERT( s3 == s1 ); s3 += s2; - CPPUNIT_ASSERT( s3.GetWidth()==4 && s3.GetHeight()==6 ); + CPPUNIT_ASSERT( s3.GetWidth()==4 ); + CPPUNIT_ASSERT( s3.GetHeight()==6 ); s3 -= s2; CPPUNIT_ASSERT( s3 == s1 ); s3 *= 2; - CPPUNIT_ASSERT( s3.GetWidth()==2 && s3.GetHeight()==4 ); + CPPUNIT_ASSERT( s3.GetWidth()==2 ); + CPPUNIT_ASSERT( s3.GetHeight()==4 ); s3 /= 2; CPPUNIT_ASSERT( s3 == s1 ); } diff --git a/tests/graphics/affinematrix.cpp b/tests/graphics/affinematrix.cpp index d144dbf6ec..dce58f76ae 100644 --- a/tests/graphics/affinematrix.cpp +++ b/tests/graphics/affinematrix.cpp @@ -407,8 +407,8 @@ void TransformMatrixTestCaseDCBase::VMirrorAndTranslate() m_dc->DrawBitmap(m_bmpOrig, 0, 0); FlushDC(); - CPPUNIT_ASSERT_EQUAL( m_bmpUsingMatrix.ConvertToImage(), - m_imgOrig.Mirror(false) ); + CHECK_THAT( m_bmpUsingMatrix.ConvertToImage(), + RGBSameAs(m_imgOrig.Mirror(false)) ); } void TransformMatrixTestCaseDCBase::Rotate90Clockwise() @@ -424,8 +424,8 @@ void TransformMatrixTestCaseDCBase::Rotate90Clockwise() m_dc->DrawBitmap(m_bmpOrig, 0, 0); FlushDC(); - CPPUNIT_ASSERT_EQUAL( m_bmpUsingMatrix.ConvertToImage(), - m_imgOrig.Rotate90(true) ); + CHECK_THAT( m_bmpUsingMatrix.ConvertToImage(), + RGBSameAs(m_imgOrig.Rotate90(true)) ); } #if wxUSE_GRAPHICS_CONTEXT @@ -528,8 +528,8 @@ void TransformMatrixTestCaseDCBase::CompareToGraphicsContext() } - CPPUNIT_ASSERT_EQUAL( bmpUsingMatrixA1.ConvertToImage(), - bmpUsingMatrixAG.ConvertToImage() ); + CHECK_THAT( bmpUsingMatrixA1.ConvertToImage(), + RGBSameAs(bmpUsingMatrixAG.ConvertToImage()) ); // Save the images to check that something _is_ inside the visible area. //bmpUsingMatrixA1.SaveFile("matrixA1.jpg", wxBITMAP_TYPE_JPEG); diff --git a/tests/image/image.cpp b/tests/image/image.cpp index 7d8731d911..a4692d509c 100644 --- a/tests/image/image.cpp +++ b/tests/image/image.cpp @@ -835,14 +835,9 @@ void ImageTestCase::SizeImage() //actual.SaveFile(wxString::Format("imagetest-%02d-actual.png", i), wxBITMAP_TYPE_PNG); //expected.SaveFile(wxString::Format("imagetest-%02d-exp.png", i), wxBITMAP_TYPE_PNG); - CPPUNIT_ASSERT_EQUAL( actual.GetSize().x, expected.GetSize().x ); - CPPUNIT_ASSERT_EQUAL( actual.GetSize().y, expected.GetSize().y ); - - WX_ASSERT_EQUAL_MESSAGE - ( - ("Resize test #%u: (%d, %d), (%d, %d)", i, st.w, st.h, st.dx, st.dy), - expected, actual - ); + wxINFO_FMT("Resize test #%u: (%d, %d), (%d, %d)", + i, st.w, st.h, st.dx, st.dy); + CHECK_THAT( actual, RGBSameAs(expected) ); } } @@ -870,12 +865,10 @@ void ImageTestCase::CompareLoadedImage() } - WX_ASSERT_EQUAL_MESSAGE - ( - ("Compare test '%s' for loading failed", g_testfiles[i].file), - g_testfiles[i].bitDepth == 8 ? expected8 : expected24, - actual - ); + wxINFO_FMT("Compare test '%s' for loading", g_testfiles[i].file); + CHECK_THAT( actual, + RGBSameAs(g_testfiles[i].bitDepth == 8 ? expected8 + : expected24) ); } } @@ -936,16 +929,11 @@ void CompareImage(const wxImageHandler& handler, const wxImage& image, CPPUNIT_ASSERT(actual.IsOk()); const wxImage *expected = compareTo ? compareTo : ℑ - CPPUNIT_ASSERT( actual.GetSize() == expected->GetSize() ); unsigned bitsPerPixel = testPalette ? 8 : (testAlpha ? 32 : 24); - WX_ASSERT_EQUAL_MESSAGE - ( - ("Compare test '%s (%d-bit)' for saving failed", - handler.GetExtension(), bitsPerPixel), - *expected, - actual - ); + wxINFO_FMT("Compare test '%s (%d-bit)' for saving", + handler.GetExtension(), bitsPerPixel); + CHECK_THAT(actual, RGBSameAs(*expected)); #if wxUSE_PALETTE CPPUNIT_ASSERT(actual.HasPalette() @@ -959,12 +947,8 @@ void CompareImage(const wxImageHandler& handler, const wxImage& image, return; } - WX_ASSERT_EQUAL_MESSAGE - ( - ("Compare alpha test '%s' for saving failed", handler.GetExtension()), - *expected, - actual - ); + wxINFO_FMT("Compare alpha test '%s' for saving", handler.GetExtension()); + CHECK_THAT(actual, RGBSameAs(*expected)); } static void SetAlpha(wxImage *image) @@ -1180,12 +1164,8 @@ void ImageTestCase::SaveAnimatedGIF() CPPUNIT_ASSERT( handler.LoadFile(&image, memIn, true, i) ); memIn.SeekI(pos); - WX_ASSERT_EQUAL_MESSAGE - ( - ("Compare test for GIF frame number %d failed", i), - images[i], - image - ); + wxINFO_FMT("Compare test for GIF frame number %d failed", i); + CHECK_THAT(image, RGBSameAs(images[i])); } #endif // #if wxUSE_PALETTE } @@ -1386,7 +1366,7 @@ CompareApprox(const wxImage& i1, const wxImage& i2) CPPUNIT_ASSERT_MESSAGE( "Failed to load " file, imageFromFile.IsOk() ); \ CPPUNIT_ASSERT_MESSAGE \ ( \ - "Wrong scaled " + CppUnit::assertion_traits::toString(image), \ + "Wrong scaled " + Catch::toString(image), \ CompareApprox(imageFromFile, image) \ ); \ } diff --git a/tests/interactive/input.cpp b/tests/interactive/input.cpp index 7c8f11f776..da72fd6755 100644 --- a/tests/interactive/input.cpp +++ b/tests/interactive/input.cpp @@ -67,10 +67,9 @@ private: // CppUnit macros // ---------------------------------------------------------------------------- -//CPPUNIT_TEST_SUITE_REGISTRATION( InteractiveInputTestCase ); - // do not run this test by default! - -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( InteractiveInputTestCase, "InteractiveInputTestCase" ); +// Register this test case as hidden, it shouldn't be run by default. +wxREGISTER_UNIT_TEST_WITH_TAGS(InteractiveInputTestCase, + "[!hide][interactive][input]"); // ============================================================================ // implementation diff --git a/tests/interactive/output.cpp b/tests/interactive/output.cpp index f72d07fa3e..92bc35891f 100644 --- a/tests/interactive/output.cpp +++ b/tests/interactive/output.cpp @@ -76,10 +76,8 @@ private: // CppUnit macros // ---------------------------------------------------------------------------- -//CPPUNIT_TEST_SUITE_REGISTRATION( InteractiveOutputTestCase ); - // do not run this test by default! - -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( InteractiveOutputTestCase, "InteractiveOutputTestCase" ); +wxREGISTER_UNIT_TEST_WITH_TAGS(InteractiveOutputTestCase, + "[!hide][interactive][output]"); // ============================================================================ // implementation diff --git a/tests/lists/lists.cpp b/tests/lists/lists.cpp index b5be06d72d..f4b1e3472d 100644 --- a/tests/lists/lists.cpp +++ b/tests/lists/lists.cpp @@ -132,12 +132,13 @@ void ListsTestCase::wxStdListTest() CPPUNIT_ASSERT( *rit == i + &i ); } - CPPUNIT_ASSERT( *list1.rbegin() == *--list1.end() && - *list1.begin() == *--list1.rend() ); - CPPUNIT_ASSERT( *list1.begin() == *--++list1.begin() && - *list1.rbegin() == *--++list1.rbegin() ); + CPPUNIT_ASSERT( *list1.rbegin() == *--list1.end() ); + CPPUNIT_ASSERT( *list1.begin() == *--list1.rend() ); + CPPUNIT_ASSERT( *list1.begin() == *--++list1.begin() ); + CPPUNIT_ASSERT( *list1.rbegin() == *--++list1.rbegin() ); - CPPUNIT_ASSERT( list1.front() == &i && list1.back() == &i + 4 ); + CPPUNIT_ASSERT( list1.front() == &i ); + CPPUNIT_ASSERT( list1.back() == &i + 4 ); list1.erase(list1.begin()); list1.erase(--list1.end()); diff --git a/tests/log/logtest.cpp b/tests/log/logtest.cpp index a9136801fe..60b7f7cc5a 100644 --- a/tests/log/logtest.cpp +++ b/tests/log/logtest.cpp @@ -248,7 +248,7 @@ void LogTestCase::Null() void LogTestCase::Component() { wxLogMessage("Message"); - CPPUNIT_ASSERT_EQUAL( wxLOG_COMPONENT, + CPPUNIT_ASSERT_EQUAL( std::string(wxLOG_COMPONENT), m_log->GetInfo(wxLOG_Message).component ); // completely disable logging for this component diff --git a/tests/makefile.bcc b/tests/makefile.bcc index 5d6aca86cd..d09d849d64 100644 --- a/tests/makefile.bcc +++ b/tests/makefile.bcc @@ -34,7 +34,7 @@ TEST_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \ $(__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 $(CPPUNIT_CFLAGS) -Hu \ + $(__DLLFLAG_p) -DwxUSE_GUI=0 -I.\..\3rdparty\catch\include -Hu \ -H=$(OBJS)\testprec_test.csm $(CPPFLAGS) $(CXXFLAGS) TEST_OBJECTS = \ $(OBJS)\test_dummy.obj \ @@ -96,7 +96,6 @@ TEST_OBJECTS = \ $(OBJS)\test_crt.obj \ $(OBJS)\test_vsnprintf.obj \ $(OBJS)\test_hexconv.obj \ - $(OBJS)\test_bstream.obj \ $(OBJS)\test_datastreamtest.obj \ $(OBJS)\test_ffilestream.obj \ $(OBJS)\test_fileback.obj \ @@ -128,7 +127,7 @@ TEST_DRAWING_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \ $(__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 $(CPPUNIT_CFLAGS) -Hu \ + $(__DLLFLAG_p) -DwxUSE_GUI=0 -I.\..\3rdparty\catch\include -Hu \ -H=$(OBJS)\testprec_test_drawing.csm $(CPPFLAGS) $(CXXFLAGS) TEST_DRAWING_OBJECTS = \ $(OBJS)\test_drawing_dummy.obj \ @@ -150,7 +149,7 @@ TEST_GUI_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \ $(__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 $(CPPUNIT_CFLAGS) -Hu \ + $(__DLLFLAG_p) -I.\..\samples -DNOPCH -I.\..\3rdparty\catch\include -Hu \ -H=$(OBJS)\testprec_test_gui.csm $(CPPFLAGS) $(CXXFLAGS) TEST_GUI_OBJECTS = \ $(OBJS)\test_gui_dummy.obj \ @@ -497,13 +496,13 @@ clean: -if exist $(OBJS)\test_gui.ils del $(OBJS)\test_gui.ils $(OBJS)\test.exe: $(OBJS)\test_dummy.obj $(TEST_OBJECTS) - ilink32 -Tpe -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -ap $(CPPUNIT_LIBS) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @&&| + ilink32 -Tpe -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -ap $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @&&| c0x32.obj $(TEST_OBJECTS),$@,, $(__WXLIB_NET_p) $(__WXLIB_XML_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 import32.lib cw32$(__THREADSFLAG)$(__RUNTIME_LIBS_2).lib,, | !if "$(USE_GUI)" == "1" $(OBJS)\test_drawing.exe: $(OBJS)\test_drawing_dummy.obj $(TEST_DRAWING_OBJECTS) - ilink32 -Tpe -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -ap $(CPPUNIT_LIBS) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @&&| + ilink32 -Tpe -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -ap $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @&&| c0x32.obj $(TEST_DRAWING_OBJECTS),$@,, $(__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) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32$(__THREADSFLAG)$(__RUNTIME_LIBS_2).lib,, | !endif @@ -517,7 +516,7 @@ $(OBJS)\test_drawingplugin.dll: $(TEST_DRAWINGPLUGIN_OBJECTS) !if "$(USE_GUI)" == "1" $(OBJS)\test_gui.exe: $(OBJS)\test_gui_dummy.obj $(TEST_GUI_OBJECTS) $(OBJS)\test_gui_sample.res - ilink32 -Tpe -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) $(CPPUNIT_LIBS) -ap $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @&&| + ilink32 -Tpe -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -ap $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @&&| c0x32.obj $(TEST_GUI_OBJECTS),$@,, $(__WXLIB_WEBVIEW_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(__WXLIB_ADV_p) $(__WXLIB_HTML_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) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32$(__THREADSFLAG)$(__RUNTIME_LIBS_2).lib,, $(OBJS)\test_gui_sample.res | !endif @@ -715,9 +714,6 @@ $(OBJS)\test_vsnprintf.obj: .\strings\vsnprintf.cpp $(OBJS)\test_hexconv.obj: .\strings\hexconv.cpp $(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) .\strings\hexconv.cpp -$(OBJS)\test_bstream.obj: .\streams\bstream.cpp - $(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) .\streams\bstream.cpp - $(OBJS)\test_datastreamtest.obj: .\streams\datastreamtest.cpp $(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) .\streams\datastreamtest.cpp @@ -818,7 +814,7 @@ $(OBJS)\test_drawingplugin_pluginsample.obj: .\drawing\pluginsample.cpp $(CXX) -q -c -P -o$@ $(TEST_DRAWINGPLUGIN_CXXFLAGS) .\drawing\pluginsample.cpp $(OBJS)\test_gui_sample.res: .\..\samples\sample.rc - brcc32 -32 -r -fo$@ -i$(BCCDIR)\include -d__WXMSW__ $(__WXUNIV_DEFINE_p_7) $(__DEBUG_DEFINE_p_7) $(__NDEBUG_DEFINE_p_7) $(__EXCEPTIONS_DEFINE_p_7) $(__RTTI_DEFINE_p_7) $(__THREAD_DEFINE_p_7) $(__UNICODE_DEFINE_p_7) -i$(SETUPHDIR) -i.\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_7_p) -i. $(__DLLFLAG_p_7) -i.\..\samples -i$(BCCDIR)\include\windows\sdk -dNOPCH .\..\samples\sample.rc + brcc32 -32 -r -fo$@ -i$(BCCDIR)\include -d__WXMSW__ $(__WXUNIV_DEFINE_p_7) $(__DEBUG_DEFINE_p_7) $(__NDEBUG_DEFINE_p_7) $(__EXCEPTIONS_DEFINE_p_7) $(__RTTI_DEFINE_p_7) $(__THREAD_DEFINE_p_7) $(__UNICODE_DEFINE_p_7) -i$(SETUPHDIR) -i.\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_7_p) -i. $(__DLLFLAG_p_7) -i.\..\samples -i$(BCCDIR)\include\windows\sdk -dNOPCH -i.\..\3rdparty\catch\include .\..\samples\sample.rc $(OBJS)\test_gui_dummy.obj: .\dummy.cpp $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) -H .\dummy.cpp diff --git a/tests/makefile.gcc b/tests/makefile.gcc index bd91129c22..15b7c210c4 100644 --- a/tests/makefile.gcc +++ b/tests/makefile.gcc @@ -26,8 +26,8 @@ TEST_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) $(GCCFLAGS) \ $(__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 \ - $(CPPUNIT_CFLAGS) $(__RTTIFLAG) $(__EXCEPTIONSFLAG) -Wno-ctor-dtor-privacy \ - $(CPPFLAGS) $(CXXFLAGS) + -I.\..\3rdparty\catch\include $(__RTTIFLAG) $(__EXCEPTIONSFLAG) \ + -Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS) TEST_OBJECTS = \ $(OBJS)\test_dummy.o \ $(OBJS)\test_test.o \ @@ -88,7 +88,6 @@ TEST_OBJECTS = \ $(OBJS)\test_crt.o \ $(OBJS)\test_vsnprintf.o \ $(OBJS)\test_hexconv.o \ - $(OBJS)\test_bstream.o \ $(OBJS)\test_datastreamtest.o \ $(OBJS)\test_ffilestream.o \ $(OBJS)\test_fileback.o \ @@ -120,7 +119,7 @@ TEST_DRAWING_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) \ $(__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 $(CPPUNIT_CFLAGS) $(__RTTIFLAG) \ + $(__DLLFLAG_p) -DwxUSE_GUI=0 -I.\..\3rdparty\catch\include $(__RTTIFLAG) \ $(__EXCEPTIONSFLAG) -Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS) TEST_DRAWING_OBJECTS = \ $(OBJS)\test_drawing_dummy.o \ @@ -143,8 +142,9 @@ TEST_GUI_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) \ $(__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 $(CPPUNIT_CFLAGS) $(__RTTIFLAG) \ - $(__EXCEPTIONSFLAG) -Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS) + $(__DLLFLAG_p) -I.\..\samples -DNOPCH -I.\..\3rdparty\catch\include \ + $(__RTTIFLAG) $(__EXCEPTIONSFLAG) -Wno-ctor-dtor-privacy $(CPPFLAGS) \ + $(CXXFLAGS) TEST_GUI_OBJECTS = \ $(OBJS)\test_gui_sample_rc.o \ $(OBJS)\test_gui_dummy.o \ @@ -479,11 +479,11 @@ clean: -if exist $(OBJS)\test_gui.exe del $(OBJS)\test_gui.exe $(OBJS)\test.exe: $(TEST_OBJECTS) - $(CXX) -o $@ $(TEST_OBJECTS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(CPPUNIT_LIBS) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__WXLIB_NET_p) $(__WXLIB_XML_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 + $(CXX) -o $@ $(TEST_OBJECTS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__WXLIB_NET_p) $(__WXLIB_XML_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 ifeq ($(USE_GUI),1) $(OBJS)\test_drawing.exe: $(TEST_DRAWING_OBJECTS) - $(CXX) -o $@ $(TEST_DRAWING_OBJECTS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(CPPUNIT_LIBS) $(____CAIRO_LIBDIR_FILENAMES) $(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) -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 + $(CXX) -o $@ $(TEST_DRAWING_OBJECTS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(____CAIRO_LIBDIR_FILENAMES) $(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) -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 endif ifeq ($(SHARED),1) @@ -495,7 +495,7 @@ endif ifeq ($(USE_GUI),1) $(OBJS)\test_gui.exe: $(TEST_GUI_OBJECTS) $(OBJS)\test_gui_sample_rc.o - $(CXX) -o $@ $(TEST_GUI_OBJECTS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(CPPUNIT_LIBS) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__WXLIB_WEBVIEW_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(__WXLIB_ADV_p) $(__WXLIB_HTML_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) -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 + $(CXX) -o $@ $(TEST_GUI_OBJECTS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__WXLIB_WEBVIEW_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(__WXLIB_ADV_p) $(__WXLIB_HTML_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) -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 endif data: @@ -691,9 +691,6 @@ $(OBJS)\test_vsnprintf.o: ./strings/vsnprintf.cpp $(OBJS)\test_hexconv.o: ./strings/hexconv.cpp $(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $< -$(OBJS)\test_bstream.o: ./streams/bstream.cpp - $(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $< - $(OBJS)\test_datastreamtest.o: ./streams/datastreamtest.cpp $(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $< @@ -794,7 +791,7 @@ $(OBJS)\test_drawingplugin_pluginsample.o: ./drawing/pluginsample.cpp $(CXX) -c -o $@ $(TEST_DRAWINGPLUGIN_CXXFLAGS) $(CPPDEPS) $< $(OBJS)\test_gui_sample_rc.o: ./../samples/sample.rc - $(WINDRES) -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_6) $(__DEBUG_DEFINE_p_6) $(__NDEBUG_DEFINE_p_6) $(__EXCEPTIONS_DEFINE_p_6) $(__RTTI_DEFINE_p_6) $(__THREAD_DEFINE_p_6) $(__UNICODE_DEFINE_p_6) --include-dir $(SETUPHDIR) --include-dir ./../include $(__CAIRO_INCLUDEDIR_p_2) --include-dir . $(__DLLFLAG_p_6) --include-dir ./../samples --define NOPCH + $(WINDRES) -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_6) $(__DEBUG_DEFINE_p_6) $(__NDEBUG_DEFINE_p_6) $(__EXCEPTIONS_DEFINE_p_6) $(__RTTI_DEFINE_p_6) $(__THREAD_DEFINE_p_6) $(__UNICODE_DEFINE_p_6) --include-dir $(SETUPHDIR) --include-dir ./../include $(__CAIRO_INCLUDEDIR_p_2) --include-dir . $(__DLLFLAG_p_6) --include-dir ./../samples --define NOPCH --include-dir ./../3rdparty/catch/include $(OBJS)\test_gui_dummy.o: ./dummy.cpp $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $< diff --git a/tests/makefile.vc b/tests/makefile.vc index fe5a56af8d..e4aa4a03bb 100644 --- a/tests/makefile.vc +++ b/tests/makefile.vc @@ -28,8 +28,9 @@ TEST_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME) /DWIN32 $(__DEBUGINFO) \ $(__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 \ - /DwxUSE_GUI=0 $(CPPUNIT_CFLAGS) $(__RTTIFLAG) $(__EXCEPTIONSFLAG) \ - /Yu"testprec.h" /Fp"$(OBJS)\testprec_test.pch" $(CPPFLAGS) $(CXXFLAGS) + /DwxUSE_GUI=0 /I.\..\3rdparty\catch\include $(__RTTIFLAG) \ + $(__EXCEPTIONSFLAG) /Yu"testprec.h" /Fp"$(OBJS)\testprec_test.pch" \ + $(CPPFLAGS) $(CXXFLAGS) TEST_OBJECTS = \ $(OBJS)\test_dummy.obj \ $(OBJS)\test_test.obj \ @@ -90,7 +91,6 @@ TEST_OBJECTS = \ $(OBJS)\test_crt.obj \ $(OBJS)\test_vsnprintf.obj \ $(OBJS)\test_hexconv.obj \ - $(OBJS)\test_bstream.obj \ $(OBJS)\test_datastreamtest.obj \ $(OBJS)\test_ffilestream.obj \ $(OBJS)\test_fileback.obj \ @@ -125,9 +125,9 @@ TEST_DRAWING_CXXFLAGS = /M$(__RUNTIME_LIBS_27)$(__DEBUGRUNTIME) /DWIN32 \ $(__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 \ - /DwxUSE_GUI=0 $(CPPUNIT_CFLAGS) $(__RTTIFLAG) $(__EXCEPTIONSFLAG) \ - /Yu"testprec.h" /Fp"$(OBJS)\testprec_test_drawing.pch" $(CPPFLAGS) \ - $(CXXFLAGS) + /DwxUSE_GUI=0 /I.\..\3rdparty\catch\include $(__RTTIFLAG) \ + $(__EXCEPTIONSFLAG) /Yu"testprec.h" /Fp"$(OBJS)\testprec_test_drawing.pch" \ + $(CPPFLAGS) $(CXXFLAGS) TEST_DRAWING_OBJECTS = \ $(OBJS)\test_drawing_dummy.obj \ $(OBJS)\test_drawing_test.obj \ @@ -154,8 +154,9 @@ TEST_GUI_CXXFLAGS = /M$(__RUNTIME_LIBS_59)$(__DEBUGRUNTIME) /DWIN32 \ $(__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 $(CPPUNIT_CFLAGS) /D_CONSOLE $(__RTTIFLAG) $(__EXCEPTIONSFLAG) \ - /Yu"testprec.h" /Fp"$(OBJS)\testprec_test_gui.pch" $(CPPFLAGS) $(CXXFLAGS) + /DNOPCH /I.\..\3rdparty\catch\include /D_CONSOLE $(__RTTIFLAG) \ + $(__EXCEPTIONSFLAG) /Yu"testprec.h" /Fp"$(OBJS)\testprec_test_gui.pch" \ + $(CPPFLAGS) $(CXXFLAGS) TEST_GUI_OBJECTS = \ $(OBJS)\test_gui_dummy.obj \ $(OBJS)\test_gui_asserthelper.obj \ @@ -674,13 +675,13 @@ clean: -if exist $(OBJS)\test_gui.pdb del $(OBJS)\test_gui.pdb $(OBJS)\test.exe: $(OBJS)\test_dummy.obj $(TEST_OBJECTS) - link /NOLOGO /OUT:$@ $(__DEBUGINFO_4) /pdb:"$(OBJS)\test.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:CONSOLE $(CPPUNIT_LIBS) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @<< + link /NOLOGO /OUT:$@ $(__DEBUGINFO_4) /pdb:"$(OBJS)\test.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:CONSOLE $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @<< $(TEST_OBJECTS) $(__WXLIB_NET_p) $(__WXLIB_XML_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) 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 << !if "$(USE_GUI)" == "1" $(OBJS)\test_drawing.exe: $(OBJS)\test_drawing_dummy.obj $(TEST_DRAWING_OBJECTS) - link /NOLOGO /OUT:$@ $(__DEBUGINFO_4) /pdb:"$(OBJS)\test_drawing.pdb" $(__DEBUGINFO_19) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:CONSOLE $(CPPUNIT_LIBS) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @<< + link /NOLOGO /OUT:$@ $(__DEBUGINFO_4) /pdb:"$(OBJS)\test_drawing.pdb" $(__DEBUGINFO_19) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:CONSOLE $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @<< $(TEST_DRAWING_OBJECTS) $(__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) 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 @@ -694,7 +695,7 @@ $(OBJS)\test_drawingplugin.dll: $(TEST_DRAWINGPLUGIN_OBJECTS) !if "$(USE_GUI)" == "1" $(OBJS)\test_gui.exe: $(OBJS)\test_gui_dummy.obj $(TEST_GUI_OBJECTS) $(OBJS)\test_gui_sample.res - link /NOLOGO /OUT:$@ $(__DEBUGINFO_4) /pdb:"$(OBJS)\test_gui.pdb" $(__DEBUGINFO_51) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(CPPUNIT_LIBS) /SUBSYSTEM:CONSOLE $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @<< + link /NOLOGO /OUT:$@ $(__DEBUGINFO_4) /pdb:"$(OBJS)\test_gui.pdb" $(__DEBUGINFO_51) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:CONSOLE $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @<< $(TEST_GUI_OBJECTS) $(TEST_GUI_RESOURCES) $(__WXLIB_WEBVIEW_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(__WXLIB_ADV_p) $(__WXLIB_HTML_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) 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 @@ -892,9 +893,6 @@ $(OBJS)\test_vsnprintf.obj: .\strings\vsnprintf.cpp $(OBJS)\test_hexconv.obj: .\strings\hexconv.cpp $(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) .\strings\hexconv.cpp -$(OBJS)\test_bstream.obj: .\streams\bstream.cpp - $(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) .\streams\bstream.cpp - $(OBJS)\test_datastreamtest.obj: .\streams\datastreamtest.cpp $(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) .\streams\datastreamtest.cpp @@ -998,7 +996,7 @@ $(OBJS)\test_gui_dummy.obj: .\dummy.cpp $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) /Yctestprec.h .\dummy.cpp $(OBJS)\test_gui_sample.res: .\..\samples\sample.rc - rc /fo$@ /d WIN32 $(____DEBUGRUNTIME_52_p_1) /d _CRT_SECURE_NO_DEPRECATE=1 /d _CRT_NON_CONFORMING_SWPRINTFS=1 /d _SCL_SECURE_NO_WARNINGS=1 $(__NO_VC_CRTDBG_p_7) /d __WXMSW__ $(__WXUNIV_DEFINE_p_7) $(__DEBUG_DEFINE_p_7) $(__NDEBUG_DEFINE_p_7) $(__EXCEPTIONS_DEFINE_p_7) $(__RTTI_DEFINE_p_7) $(__THREAD_DEFINE_p_7) $(__UNICODE_DEFINE_p_7) /i $(SETUPHDIR) /i .\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_7_p) /i . $(__DLLFLAG_p_7) /i .\..\samples /d NOPCH /d _CONSOLE .\..\samples\sample.rc + rc /fo$@ /d WIN32 $(____DEBUGRUNTIME_52_p_1) /d _CRT_SECURE_NO_DEPRECATE=1 /d _CRT_NON_CONFORMING_SWPRINTFS=1 /d _SCL_SECURE_NO_WARNINGS=1 $(__NO_VC_CRTDBG_p_7) /d __WXMSW__ $(__WXUNIV_DEFINE_p_7) $(__DEBUG_DEFINE_p_7) $(__NDEBUG_DEFINE_p_7) $(__EXCEPTIONS_DEFINE_p_7) $(__RTTI_DEFINE_p_7) $(__THREAD_DEFINE_p_7) $(__UNICODE_DEFINE_p_7) /i $(SETUPHDIR) /i .\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_7_p) /i . $(__DLLFLAG_p_7) /i .\..\samples /d NOPCH /i .\..\3rdparty\catch\include /d _CONSOLE .\..\samples\sample.rc $(OBJS)\test_gui_asserthelper.obj: .\asserthelper.cpp $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\asserthelper.cpp diff --git a/tests/mbconv/mbconvtest.cpp b/tests/mbconv/mbconvtest.cpp index 7045b3673e..124a9008a3 100644 --- a/tests/mbconv/mbconvtest.cpp +++ b/tests/mbconv/mbconvtest.cpp @@ -225,7 +225,6 @@ private: CPPUNIT_TEST_SUITE_REGISTRATION( MBConvTestCase ); // also include in its own registry so that these tests can be run alone -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MBConvTestCase, "MBConvTestCase" ); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MBConvTestCase, "MBConv" ); void MBConvTestCase::WC2CP1250() diff --git a/tests/misc/guifuncs.cpp b/tests/misc/guifuncs.cpp index 27bf5654a4..535db58975 100644 --- a/tests/misc/guifuncs.cpp +++ b/tests/misc/guifuncs.cpp @@ -84,7 +84,8 @@ void MiscGUIFuncsTestCase::DisplaySize() // test that display PPI is something reasonable sz = wxGetDisplayPPI(); - CPPUNIT_ASSERT( sz.x < 1000 && sz.y < 1000 ); + CPPUNIT_ASSERT( sz.x < 1000 ); + CPPUNIT_ASSERT( sz.y < 1000 ); } void MiscGUIFuncsTestCase::URLDataObject() diff --git a/tests/misc/module.cpp b/tests/misc/module.cpp index caaa960114..607a3d90a8 100644 --- a/tests/misc/module.cpp +++ b/tests/misc/module.cpp @@ -116,5 +116,6 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ModuleTestCase, "ModuleTestCase" ); void ModuleTestCase::LoadOrder() { // module D is the only one with no dependencies and so should load as first (and so on): - CPPUNIT_ASSERT_EQUAL( "ModuleDModuleCModuleBModuleA", g_strLoadOrder ); + CPPUNIT_ASSERT_EQUAL( std::string("ModuleDModuleCModuleBModuleA"), + g_strLoadOrder ); } diff --git a/tests/misc/settings.cpp b/tests/misc/settings.cpp index ab6f5712f2..bde01ed2bb 100644 --- a/tests/misc/settings.cpp +++ b/tests/misc/settings.cpp @@ -81,8 +81,8 @@ void SettingsTestCase::GetFont() for (unsigned int i=0; i < WXSIZEOF(ids); i++) { const wxFont& font = wxSystemSettings::GetFont(ids[i]); - CPPUNIT_ASSERT( font.IsOk() && - wxFontEnumerator::IsValidFacename(font.GetFaceName()) ); + CPPUNIT_ASSERT( font.IsOk() ); + CPPUNIT_ASSERT( wxFontEnumerator::IsValidFacename(font.GetFaceName()) ); } } diff --git a/tests/regex/regextest.cpp b/tests/regex/regextest.cpp index e64d045b32..b3610cd374 100644 --- a/tests/regex/regextest.cpp +++ b/tests/regex/regextest.cpp @@ -55,7 +55,6 @@ using CppUnit::Test; using CppUnit::TestCase; using CppUnit::TestSuite; -using CppUnit::Exception; using std::string; using std::vector; @@ -375,15 +374,8 @@ void RegExTestSuite::add( va_end(ap); - try { - addTest(new RegExTestCase( - name, mode, id, flags, pattern, data, expected_results)); - } - catch (Exception& e) { - wxLogInfo(wxString::Format(wxT("skipping: %s\n %s\n"), - wxString(name.c_str(), wxConvUTF8).c_str(), - wxString(e.what(), wxConvUTF8).c_str())); - } + addTest(new RegExTestCase( + name, mode, id, flags, pattern, data, expected_results)); } diff --git a/tests/streams/bstream.cpp b/tests/streams/bstream.cpp deleted file mode 100644 index 2095a6323b..0000000000 --- a/tests/streams/bstream.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: tests/streams/bstream.cpp -// Purpose: House the base stream test suite. -// Author: Hans Van Leemputten -// Copyright: (c) 2004 Hans Van Leemputten -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx/wx.h". -// and "wx/cppunit.h" -#include "testprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -// for all others, include the necessary headers -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include "bstream.h" - -using CppUnit::TestSuite; -using CppUnit::Test; - -/////////////////////////////////////////////////////////////////////////////// -// Streams main test suite, it houses all stream test suites. -// - -class StreamCase : public TestSuite -{ -public: - StreamCase() - :TestSuite(STREAM_TEST_NAME) - { /* Nothing extra */ } - static Test *suite(); -}; - -Test *StreamCase::suite() -{ - TestSuite *suite = new StreamCase; - - /* - * Register all sub stream test suites. - */ - - STREAM_REGISTER_SUB_SUITE(memStream); - STREAM_REGISTER_SUB_SUITE(strStream); - STREAM_REGISTER_SUB_SUITE(fileStream); - STREAM_REGISTER_SUB_SUITE(ffileStream); - STREAM_REGISTER_SUB_SUITE(tempStream); - STREAM_REGISTER_SUB_SUITE(zlibStream); - STREAM_REGISTER_SUB_SUITE(backStream); - STREAM_REGISTER_SUB_SUITE(socketStream); - - extern CppUnit::Test* GetlargeFileSuite(); - Test *lfs = GetlargeFileSuite(); - if (lfs) - suite->addTest(lfs); - - /* - ** Add more stream subtests here - */ - - return suite; -} - -// register in the unnamed registry so that these tests are run by default -CPPUNIT_TEST_SUITE_REGISTRATION(StreamCase); -// also include in its own registry so that these tests can be run alone -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(StreamCase, STREAM_TEST_NAME); - diff --git a/tests/streams/bstream.h b/tests/streams/bstream.h index 51a27966c6..bdabe07eb0 100644 --- a/tests/streams/bstream.h +++ b/tests/streams/bstream.h @@ -9,8 +9,6 @@ #ifndef _WX_TESTBSTREAM_H__ #define _WX_TESTBSTREAM_H__ -#include "wx/cppunit.h" - /////////////////////////////////////////////////////////////////////////////// // Some macros preventing us from typing too much ;-) // @@ -18,14 +16,8 @@ #define STREAM_TEST_NAME "Streams" #define COMPOSE_TEST_NAME(Name) \ STREAM_TEST_NAME "." #Name -#define STREAM_REGISTER_SUB_SUITE(Name) \ - extern CppUnit::Test* Get##Name##Suite(); \ - suite->addTest(Get##Name##Suite()) -#define STREAM_IMPLEMENT_SUB_REGISTRATION_ROUTINE(Name) \ - CppUnit::Test* Get##Name##Suite() { return Name::suite(); } #define STREAM_TEST_SUBSUITE_NAMED_REGISTRATION(Name) \ - CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( Name, COMPOSE_TEST_NAME(Name) ); \ - STREAM_IMPLEMENT_SUB_REGISTRATION_ROUTINE( Name ) + CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( Name, COMPOSE_TEST_NAME(Name) ); /////////////////////////////////////////////////////////////////////////////// // Template class that implements a test for all base stream functions. diff --git a/tests/streams/largefile.cpp b/tests/streams/largefile.cpp index d89af98564..fe2bf34133 100644 --- a/tests/streams/largefile.cpp +++ b/tests/streams/largefile.cpp @@ -436,5 +436,4 @@ CppUnit::Test* GetlargeFileSuite() #endif // __WINDOWS__ -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(largeFile, "largeFile"); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(largeFile, "Streams.largeFile"); diff --git a/tests/streams/zlibstream.cpp b/tests/streams/zlibstream.cpp index bc0275afa2..44e7e4911f 100644 --- a/tests/streams/zlibstream.cpp +++ b/tests/streams/zlibstream.cpp @@ -472,8 +472,8 @@ void zlibStream::doDecompress_ExternalData(const unsigned char *data, const char } } - CPPUNIT_ASSERT_MESSAGE("Could not decompress the compressed data, original and restored value did not match.", - i == value_size && bValueEq); + CPPUNIT_ASSERT_EQUAL( i, value_size ); + CPPUNIT_ASSERT( bValueEq ); } wxZlibInputStream *zlibStream::DoCreateInStream() diff --git a/tests/strings/strings.cpp b/tests/strings/strings.cpp index 1cf282b0eb..bfcdb5e187 100644 --- a/tests/strings/strings.cpp +++ b/tests/strings/strings.cpp @@ -1124,11 +1124,11 @@ void StringTestCase::ScopedBuffers() // but assigning it to wxCharBuffer makes a full copy wxCharBuffer buf(sbuf); CPPUNIT_ASSERT( buf.data() != literal ); - CPPUNIT_ASSERT_EQUAL( literal, buf.data() ); + CPPUNIT_ASSERT_EQUAL( std::string(literal), buf.data() ); wxCharBuffer buf2 = sbuf; CPPUNIT_ASSERT( buf2.data() != literal ); - CPPUNIT_ASSERT_EQUAL( literal, buf.data() ); + CPPUNIT_ASSERT_EQUAL( std::string(literal), buf.data() ); // Check that extending the buffer keeps it NUL-terminated. size_t len = 10; diff --git a/tests/test.bkl b/tests/test.bkl index 5880d2d461..e6b7194890 100644 --- a/tests/test.bkl +++ b/tests/test.bkl @@ -10,8 +10,7 @@