summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2011-12-07 04:20:17 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2011-12-07 04:20:17 (GMT)
commitd26effccf4c9fabfe19355d6da4903291d8dd599 (patch)
treed6f2fc42feae2fa494546886d9fd4889651769e9 /tests
parent61bfb8f058e8935432fed6098a1d70dba194f6bf (diff)
allow alternate image comparison using option to cmake
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt8
-rwxr-xr-xtests/test_cmdline_tool.py20
-rwxr-xr-xtests/test_pretty_print.py6
3 files changed, 23 insertions, 11 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 314b51f..04be773 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -422,6 +422,12 @@ function(get_test_fullname TESTCMD FILENAME FULLNAME)
set(${FULLNAME} ${${FULLNAME}} PARENT_SCOPE)
endfunction()
+# comparison method to use
+if (NOT $ENV{COMPARATOR} STREQUAL "")
+ set(COMPARATOR "$ENV{COMPARATOR}")
+endif()
+message(STATUS "COMPARATOR: " ${COMPARATOR})
+
#
# This functions adds cmd-line tests given files.
# Files are sent as the parameters following TESTSUFFIX
@@ -452,7 +458,7 @@ 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 -c ${ImageMagick_convert_EXECUTABLE} -s ${TESTSUFFIX} ${CMAKE_BINARY_DIR}/${TESTCMD} "${SCADFILE}")
+ 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}")
endif()
endforeach()
endmacro()
diff --git a/tests/test_cmdline_tool.py b/tests/test_cmdline_tool.py
index 480584c..dace3f5 100755
--- a/tests/test_cmdline_tool.py
+++ b/tests/test_cmdline_tool.py
@@ -78,16 +78,18 @@ def compare_default(resultfilename):
def compare_png(resultfilename):
compare_method = 'pixel'
#args = [expectedfilename, resultfilename, "-alpha", "Off", "-compose", "difference", "-composite", "-threshold", "10%", "-blur", "2", "-threshold", "30%", "-format", "%[fx:w*h*mean]", "info:"]
- #args = [expectedfilename, resultfilename, "-alpha", "Off", "-compose", "difference", "-composite", "-threshold", "10%", "-morphology", "Erode", "Square", "-format", "%[fx:w*h*mean]", "info:"]
+ args = [expectedfilename, resultfilename, "-alpha", "Off", "-compose", "difference", "-composite", "-threshold", "10%", "-morphology", "Erode", "Square", "-format", "%[fx:w*h*mean]", "info:"]
# for systems with older imagemagick that doesnt support '-morphology'
# http://www.imagemagick.org/Usage/morphology/#alturnative
- args = [expectedfilename, resultfilename, "-alpha", "Off", "-compose", "difference", "-composite", "-threshold", "10%", "-gaussian-blur","3x65535", "-threshold", "99.99%", "-format", "%[fx:w*h*mean]", "info:"]
+ if options.comparator == 'old':
+ args = [expectedfilename, resultfilename, "-alpha", "Off", "-compose", "difference", "-composite", "-threshold", "10%", "-gaussian-blur","3x65535", "-threshold", "99.99%", "-format", "%[fx:w*h*mean]", "info:"]
- # for systems where imagemagick crashes when using the above comparators
- # args = [expectedfilename, resultfilename, "-alpha", "Off", "-compose", "difference", "-metric", "NCC", "tmp.png"]
- # options.convert_exec = 'compare'
- # compare_method = 'NCC'
+ if options.comparator == 'ncc':
+ # for systems where imagemagick crashes when using the above comparators
+ args = [expectedfilename, resultfilename, "-alpha", "Off", "-compose", "difference", "-metric", "NCC", "tmp.png"]
+ options.convert_exec = 'compare'
+ compare_method = 'NCC'
msg = 'ImageMagick image comparison: '
msg += os.path.basename(options.convert_exec) + ' ' + ' '.join(args)
@@ -168,7 +170,7 @@ def usage():
if __name__ == '__main__':
# Handle command-line arguments
try:
- opts, args = getopt.getopt(sys.argv[1:], "gs:c:t:", ["generate", "convexec=", "suffix=", "test="])
+ opts, args = getopt.getopt(sys.argv[1:], "gs:c:t:m:", ["generate", "convexec=", "suffix=", "test=", "comparator="])
except getopt.GetoptError, err:
usage()
sys.exit(2)
@@ -186,8 +188,10 @@ if __name__ == '__main__':
else: options.suffix = a
elif o in ("-t", "--test"):
options.testname = a
- elif o in ("-c", "--convexec"):
+ elif o in ("-c", "--convexec"):
options.convert_exec = os.path.normpath( a )
+ elif o in ("-m", "--comparator"):
+ options.comparator = a
# <cmdline-tool> and <argument>
if len(args) < 2:
diff --git a/tests/test_pretty_print.py b/tests/test_pretty_print.py
index d297caf..ca6af5f 100755
--- a/tests/test_pretty_print.py
+++ b/tests/test_pretty_print.py
@@ -19,11 +19,13 @@
#
# This program 'pretty prints' the ctest output, namely
# files from builddir/Testing/Temporary.
-# html & wiki output are produced in Testing/Temporary/wiki
-# wiki uploading is available by running
+# html & wiki output are produced in Testing/Temporary/sysid_report
+#
+# experimental wiki uploading is available by running
#
# python test_pretty_print.py --upload
#
+
# Design philosophy
#
# 1. parse the data (images, logs) into easy-to-use data structures
contact: Jan Huwald // Impressum