ENH: Add cmake code to do testing if user has properly setup a testimages directory
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Fri, 7 Sep 2007 13:21:17 +0000 (13:21 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Fri, 7 Sep 2007 13:21:17 +0000 (13:21 +0000)
CMakeLists.txt
ChangeLog
codec/CMakeLists.txt

index 6b563fa5590d2c68f6cacdd206d54aa887c3086d..550af2b1e5fffd4f214785e21c46a01373b614f4 100644 (file)
@@ -91,6 +91,20 @@ IF(OPENJPEG_STANDALONE)
   ENDIF(BUILD_TESTING)
 ENDIF(OPENJPEG_STANDALONE)
 
-# TODO, technically we should add tests, e.g:
+# Adding test with dataset from:
 # http://www.crc.ricoh.com/~gormish/jpeg2000conformance/
+# http://www.jpeg.org/jpeg2000guide/testimages/testimages.html
+
+FILE(GLOB_RECURSE OPENJPEG_DATA_IMAGES_GLOB
+#  "${OPENJPEG_SOURCE_DIR}/testing1/*.j2k"
+#  "${OPENJPEG_SOURCE_DIR}/testing1/*.jp2"
+  "${OPENJPEG_SOURCE_DIR}/testimages/*.j2k"
+  "${OPENJPEG_SOURCE_DIR}/testimages/*.j2c"
+  "${OPENJPEG_SOURCE_DIR}/testimages/*.jp2"
+  )
+
+FOREACH(filename ${OPENJPEG_DATA_IMAGES_GLOB})
+  GET_FILENAME_COMPONENT(filename_temp ${filename} NAME)
+  ADD_TEST(j2i-${filename_temp} ${EXECUTABLE_OUTPUT_PATH}/j2k_to_image -i ${filename} -o ${filename_temp}.tif)
+ENDFOREACH(filename)
 
index 3bd5c2d77cbfd9d3f3d6fdc5f0b9a1dea7f8f796..fe66be18ebd8093aa7ead5d484ac34d0da1906e8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ What's New for OpenJPEG
 
 September 7, 2007
 * [Mathieu Malaterre] Upon failure, properly return error code (!=0).
+* [Mathieu Malaterre] CMake: Add cmake code to do testing if user has properly setup a testimages directory
 
 September 6, 2007
 + [Mathieu Malaterre] CMake: start compiling mj2, jpwl and jp3d
index 363c8fd881f30176a36dd3939b7fd949d11d0e90..84eb07a1f5af80328c5c4ef4ef563a5687d3cb5a 100644 (file)
@@ -43,6 +43,8 @@ FOREACH(exe j2k_to_image image_to_j2k)
   ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
   TARGET_LINK_LIBRARIES(${exe} ${OPJ_PREFIX}openjpeg ${TIFF_LIBRARIES})
   ADD_TEST(${exe} ${EXECUTABLE_OUTPUT_PATH}/${exe})
+  # calling those exe without option will make them fail always:
+  SET_TESTS_PROPERTIES(${exe} PROPERTIES WILL_FAIL TRUE)
   # On unix you need to link to the math library:
   IF(UNIX)
     TARGET_LINK_LIBRARIES(${exe} m)