diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b563fa5..550af2b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/ChangeLog b/ChangeLog index 3bd5c2d7..fe66be18 100644 --- 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 diff --git a/codec/CMakeLists.txt b/codec/CMakeLists.txt index 363c8fd8..84eb07a1 100644 --- a/codec/CMakeLists.txt +++ b/codec/CMakeLists.txt @@ -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)