summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore4
-rw-r--r--tests/CMakeLists.txt202
-rw-r--r--tests/CMingw-cross-env.cmake144
-rw-r--r--tests/FindGLEW.cmake10
-rw-r--r--tests/OffscreenContextWGL.cc4
-rw-r--r--tests/csgtestcore.cc21
-rw-r--r--tests/dumptest.cc3
-rw-r--r--tests/echotest.cc2
-rw-r--r--tests/regression/cgalpngtest/cylinder-tests-expected.pngbin12498 -> 11017 bytes
-rw-r--r--tests/regression/cgalpngtest/intersection-tests-expected.pngbin8295 -> 7455 bytes
-rw-r--r--tests/regression/cgalpngtest/use-tests-expected.pngbin0 -> 10852 bytes
-rw-r--r--tests/regression/dumptest/cylinder-tests-expected.txt3
-rw-r--r--tests/regression/dumptest/intersection-tests-expected.txt2
-rw-r--r--tests/regression/dumptest/testcolornames-expected.txt4
-rw-r--r--tests/regression/dumptest/use-tests-expected.txt34
-rw-r--r--tests/regression/opencsgtest/color-tests-expected.pngbin10950 -> 10389 bytes
-rw-r--r--tests/regression/opencsgtest/cylinder-tests-expected.pngbin13165 -> 11612 bytes
-rw-r--r--tests/regression/opencsgtest/example010-expected.pngbin33501 -> 29480 bytes
-rw-r--r--tests/regression/opencsgtest/example015-expected.pngbin8632 -> 8542 bytes
-rw-r--r--tests/regression/opencsgtest/example021-expected.pngbin20930 -> 20220 bytes
-rw-r--r--tests/regression/opencsgtest/intersection-tests-expected.pngbin8069 -> 7273 bytes
-rw-r--r--tests/regression/opencsgtest/use-tests-expected.pngbin0 -> 11165 bytes
-rw-r--r--tests/regression/throwntogethertest/color-tests-expected.pngbin10215 -> 9795 bytes
-rw-r--r--tests/regression/throwntogethertest/cylinder-tests-expected.pngbin8670 -> 11612 bytes
-rw-r--r--tests/regression/throwntogethertest/example008-expected.pngbin8557 -> 8362 bytes
-rw-r--r--tests/regression/throwntogethertest/example010-expected.pngbin35604 -> 30990 bytes
-rw-r--r--tests/regression/throwntogethertest/example014-expected.pngbin9140 -> 8797 bytes
-rw-r--r--tests/regression/throwntogethertest/example015-expected.pngbin8826 -> 8677 bytes
-rw-r--r--tests/regression/throwntogethertest/example021-expected.pngbin27112 -> 26151 bytes
-rw-r--r--tests/regression/throwntogethertest/intersection-tests-expected.pngbin8006 -> 11327 bytes
-rw-r--r--tests/regression/throwntogethertest/use-tests-expected.pngbin0 -> 11618 bytes
-rwxr-xr-xtests/test_cmdline_tool.py26
32 files changed, 359 insertions, 100 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index ba02d4c..4dc4e40 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -19,4 +19,6 @@ out.png
/echotest
/opencsgtest
/throwntogethertest
-/yee_compare
+/cgalstlsanitytest
+/sysinfo.txt
+/CTestCustom.cmake \ No newline at end of file
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 1e96627..6a3b432 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -13,6 +13,9 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
# Build debug build as default
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
+endif()
+
+if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
endif()
@@ -24,11 +27,11 @@ endif()
# Windows
#
-if(WIN32)
+if(WIN32 AND MSVC)
set(WIN32_STATIC_BUILD "True")
endif()
-if(WIN32_STATIC_BUILD)
+if(WIN32_STATIC_BUILD AND MSVC)
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(EMSG "\nTo build Win32 STATIC OpenSCAD please see doc/testing.txt")
message(FATAL_ERROR ${EMSG})
@@ -36,7 +39,7 @@ if(WIN32_STATIC_BUILD)
endif()
# Disable warnings
-if(WIN32)
+if(WIN32 AND MSVC)
# too long decorated names
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4503")
# int cast to bool in CGAL
@@ -52,7 +55,7 @@ if(WIN32)
endif()
# Debugging - if you uncomment, use nmake -f Makefile > log.txt (the log is big)
-if(WIN32)
+if(WIN32 AND MSVC)
# Linker debugging
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -VERBOSE")
@@ -60,47 +63,76 @@ if(WIN32)
# you have to pass -DCMAKE_VERBOSE_MAKEFILE=ON to cmake when you run it.
endif()
+if(WIN32 AND CMAKE_COMPILER_IS_GNUCXX)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -frounding-math")
+endif()
+
#
# Build test apps
#
+function(inclusion user_set_path found_paths)
+ # If user_set_path indicates an env. variable was specifically
+ # set by the user, then found_paths become an include priority (prepend);
+ # otherwise found_paths are stuck on the end of the include flags (append).
+
+ # message(STATUS "inclusion ${user_set_path} ${found_paths}")
+ # message(STATUS "inclusion ${${user_set_path}} ${${found_paths}}")
+ set( inclusion_match 0 )
+ foreach( found_path ${${found_paths}} )
+ if (${found_path} MATCHES ${${user_set_path}}.*)
+ set( inclusion_match 1 )
+ endif()
+ endforeach()
+ if (user_set_path AND inclusion_match)
+ include_directories(BEFORE ${${found_paths}})
+ # message(STATUS "inclusion prepend ${${found_paths}} for ${user_set_path}")
+ else()
+ include_directories(AFTER ${${found_paths}})
+ # message(STATUS "inclusion append ${${found_paths}} for ${user_set_path}")
+ endif()
+ set( inclusion_match 0 )
+endfunction()
+
# Boost
+#
+# FindBoost.cmake has been included from Cmake's GIT circa the end of 2011
+# because most existing installs of cmake had a buggy older version.
+#
+# Update this if FindBoost.cmake gets out of sync with the current boost release
+# set(Boost_ADDITIONAL_VERSIONS "1.47.0" "1.46.0")
+
+if (WIN32)
+ set(Boost_USE_STATIC_LIBS TRUE)
+ set(BOOST_STATIC TRUE)
+ set(BOOST_THREAD_USE_LIB TRUE)
+endif()
+
if (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "")
set(BOOST_ROOT "$ENV{OPENSCAD_LIBRARIES}")
+ if (EXISTS ${BOOST_ROOT}/include/boost)
+ # if boost is under OPENSCAD_LIBRARIES, then
+ # don't look in the system paths (workaround FindBoost.cmake bug)
+ set(Boost_NO_SYSTEM_PATHS "TRUE")
+ message(STATUS "BOOST_ROOT: " ${BOOST_ROOT})
+ endif()
endif()
if (NOT $ENV{BOOSTDIR} STREQUAL "")
- set(BOOST_DIR "$ENV{BOOSTDIR}")
-endif()
-
-if (NOT ${BOOST_DIR} STREQUAL "")
- set(BOOST_ROOT ${BOOST_DIR})
- message(STATUS "BOOST_ROOT: " ${BOOST_ROOT})
+ set(BOOST_ROOT "$ENV{BOOSTDIR}")
set(Boost_NO_SYSTEM_PATHS "TRUE")
set(Boost_DEBUG TRUE)
+ message(STATUS "BOOST_ROOT: " ${BOOST_ROOT})
endif()
+find_package( Boost 1.35.0 COMPONENTS thread program_options filesystem system regex REQUIRED)
+message(STATUS "Boost includes found: " ${Boost_INCLUDE_DIRS})
+message(STATUS "Boost libraries found:")
+foreach(boostlib ${Boost_LIBRARIES})
+ message(STATUS " " ${boostlib})
+endforeach()
-if (WIN32)
- set(Boost_USE_STATIC_LIBS TRUE)
- set(BOOST_STATIC TRUE)
- set(BOOST_THREAD_USE_LIB TRUE)
-endif()
-
-# Update this if FindBoost.cmake gets out of sync with the current boost release
-# set(Boost_ADDITIONAL_VERSIONS "1.47.0" "1.46.0")
-find_package( Boost 1.35.0 COMPONENTS thread program_options filesystem system regex )
-if(Boost_FOUND)
- message(STATUS "Boost includes found: " ${Boost_INCLUDE_DIRS})
- message(STATUS "Boost libraries found:")
- foreach(boostlib ${Boost_LIBRARIES})
- message(STATUS " " ${boostlib})
- endforeach()
- include_directories(${Boost_INCLUDE_DIRS})
-else()
- message(STATUS "BOOST_ROOT: ${BOOST_ROOT}")
- message(FATAL_ERROR "Boost not found.")
-endif()
+inclusion(BOOST_ROOT Boost_INCLUDE_DIRS)
# Mac OS X
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
@@ -109,19 +141,21 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Qt4
-if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
- # make /usr/local/include/qt4 come before /usr/local/include (QT4 vs QT3)
- set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON)
-endif()
-
+set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON)
find_package(OpenGL REQUIRED)
-find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL REQUIRED)
-include(${QT_USE_FILE})
-if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
- set(CMAKE_INCLUDE_DIRECTORIES_BEFORE OFF)
+if (MINGW_CROSS_ENV_DIR)
+ mingw_cross_env_find_qt()
+ mingw_cross_env_info()
+ include_directories( ${QT_INCLUDE_DIRS} )
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QT_CFLAGS_OTHER}")
+else()
+ find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL REQUIRED)
+ include(${QT_USE_FILE})
endif()
+set(CMAKE_INCLUDE_DIRECTORIES_BEFORE OFF)
+
# Eigen2
# Turn off Eigen SIMD optimization
@@ -131,24 +165,34 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif()
endif()
+if (NOT $ENV{EIGEN2DIR} STREQUAL "")
+ set(EIGEN2_DIR "$ENV{EIGEN2DIR}")
+elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "")
+ set(EIGEN2_DIR "$ENV{OPENSCAD_LIBRARIES}")
+endif()
+
if (NOT EIGEN2_INCLUDE_DIR)
+ if (EIGEN2_DIR)
+ set(EIGEN2_FIND_HINTS "${EIGEN2_DIR}/include/eigen2")
+ endif()
+ if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+ set(EIGEN2_FIND_PATHS /usr/local/include/eigen2)
+ elseif (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
+ set(EIGEN2_FIND_PATHS /usr/pkg/include/eigen2)
+ else()
+ set(EIGEN2_FIND_PATHS /opt/local/include/eigen2 /usr/include/eigen2)
+ endif()
find_path(EIGEN2_INCLUDE_DIR
Eigen/Core
- HINTS $ENV{EIGEN2DIR}
- PATHS /opt/local/include/eigen2 /usr/include/eigen2)
- if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
- find_path(EIGEN2_INCLUDE_DIR
- Eigen/Core
- HINTS $ENV{EIGEN2DIR}
- PATHS /usr/local/include/eigen2 )
- endif()
+ HINTS ${EIGEN2_FIND_HINTS}
+ PATHS ${EIGEN2_FIND_PATHS})
if (NOT EIGEN2_INCLUDE_DIR)
message(FATAL_ERROR "Eigen2 not found")
else()
message(STATUS "Eigen2 found in " ${EIGEN2_INCLUDE_DIR})
endif()
endif()
-include_directories(${EIGEN2_INCLUDE_DIR})
+inclusion(EIGEN2_DIR EIGEN2_INCLUDE_DIR)
# OpenCSG
if (NOT $ENV{OPENCSGDIR} STREQUAL "")
@@ -171,10 +215,14 @@ if (NOT OPENCSG_INCLUDE_DIR)
message(STATUS "OpenCSG library found in " ${OPENCSG_LIBRARY})
endif()
endif()
-include_directories(${OPENCSG_INCLUDE_DIR})
+inclusion(OPENCSG_DIR OPENCSG_INCLUDE_DIR)
# GLEW
+if(WIN32_STATIC_BUILD)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLEW_STATIC")
+endif()
+
if (NOT $ENV{GLEWDIR} STREQUAL "")
set(GLEW_DIR "$ENV{GLEWDIR}")
elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "")
@@ -182,11 +230,8 @@ elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "")
endif()
find_package(GLEW REQUIRED)
-include_directories(${GLEW_INCLUDE_PATH})
-if(WIN32_STATIC_BUILD)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLEW_STATIC")
-endif()
+inclusion( GLEW_DIR GLEW_INCLUDE_PATH )
# Flex/Bison
find_package(BISON REQUIRED)
@@ -196,6 +241,11 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
set(FLEX_EXECUTABLE /usr/local/bin/flex)
endif()
+if(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
+ include_directories( /usr/pkg/include /usr/X11R7/include )
+ set(FLEX_EXECUTABLE /usr/pkg/bin/flex)
+endif()
+
find_package(FLEX REQUIRED)
# The COMPILE_FLAGS and forced C++ compiler is just to be compatible with qmake
if (WIN32)
@@ -211,8 +261,13 @@ set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/parser_yacc.c PROPERTIES
if (NOT $ENV{CGALDIR} STREQUAL "")
set(CGAL_DIR "$ENV{CGALDIR}")
elseif (NOT $ENV{OPENSCAD_LIBRARIES} STREQUAL "")
- set(CGAL_DIR "$ENV{OPENSCAD_LIBRARIES}/lib/CGAL")
- set(CMAKE_MODULE_PATH "${CGAL_DIR}")
+ if (EXISTS "$ENV{OPENSCAD_LIBRARIES}/lib/CGAL")
+ set(CGAL_DIR "$ENV{OPENSCAD_LIBRARIES}/lib/CGAL")
+ set(CMAKE_MODULE_PATH "${CGAL_DIR}")
+ elseif (EXISTS "$ENV{OPENSCAD_LIBRARIES}/include/CGAL")
+ set(CGAL_DIR "$ENV{OPENSCAD_LIBRARIES}")
+ set(CMAKE_MODULE_PATH "${CGAL_DIR}")
+ endif()
endif()
message(STATUS "CGAL_DIR: " ${CGAL_DIR})
find_package(CGAL REQUIRED)
@@ -224,15 +279,17 @@ message(STATUS "CGAL libraries found in " ${CGAL_LIBRARIES_DIR} )
if("${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}" VERSION_LESS 3.6)
message(FATAL_ERROR "CGAL >= 3.6 required")
endif()
-include_directories(${CGAL_INCLUDE_DIRS})
+inclusion(CGAL_DIR CGAL_INCLUDE_DIRS)
# Imagemagick
-find_package(ImageMagick COMPONENTS convert)
-if (ImageMagick_convert_FOUND)
- message(STATUS "ImageMagick convert executable found: " ${ImageMagick_convert_EXECUTABLE})
-else()
- message(FATAL_ERROR "Couldn't find imagemagick 'convert' program")
+if (NOT SKIP_IMAGEMAGICK)
+ find_package(ImageMagick COMPONENTS convert)
+ if (ImageMagick_convert_FOUND)
+ message(STATUS "ImageMagick convert executable found: " ${ImageMagick_convert_EXECUTABLE})
+ else()
+ message(FATAL_ERROR "Couldn't find imagemagick 'convert' program")
+ endif()
endif()
# Internal includes
@@ -254,6 +311,7 @@ set(CORE_SOURCES
../src/node.cc
../src/context.cc
../src/csgterm.cc
+ ../src/csgtermnormalizer.cc
../src/polyset.cc
../src/csgops.cc
../src/transform.cc
@@ -320,6 +378,7 @@ set(OFFSCREEN_SOURCES
system-gl.cc)
add_library(tests-core STATIC ${CORE_SOURCES})
+target_link_libraries(tests-core ${OPENGL_LIBRARY})
add_library(tests-common STATIC ${COMMON_SOURCES})
target_link_libraries(tests-common tests-core)
add_library(tests-cgal STATIC ${CGAL_SOURCES})
@@ -454,8 +513,8 @@ endfunction()
# comparison method to use
if (NOT $ENV{COMPARATOR} STREQUAL "")
set(COMPARATOR "$ENV{COMPARATOR}")
+ message(STATUS "ImageMagick method modified with COMPARATOR: " ${COMPARATOR})
endif()
-message(STATUS "COMPARATOR: " ${COMPARATOR})
#
# This functions adds cmd-line tests given files.
@@ -487,7 +546,10 @@ macro(add_cmdline_test TESTCMD TESTSUFFIX)
set(CONFARG CONFIGURATIONS)
set(CONFVAL ${FOUNDCONFIGS})
- add_test(NAME ${TEST_FULLNAME} ${CONFARG} ${CONFVAL} COMMAND ${PYTHON_EXECUTABLE} ${tests_SOURCE_DIR}/test_cmdline_tool.py --comparator=${COMPARATOR} -c ${ImageMagick_convert_EXECUTABLE} -s ${TESTSUFFIX} ${CMAKE_BINARY_DIR}/${TESTCMD} "${SCADFILE}")
+ if (MINGW_CROSS_ENV_DIR)
+ set( MINGW_CROSS_ARG "--mingw-cross-env" )
+ endif()
+ add_test(NAME ${TEST_FULLNAME} ${CONFARG} ${CONFVAL} COMMAND ${PYTHON_EXECUTABLE} ${tests_SOURCE_DIR}/test_cmdline_tool.py ${MINGW_CROSS_ARG} --comparator=${COMPARATOR} -c ${ImageMagick_convert_EXECUTABLE} -s ${TESTSUFFIX} ${CMAKE_BINARY_DIR}/${TESTCMD} "${SCADFILE}")
endif()
endforeach()
endmacro()
@@ -497,6 +559,9 @@ enable_testing()
# set up custom pretty printing of results
set(INFOCMD "execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/opencsgtest --info OUTPUT_FILE sysinfo.txt)")
+if (MINGW_CROSS_ENV_DIR)
+ set(INFOCMD "execute_process(COMMAND wine ${CMAKE_CURRENT_BINARY_DIR}/opencsgtest --info OUTPUT_FILE sysinfo.txt)")
+endif()
set(PRETTYCMD "\"${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_pretty_print.py --builddir=${CMAKE_CURRENT_BINARY_DIR}\"")
set(CTEST_CUSTOM_FILE ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake)
set(CTEST_CUSTOM_TXT "\n
@@ -519,7 +584,9 @@ file(GLOB FEATURES_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/features/*.scad)
# Remove included files not to be used as tests
list(REMOVE_ITEM FEATURES_FILES
${CMAKE_SOURCE_DIR}/../testdata/scad/features/include\ test6.scad
- ${CMAKE_SOURCE_DIR}/../testdata/scad/features/include-test5.scad)
+ ${CMAKE_SOURCE_DIR}/../testdata/scad/features/include-test5.scad
+ ${CMAKE_SOURCE_DIR}/../testdata/scad/features/use\ test6.scad
+ ${CMAKE_SOURCE_DIR}/../testdata/scad/features/use-test5.scad)
file(GLOB BUGS_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/*.scad)
file(GLOB SCAD_DXF_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/dxf/*.scad)
file(GLOB FUNCTION_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/functions/*.scad)
@@ -549,15 +616,20 @@ list(APPEND CGALSTLSANITYTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/no
# Once we're capable of comparing these across platforms, we can put these back in
disable_tests(dumptest_transform-tests
dumptest_render-tests
+ dumptest_difference-tests
+ dumptest_intersection-tests
dumptest_example001
dumptest_example005
dumptest_example006
dumptest_example007
dumptest_example008
dumptest_example012
+ dumptest_example013
dumptest_example016
+ dumptest_example017
dumptest_example020
- dumptest_example021)
+ dumptest_example021
+ dumptest_example022)
# FIXME: This test illustrates a weakness in child() combined with modifiers.
# Reenable it when this is improved
diff --git a/tests/CMingw-cross-env.cmake b/tests/CMingw-cross-env.cmake
new file mode 100644
index 0000000..09ec1d1
--- /dev/null
+++ b/tests/CMingw-cross-env.cmake
@@ -0,0 +1,144 @@
+#
+# CMake Toolchain file for cross compiling OpenSCAD tests linux->mingw-win32
+# --------------------------------------------------------------------------
+#
+# Prerequisites: mingw-cross-env, ImageMagick 6.5.9.3 or newer, wine
+#
+# Usage:
+#
+# - follow Brad Pitcher's mingw-cross-env for OpenSCAD setup:
+# http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Cross-compiling_for_Windows_on_Linux_or_Mac_OS_X
+# - cross-compile openscad.exe, to verify your installation works properly.
+# - cd openscad/tests && mkdir build-mingw32 && cd build-mingw32
+# - cmake .. -DCMAKE_TOOLCHAIN_FILE=CMingw-cross-env.cmake \
+# -DMINGW_CROSS_ENV_DIR=<where mingw-cross-env is installed>
+# - make should proceed as normal.
+# - now run 'ctest' on your *nix machine.
+# The test .exe programs should run under Wine.
+#
+# See also:
+#
+# http://lists.gnu.org/archive/html/mingw-cross-env-list/2010-11/threads.html#00078
+# (thread "Qt with Cmake")
+# http://lists.gnu.org/archive/html/mingw-cross-env-list/2011-01/threads.html#00012
+# (thread "Qt: pkg-config files?")
+# http://mingw-cross-env.nongnu.org/#requirements
+# http://www.vtk.org/Wiki/CMake_Cross_Compiling
+# https://bitbucket.org/muellni/mingw-cross-env-cmake/src/2067fcf2d52e/src/cmake-1-toolchain-file.patch
+# http://code.google.com/p/qtlobby/source/browse/trunk/toolchain-mingw.cmake
+# http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Link-Options.html
+# Makefile.Release generated by qmake
+# cmake's FindQt4.cmake & Qt4ConfigDependentSettings.cmake files
+# mingw-cross-env's qmake.conf and *.prl files
+# mingw-cross-env's pkg-config files in usr/i686-pc-mingw32/lib/pkgconfig
+# http://www.vtk.org/Wiki/CMake:How_To_Find_Libraries
+#
+
+#
+# Notes:
+#
+# To debug the build process run "make VERBOSE=1". 'strace -f' is also useful.
+#
+# This file is actually called multiple times by cmake, so various 'if NOT set'
+# guards are used to keep programs from running twice.
+#
+# The test will not currently run under win32 because the ctest harness
+# is created by cmake on the machine that it is called on, not on the
+# machine it is targeting.
+#
+
+#
+# Part 1. Find *nix-ImageMagick
+#
+# The tests run under Wine under *nix. Therefore we need to find the
+# ImageMagick comparison program on the *nix machine. It must be
+# searched before the 'cross-compile' environment is setup.
+#
+
+if (NOT imagemagick_cross_set)
+ find_package(ImageMagick COMPONENTS convert REQUIRED)
+ message(STATUS "ImageMagick convert executable found: " ${ImageMagick_convert_EXECUTABLE})
+ set( SKIP_IMAGEMAGICK TRUE )
+ set( imagemagick_cross_set )
+endif()
+
+#
+# Part 2. cross-compiler setup
+#
+
+set(MINGW_CROSS_ENV_DIR $ENV{MINGW_CROSS_ENV_DIR})
+
+set(BUILD_SHARED_LIBS OFF)
+set(CMAKE_SYSTEM_NAME Windows)
+set(MSYS 1)
+set(CMAKE_FIND_ROOT_PATH ${MINGW_CROSS_ENV_DIR}/usr/i686-pc-mingw32)
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+
+set(CMAKE_C_COMPILER ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-gcc)
+set(CMAKE_CXX_COMPILER ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-g++)
+set(QT_QMAKE_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-qmake)
+set(PKG_CONFIG_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-pkg-config)
+set(CMAKE_BUILD_TYPE RelWithDebInfo)
+
+#
+# Part 3. library settings for mingw-cross-env
+#
+
+set( Boost_USE_STATIC_LIBS ON )
+set( Boost_USE_MULTITHREADED ON )
+set( Boost_COMPILER "_win32" )
+# set( Boost_DEBUG TRUE ) # for debugging cmake's FindBoost, not boost itself
+
+set( OPENSCAD_LIBRARIES ${CMAKE_FIND_ROOT_PATH} )
+set( EIGEN2_DIR ${CMAKE_FIND_ROOT_PATH} )
+set( CGAL_DIR ${CMAKE_FIND_ROOT_PATH}/lib/CGAL )
+set( GLEW_DIR ${CMAKE_FIND_ROOT_PATH} )
+
+#
+# Qt4
+#
+# To workaround problems with CMake's FindQt4.cmake when combined with
+# mingw-cross-env (circa early 2012), we here instead use pkg-config. To
+# workaround Cmake's insertion of -bdynamic, we stick 'static' on the
+# end of QT_LIBRARIES
+#
+
+set(QT_QMAKE_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-qmake)
+set(QT_MOC_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-moc)
+set(QT_UIC_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-uic)
+
+function(mingw_cross_env_find_qt)
+ # called from CMakeLists.txt
+ find_package( PkgConfig )
+ pkg_check_modules( QTCORE QtCore )
+ pkg_check_modules( QTGUI QtGui )
+ pkg_check_modules( QTOPENGL QtOpenGL )
+
+ set(QT_INCLUDE_DIRS ${QTCORE_INCLUDE_DIRS} ${QTGUI_INCLUDE_DIRS} ${QTOPENGL_INCLUDE_DIRS})
+ set(QT_CFLAGS_OTHER "${QTCORE_CFLAGS_OTHER} ${QTGUI_CFLAGS_OTHER} ${QTOPENGL_CFLAGS_OTHER}")
+ set(QT_LIBRARIES "${QTCORE_STATIC_LDFLAGS} ${QTGUI_STATIC_LDFLAGS} ${QTOPENGL_STATIC_LDFLAGS};-static")
+
+ set(QT_INCLUDE_DIRS ${QT_INCLUDE_DIRS} PARENT_SCOPE)
+ set(QT_CFLAGS_OTHER ${QT_CFLAGS_OTHER} PARENT_SCOPE)
+ set(QT_LIBRARIES ${QT_LIBRARIES} PARENT_SCOPE)
+endfunction()
+
+function(mingw_cross_env_info)
+ message(STATUS "QT INCLUDE_DIRS: ${QT_INCLUDE_DIRS}")
+ message(STATUS "QT LIBRARIES: ${QT_LIBRARIES}")
+ message(STATUS "QT_CFLAGS_OTHER: ${QT_CFLAGS_OTHER}")
+endfunction()
+
+#
+# Part 4. -D definitions
+#
+
+if( NOT cross_defs_set )
+ add_definitions( -DGLEW_STATIC ) # FindGLEW.cmake needs this
+ add_definitions( -DBOOST_STATIC )
+ add_definitions( -DBOOST_THREAD_USE_LIB )
+ add_definitions( -DUNICODE ) # because qmake does it
+ set(cross_defs_set 1)
+endif()
diff --git a/tests/FindGLEW.cmake b/tests/FindGLEW.cmake
index fa3071f..1b0cac4 100644
--- a/tests/FindGLEW.cmake
+++ b/tests/FindGLEW.cmake
@@ -11,13 +11,17 @@
# http://openlibraries.org/browser/trunk/FindGLEW.cmake?rev=1383
-IF (WIN32)
+IF (WIN32 AND MSVC)
IF (WIN32_STATIC_BUILD) # passed from caller
SET(GLEW_LIB_SEARCH_NAME glew32s.lib) # static, non-debug (Release)
ELSE ()
SET(GLEW_LIB_SEARCH_NAME glew32.lib) # other. untested with OpenSCAD
ENDIF()
+ELSE () # GCC
+ SET(GLEW_LIB_SEARCH_NAME "libglew32s.a")
+ENDIF ()
+IF (WIN32)
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
$ENV{PROGRAMFILES}/GLEW/include
${PROJECT_SOURCE_DIR}/src/nvgl/glew/include
@@ -33,13 +37,13 @@ ELSE (WIN32)
message(STATUS "GLEW_DIR: " ${GLEW_DIR})
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
HINTS ${GLEW_DIR}/include
- PATHS /usr/include /usr/local/include
+ PATHS /usr/include /usr/local/include /usr/pkg/include
NO_DEFAULT_PATH
DOC "The directory where GL/glew.h resides")
FIND_LIBRARY( GLEW_LIBRARY
NAMES GLEW glew
HINTS ${GLEW_DIR}/lib
- PATHS /usr/lib /usr/local/lib
+ PATHS /usr/lib /usr/local/lib /usr/pkg/lib
NO_DEFAULT_PATH
DOC "The GLEW library")
ENDIF (WIN32)
diff --git a/tests/OffscreenContextWGL.cc b/tests/OffscreenContextWGL.cc
index f36671c..75a7ed2 100644
--- a/tests/OffscreenContextWGL.cc
+++ b/tests/OffscreenContextWGL.cc
@@ -105,10 +105,10 @@ bool create_wgl_dummy_context(OffscreenContext &ctx)
wc.style = CS_OWNDC;
wc.lpfnWndProc = WndProc;
wc.hInstance = inst;
- wc.lpszClassName = "OpenSCAD";
+ wc.lpszClassName = (LPCWSTR)"OpenSCAD";
RegisterClass( &wc );
- HWND window = CreateWindow( "OpenSCAD", "OpenSCAD",
+ HWND window = CreateWindow( (LPCWSTR)"OpenSCAD", (LPCWSTR)"OpenSCAD",
WS_CAPTION | WS_POPUPWINDOW, //| WS_VISIBLE,
0, 0, ctx.width, ctx.height, NULL, NULL, inst, NULL );
diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc
index 2406349..fcf88d8 100644
--- a/tests/csgtestcore.cc
+++ b/tests/csgtestcore.cc
@@ -20,6 +20,7 @@
#include "ThrownTogetherRenderer.h"
#include "csgterm.h"
+#include "csgtermnormalizer.h"
#include "OffscreenView.h"
#include <QApplication>
@@ -297,12 +298,8 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type)
}
// CSG normalization
- csgInfo.root_norm_term = root_raw_term;
- while (1) {
- shared_ptr<CSGTerm> n = CSGTerm::normalize(csgInfo.root_norm_term);
- if (csgInfo.root_norm_term == n) break;
- csgInfo.root_norm_term = n;
- }
+ CSGTermNormalizer normalizer;
+ csgInfo.root_norm_term = normalizer.normalize(root_raw_term);
assert(csgInfo.root_norm_term);
@@ -315,11 +312,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type)
csgInfo.highlights_chain = new CSGChain();
for (unsigned int i = 0; i < csgInfo.highlight_terms.size(); i++) {
- while (1) {
- shared_ptr<CSGTerm> n = CSGTerm::normalize(csgInfo.highlight_terms[i]);
- if (csgInfo.highlight_terms[i] == n) break;
- csgInfo.highlight_terms[i] = n;
- }
+ csgInfo.highlight_terms[i] = normalizer.normalize(csgInfo.highlight_terms[i]);
csgInfo.highlights_chain->import(csgInfo.highlight_terms[i]);
}
}
@@ -329,11 +322,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type)
csgInfo.background_chain = new CSGChain();
for (unsigned int i = 0; i < csgInfo.background_terms.size(); i++) {
- while (1) {
- shared_ptr<CSGTerm> n = CSGTerm::normalize(csgInfo.background_terms[i]);
- if (csgInfo.background_terms[i] == n) break;
- csgInfo.background_terms[i] = n;
- }
+ csgInfo.background_terms[i] = normalizer.normalize(csgInfo.background_terms[i]);
csgInfo.background_chain->import(csgInfo.background_terms[i]);
}
}
diff --git a/tests/dumptest.cc b/tests/dumptest.cc
index cca4d82..6dd65a4 100644
--- a/tests/dumptest.cc
+++ b/tests/dumptest.cc
@@ -65,10 +65,9 @@ string dumptree(const Tree &tree, const AbstractNode &node)
int main(int argc, char **argv)
{
-#ifdef WIN32
+#ifdef _MSC_VER
_set_output_format(_TWO_DIGIT_EXPONENT);
#endif
-
if (argc != 3) {
fprintf(stderr, "Usage: %s <file.scad> <output.txt>\n", argv[0]);
exit(1);
diff --git a/tests/echotest.cc b/tests/echotest.cc
index 96b8d1c..7abfd78 100644
--- a/tests/echotest.cc
+++ b/tests/echotest.cc
@@ -59,7 +59,7 @@ static void outfile_handler(const std::string &msg, void *userdata) {
int main(int argc, char **argv)
{
-#ifdef WIN32
+#ifdef _MSC_VER
_set_output_format(_TWO_DIGIT_EXPONENT);
#endif
diff --git a/tests/regression/cgalpngtest/cylinder-tests-expected.png b/tests/regression/cgalpngtest/cylinder-tests-expected.png
index 9d96df2..843d70f 100644
--- a/tests/regression/cgalpngtest/cylinder-tests-expected.png
+++ b/tests/regression/cgalpngtest/cylinder-tests-expected.png
Binary files differ
diff --git a/tests/regression/cgalpngtest/intersection-tests-expected.png b/tests/regression/cgalpngtest/intersection-tests-expected.png
index 6d004b0..d287e5f 100644
--- a/tests/regression/cgalpngtest/intersection-tests-expected.png
+++ b/tests/regression/cgalpngtest/intersection-tests-expected.png
Binary files differ
diff --git a/tests/regression/cgalpngtest/use-tests-expected.png b/tests/regression/cgalpngtest/use-tests-expected.png
new file mode 100644
index 0000000..21747cc
--- /dev/null
+++ b/tests/regression/cgalpngtest/use-tests-expected.png
Binary files differ
diff --git a/tests/regression/dumptest/cylinder-tests-expected.txt b/tests/regression/dumptest/cylinder-tests-expected.txt
index 2ac2549..b1e8b6e 100644
--- a/tests/regression/dumptest/cylinder-tests-expected.txt
+++ b/tests/regression/dumptest/cylinder-tests-expected.txt
@@ -29,4 +29,7 @@
multmatrix([[1, 0, 0, 22], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) {
cylinder($fn = 0, $fa = 12, $fs = 2, h = 15, r1 = 5, r2 = 5, center = false);
}
+ multmatrix([[1, 0, 0, -10], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ cylinder($fn = 6, $fa = 12, $fs = 2, h = 2, r1 = 3, r2 = 3, center = false);
+ }
diff --git a/tests/regression/dumptest/intersection-tests-expected.txt b/tests/regression/dumptest/intersection-tests-expected.txt
index e6bbf32..a9dba29 100644
--- a/tests/regression/dumptest/intersection-tests-expected.txt
+++ b/tests/regression/dumptest/intersection-tests-expected.txt
@@ -24,7 +24,7 @@
multmatrix([[1, 0, 0, 12], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) {
intersection() {
cube(size = [10, 10, 10], center = true);
- multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 7], [0, 0, 0, 1]]) {
+ multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 7.01], [0, 0, 0, 1]]) {
cylinder($fn = 0, $fa = 12, $fs = 2, h = 4, r1 = 4, r2 = 4, center = true);
}
}
diff --git a/tests/regression/dumptest/testcolornames-expected.txt b/tests/regression/dumptest/testcolornames-expected.txt
index 56e664f..63b5e70 100644
--- a/tests/regression/dumptest/testcolornames-expected.txt
+++ b/tests/regression/dumptest/testcolornames-expected.txt
@@ -49,7 +49,7 @@
}
}
multmatrix([[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) {
- color([1, 0.713725, 0.756863, 1]) {
+ color([1, 0.713726, 0.756863, 1]) {
sphere($fn = 5, $fa = 12, $fs = 2, r = 0.8);
}
}
@@ -79,7 +79,7 @@
}
}
multmatrix([[1, 0, 0, 8], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) {
- color([1, 0.498039, 0.313725, 1]) {
+ color([1, 0.498039, 0.313726, 1]) {
sphere($fn = 5, $fa = 12, $fs = 2, r = 0.8);
}
}
diff --git a/tests/regression/dumptest/use-tests-expected.txt b/tests/regression/dumptest/use-tests-expected.txt
new file mode 100644
index 0000000..7ba3ac5
--- /dev/null
+++ b/tests/regression/dumptest/use-tests-expected.txt
@@ -0,0 +1,34 @@
+ group() {
+ group() {
+ multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ group() {
+ cylinder($fn = 0, $fa = 12, $fs = 2, h = 1, r1 = 0.7, r2 = 0.2, center = true);
+ }
+ }
+ multmatrix([[1, 0, 0, 2], [0, 1, 0, -2], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ group() {
+ cylinder($fn = 10, $fa = 12, $fs = 2, h = 1, r1 = 0.5, r2 = 0.5, center = true);
+ }
+ }
+ cube(size = [1, 1, 1], center = true);
+ }
+ multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]);
+ multmatrix([[1, 0, 0, 4], [0, 1, 0, -2], [0, 0, 1, 0], [0, 0, 0, 1]]);
+ multmatrix([[1, 0, 0, -2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ group() {
+ sphere($fn = 8, $fa = 12, $fs = 2, r = 0.5);
+ }
+ }
+ multmatrix([[1, 0, 0, -2], [0, 1, 0, -2], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ group() {
+ difference() {
+ cube(size = [1, 1, 1], center = true);
+ cylinder($fn = 0, $fa = 12, $fs = 2, h = 2, r1 = 0.4, r2 = 0.4, center = true);
+ }
+ }
+ }
+ multmatrix([[1, 0, 0, 0], [0, 1, 0, -2], [0, 0, 1, 0], [0, 0, 0, 1]]) {
+ sphere($fn = 16, $fa = 12, $fs = 2, r = 1);
+ }
+ }
+
diff --git a/tests/regression/opencsgtest/color-tests-expected.png b/tests/regression/opencsgtest/color-tests-expected.png
index 82ba36a..5b35312 100644
--- a/tests/regression/opencsgtest/color-tests-expected.png
+++ b/tests/regression/opencsgtest/color-tests-expected.png
Binary files differ
diff --git a/tests/regression/opencsgtest/cylinder-tests-expected.png b/tests/regression/opencsgtest/cylinder-tests-expected.png
index 17c10b8..4c7ab79 100644
--- a/tests/regression/opencsgtest/cylinder-tests-expected.png
+++ b/tests/regression/opencsgtest/cylinder-tests-expected.png
Binary files differ
diff --git a/tests/regression/opencsgtest/example010-expected.png b/tests/regression/opencsgtest/example010-expected.png
index 3a4ba27..0616f87 100644
--- a/tests/regression/opencsgtest/example010-expected.png
+++ b/tests/regression/opencsgtest/example010-expected.png
Binary files differ
diff --git a/tests/regression/opencsgtest/example015-expected.png b/tests/regression/opencsgtest/example015-expected.png
index 1a1c869..78ec3d7 100644
--- a/tests/regression/opencsgtest/example015-expected.png
+++ b/tests/regression/opencsgtest/example015-expected.png
Binary files differ
diff --git a/tests/regression/opencsgtest/example021-expected.png b/tests/regression/opencsgtest/example021-expected.png
index 675e57b..bf3a281 100644
--- a/tests/regression/opencsgtest/example021-expected.png
+++ b/tests/regression/opencsgtest/example021-expected.png
Binary files differ
diff --git a/tests/regression/opencsgtest/intersection-tests-expected.png b/tests/regression/opencsgtest/intersection-tests-expected.png
index fc23560..772e2dc 100644
--- a/tests/regression/opencsgtest/intersection-tests-expected.png
+++ b/tests/regression/opencsgtest/intersection-tests-expected.png
Binary files differ
diff --git a/tests/regression/opencsgtest/use-tests-expected.png b/tests/regression/opencsgtest/use-tests-expected.png
new file mode 100644
index 0000000..8a85ad5
--- /dev/null
+++ b/tests/regression/opencsgtest/use-tests-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/color-tests-expected.png b/tests/regression/throwntogethertest/color-tests-expected.png
index 5d4ed89..8fb69b1 100644
--- a/tests/regression/throwntogethertest/color-tests-expected.png
+++ b/tests/regression/throwntogethertest/color-tests-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/cylinder-tests-expected.png b/tests/regression/throwntogethertest/cylinder-tests-expected.png
index 0a3ed33..4c7ab79 100644
--- a/tests/regression/throwntogethertest/cylinder-tests-expected.png
+++ b/tests/regression/throwntogethertest/cylinder-tests-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/example008-expected.png b/tests/regression/throwntogethertest/example008-expected.png
index 880844b..f825047 100644
--- a/tests/regression/throwntogethertest/example008-expected.png
+++ b/tests/regression/throwntogethertest/example008-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/example010-expected.png b/tests/regression/throwntogethertest/example010-expected.png
index 854eea8..87271eb 100644
--- a/tests/regression/throwntogethertest/example010-expected.png
+++ b/tests/regression/throwntogethertest/example010-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/example014-expected.png b/tests/regression/throwntogethertest/example014-expected.png
index 562ce74..4721663 100644
--- a/tests/regression/throwntogethertest/example014-expected.png
+++ b/tests/regression/throwntogethertest/example014-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/example015-expected.png b/tests/regression/throwntogethertest/example015-expected.png
index 6e16e33..85374b5 100644
--- a/tests/regression/throwntogethertest/example015-expected.png
+++ b/tests/regression/throwntogethertest/example015-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/example021-expected.png b/tests/regression/throwntogethertest/example021-expected.png
index 1e1576c..cfe303a 100644
--- a/tests/regression/throwntogethertest/example021-expected.png
+++ b/tests/regression/throwntogethertest/example021-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/intersection-tests-expected.png b/tests/regression/throwntogethertest/intersection-tests-expected.png
index f6cf6af..f6cc56f 100644
--- a/tests/regression/throwntogethertest/intersection-tests-expected.png
+++ b/tests/regression/throwntogethertest/intersection-tests-expected.png
Binary files differ
diff --git a/tests/regression/throwntogethertest/use-tests-expected.png b/tests/regression/throwntogethertest/use-tests-expected.png
new file mode 100644
index 0000000..e5bf382
--- /dev/null
+++ b/tests/regression/throwntogethertest/use-tests-expected.png
Binary files differ
diff --git a/tests/test_cmdline_tool.py b/tests/test_cmdline_tool.py
index 967e334..f29acc0 100755
--- a/tests/test_cmdline_tool.py
+++ b/tests/test_cmdline_tool.py
@@ -61,7 +61,11 @@ def execute_and_redirect(cmd, params, outfile):
else: return retval
def get_normalized_text(filename):
- text = open(filename).read()
+ try:
+ f = open(filename)
+ text = f.read()
+ except:
+ text = ''
return text.strip("\r\n").replace("\r\n", "\n") + "\n"
def compare_text(expected, actual):
@@ -71,8 +75,9 @@ def compare_default(resultfilename):
print >> sys.stderr, 'diff text compare: '
print >> sys.stderr, ' expected textfile: ', expectedfilename
print >> sys.stderr, ' actual textfile: ', resultfilename
- if not compare_text(expectedfilename, resultfilename):
- execute_and_redirect("diff", [expectedfilename, resultfilename], sys.stderr)
+ if not compare_text(expectedfilename, resultfilename):
+ if resultfilename:
+ execute_and_redirect("diff", [expectedfilename, resultfilename], sys.stderr)
return False
return True
@@ -110,7 +115,7 @@ def compare_png(resultfilename):
elif compare_method=='NCC':
thresh = 0.95
ncc_err = float(output.strip())
- if ncc_err > thresh: return True
+ if ncc_err > thresh or ncc_err==0.0: return True
else: print >> sys.stderr, ncc_err, ' Images differ: NCC comparison < ', thresh
return False
@@ -136,8 +141,13 @@ def run_test(testname, cmd, args):
outputname = os.path.normpath( outputname )
outfile = open(outputname, "wb")
+
try:
- proc = subprocess.Popen([cmd] + args + [outputname], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ if os.path.isfile(cmd+'.exe') and options.mingw_cross_env:
+ cmdline = ['wine']+[cmd+'.exe'] + args + [outputname]
+ else:
+ cmdline = [cmd] + args + [outputname]
+ proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
errtext = proc.communicate()[1]
if errtext != None and len(errtext) > 0:
print >> sys.stderr, "Error output: " + errtext
@@ -166,11 +176,11 @@ def usage():
print >> sys.stderr, " -s, --suffix=<suffix> Write -expected and -actual files with the given suffix instead of .txt"
print >> sys.stderr, " -t, --test=<name> Specify test name instead of deducting it from the argument"
print >> sys.stderr, " -c, --convexec=<name> Path to ImageMagick 'convert' executable"
-
+ print >> sys.stderr, " -x, --mingw-cross-env Mingw-cross-env cross compilation"
if __name__ == '__main__':
# Handle command-line arguments
try:
- opts, args = getopt.getopt(sys.argv[1:], "gs:c:t:m:", ["generate", "convexec=", "suffix=", "test=", "comparator="])
+ opts, args = getopt.getopt(sys.argv[1:], "gs:c:t:m:x", ["generate", "convexec=", "suffix=", "test=", "comparator=", "mingw-cross-env"])
except getopt.GetoptError, err:
usage()
sys.exit(2)
@@ -192,6 +202,8 @@ if __name__ == '__main__':
options.convert_exec = os.path.normpath( a )
elif o in ("-m", "--comparator"):
options.comparator = a
+ elif o in ("-x", "--mingw-cross-env"):
+ options.mingw_cross_env = True
# <cmdline-tool> and <argument>
if len(args) < 2:
contact: Jan Huwald // Impressum