| 1 |
# CMake build for libtiff |
| 2 |
# |
| 3 |
# Copyright © 2015 Open Microscopy Environment / University of Dundee |
| 4 |
# Written by Roger Leigh <[email protected]> |
| 5 |
# |
| 6 |
# Permission to use, copy, modify, distribute, and sell this software and |
| 7 |
# its documentation for any purpose is hereby granted without fee, provided |
| 8 |
# that (i) the above copyright notices and this permission notice appear in |
| 9 |
# all copies of the software and related documentation, and (ii) the names of |
| 10 |
# Sam Leffler and Silicon Graphics may not be used in any advertising or |
| 11 |
# publicity relating to the software without the specific, prior written |
| 12 |
# permission of Sam Leffler and Silicon Graphics. |
| 13 |
# |
| 14 |
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, |
| 15 |
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY |
| 16 |
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. |
| 17 |
# |
| 18 |
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR |
| 19 |
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, |
| 20 |
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, |
| 21 |
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF |
| 22 |
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE |
| 23 |
# OF THIS SOFTWARE. |
| 24 |
|
| 25 |
# Images for tiff2bw (8-bit RGB only) |
| 26 |
set(RGBIMAGES |
| 27 |
images/palette-1c-8b.tiff |
| 28 |
images/rgb-3c-8b.tiff |
| 29 |
images/quad-lzw-compat.tiff |
| 30 |
) |
| 31 |
|
| 32 |
# This list should contain all of the TIFF files in the 'images' |
| 33 |
# subdirectory which are intended to be used as input images for |
| 34 |
# tests. All of these files should use the extension ".tiff". |
| 35 |
set(TIFFIMAGES |
| 36 |
images/custom_dir_EXIF_GPS.tiff |
| 37 |
images/logluv-3c-16b.tiff |
| 38 |
images/minisblack-1c-16b.tiff |
| 39 |
images/minisblack-1c-8b.tiff |
| 40 |
images/minisblack-2c-8b-alpha.tiff |
| 41 |
images/miniswhite-1c-1b.tiff |
| 42 |
images/palette-1c-1b.tiff |
| 43 |
images/palette-1c-4b.tiff |
| 44 |
images/palette-1c-8b.tiff |
| 45 |
images/rgb-3c-16b.tiff |
| 46 |
images/rgb-3c-8b.tiff |
| 47 |
images/quad-lzw-compat.tiff |
| 48 |
images/lzw-single-strip.tiff |
| 49 |
images/testfax4.tiff |
| 50 |
images/testfax3_bug_513.tiff |
| 51 |
images/32bpp-None.tiff |
| 52 |
) |
| 53 |
# TIFF images using old-jpeg. Unused unless JPEG support is enabled. |
| 54 |
set(TIFFIMAGES_OJPEG) |
| 55 |
|
| 56 |
if(JPEG_SUPPORT) |
| 57 |
list(APPEND TIFFIMAGES images/quad-tile.jpg.tiff) |
| 58 |
endif() |
| 59 |
|
| 60 |
if (OJPEG_SUPPORT) |
| 61 |
list(APPEND TIFFIMAGES_OJPEG |
| 62 |
images/ojpeg_zackthecat_subsamp22_single_strip.tiff |
| 63 |
images/ojpeg_chewey_subsamp21_multi_strip.tiff |
| 64 |
images/ojpeg_single_strip_no_rowsperstrip.tiff |
| 65 |
) |
| 66 |
endif() |
| 67 |
|
| 68 |
set(BMPIMAGES |
| 69 |
images/palette-1c-8b.bmp |
| 70 |
images/rgb-3c-8b.bmp) |
| 71 |
|
| 72 |
set(GIFIMAGES |
| 73 |
images/palette-1c-8b.gif) |
| 74 |
|
| 75 |
set(PNMIMAGES |
| 76 |
images/minisblack-1c-8b.pgm |
| 77 |
images/miniswhite-1c-1b.pbm |
| 78 |
images/rgb-3c-16b.ppm |
| 79 |
images/rgb-3c-8b.ppm) |
| 80 |
|
| 81 |
# All uncompressed image files |
| 82 |
set(UNCOMPRESSEDIMAGES |
| 83 |
images/minisblack-1c-16b.tiff |
| 84 |
images/minisblack-1c-8b.tiff |
| 85 |
images/miniswhite-1c-1b.tiff |
| 86 |
images/palette-1c-1b.tiff |
| 87 |
images/palette-1c-4b.tiff |
| 88 |
images/palette-1c-8b.tiff |
| 89 |
images/rgb-3c-8b.tiff) |
| 90 |
|
| 91 |
# This list should include all of the files in the 'images' |
| 92 |
# subdirectory which are intended to be distributed. This may include |
| 93 |
# files which are not currently used by the tests. |
| 94 |
set(IMAGES_EXTRA_DIST |
| 95 |
images/README.txt |
| 96 |
images/miniswhite-1c-1b.g3 |
| 97 |
images/32bpp-None-jpeg.tiff |
| 98 |
${BMPIMAGES} |
| 99 |
${GIFIMAGES} |
| 100 |
${PNMIMAGES} |
| 101 |
${TIFFIMAGES}) |
| 102 |
|
| 103 |
set(noinst_HEADERS tifftest.h) |
| 104 |
|
| 105 |
set(simple_tests) |
| 106 |
|
| 107 |
# Test programs |
| 108 |
add_executable(test_signed_tags ../placeholder.h) |
| 109 |
target_sources(test_signed_tags PRIVATE test_signed_tags.c) |
| 110 |
target_link_libraries(test_signed_tags PRIVATE tiff tiff_port) |
| 111 |
list(APPEND simple_tests test_signed_tags) |
| 112 |
|
| 113 |
add_executable(ascii_tag ../placeholder.h) |
| 114 |
target_sources(ascii_tag PRIVATE ascii_tag.c) |
| 115 |
target_link_libraries(ascii_tag PRIVATE tiff tiff_port) |
| 116 |
list(APPEND simple_tests ascii_tag) |
| 117 |
|
| 118 |
add_executable(long_tag ../placeholder.h) |
| 119 |
target_sources(long_tag PRIVATE long_tag.c check_tag.c) |
| 120 |
target_link_libraries(long_tag PRIVATE tiff tiff_port) |
| 121 |
list(APPEND simple_tests long_tag) |
| 122 |
|
| 123 |
add_executable(short_tag ../placeholder.h) |
| 124 |
target_sources(short_tag PRIVATE short_tag.c check_tag.c) |
| 125 |
target_link_libraries(short_tag PRIVATE tiff tiff_port) |
| 126 |
list(APPEND simple_tests short_tag) |
| 127 |
|
| 128 |
add_executable(strip_rw ../placeholder.h) |
| 129 |
target_sources(strip_rw PRIVATE strip_rw.c strip.c test_arrays.c test_arrays.h) |
| 130 |
target_link_libraries(strip_rw PRIVATE tiff tiff_port) |
| 131 |
list(APPEND simple_tests strip_rw) |
| 132 |
|
| 133 |
add_executable(rewrite ../placeholder.h) |
| 134 |
target_sources(rewrite PRIVATE rewrite_tag.c) |
| 135 |
target_link_libraries(rewrite PRIVATE tiff tiff_port) |
| 136 |
list(APPEND simple_tests rewrite) |
| 137 |
|
| 138 |
if(JPEG_SUPPORT) |
| 139 |
add_executable(raw_decode ../placeholder.h) |
| 140 |
target_sources(raw_decode PRIVATE raw_decode.c) |
| 141 |
target_link_libraries(raw_decode PRIVATE tiff tiff_port JPEG::JPEG) |
| 142 |
list(APPEND simple_tests raw_decode) |
| 143 |
endif() |
| 144 |
|
| 145 |
add_executable(custom_dir ../placeholder.h) |
| 146 |
target_sources(custom_dir PRIVATE custom_dir.c) |
| 147 |
target_link_libraries(custom_dir PRIVATE tiff tiff_port) |
| 148 |
list(APPEND simple_tests custom_dir) |
| 149 |
|
| 150 |
# Uses private functions from static library |
| 151 |
if(NOT BUILD_SHARED_LIBS) |
| 152 |
add_executable(rational_precision2double ../placeholder.h) |
| 153 |
target_sources(rational_precision2double PRIVATE rational_precision2double.c) |
| 154 |
target_link_libraries(rational_precision2double PRIVATE tiff tiff_port) |
| 155 |
list(APPEND simple_tests rational_precision2double) |
| 156 |
|
| 157 |
add_executable(test_write_read_tags ../placeholder.h) |
| 158 |
target_sources(test_write_read_tags PRIVATE test_write_read_tags.c) |
| 159 |
target_link_libraries(test_write_read_tags PRIVATE tiff) |
| 160 |
list(APPEND simple_tests test_write_read_tags) |
| 161 |
|
| 162 |
add_executable(test_transferfunction_write_read ../placeholder.h) |
| 163 |
target_sources(test_transferfunction_write_read PRIVATE test_transferfunction_write_read.c) |
| 164 |
target_link_libraries(test_transferfunction_write_read PRIVATE tiff) |
| 165 |
list(APPEND simple_tests test_transferfunction_write_read) |
| 166 |
endif() |
| 167 |
|
| 168 |
add_executable(custom_dir_EXIF_231 ../placeholder.h) |
| 169 |
target_sources(custom_dir_EXIF_231 PRIVATE custom_dir_EXIF_231.c) |
| 170 |
target_link_libraries(custom_dir_EXIF_231 PRIVATE tiff tiff_port) |
| 171 |
list(APPEND simple_tests custom_dir_EXIF_231) |
| 172 |
|
| 173 |
add_executable(defer_strile_loading ../placeholder.h) |
| 174 |
target_sources(defer_strile_loading PRIVATE defer_strile_loading.c) |
| 175 |
target_link_libraries(defer_strile_loading PRIVATE tiff tiff_port) |
| 176 |
list(APPEND simple_tests defer_strile_loading) |
| 177 |
|
| 178 |
add_executable(defer_strile_writing ../placeholder.h) |
| 179 |
target_sources(defer_strile_writing PRIVATE defer_strile_writing.c) |
| 180 |
target_link_libraries(defer_strile_writing PRIVATE tiff tiff_port) |
| 181 |
list(APPEND simple_tests defer_strile_writing) |
| 182 |
|
| 183 |
add_executable(test_directory ../placeholder.h) |
| 184 |
target_sources(test_directory PRIVATE test_directory.c) |
| 185 |
target_link_libraries(test_directory PRIVATE tiff tiff_port) |
| 186 |
list(APPEND simple_tests test_directory) |
| 187 |
|
| 188 |
add_executable(test_IFD_enlargement ../placeholder.h) |
| 189 |
target_sources(test_IFD_enlargement PRIVATE test_IFD_enlargement.c) |
| 190 |
target_link_libraries(test_IFD_enlargement PRIVATE tiff tiff_port) |
| 191 |
list(APPEND simple_tests test_IFD_enlargement) |
| 192 |
|
| 193 |
add_executable(testtypes ../placeholder.h) |
| 194 |
target_sources(testtypes PRIVATE testtypes.c) |
| 195 |
target_link_libraries(testtypes PRIVATE tiff tiff_port) |
| 196 |
list(APPEND simple_tests testtypes) |
| 197 |
|
| 198 |
add_executable(test_open_options ../placeholder.h) |
| 199 |
target_sources(test_open_options PRIVATE test_open_options.c) |
| 200 |
target_link_libraries(test_open_options PRIVATE tiff tiff_port) |
| 201 |
list(APPEND simple_tests test_open_options) |
| 202 |
|
| 203 |
add_executable(test_append_to_strip ../placeholder.h) |
| 204 |
target_sources(test_append_to_strip PRIVATE test_append_to_strip.c) |
| 205 |
target_link_libraries(test_append_to_strip PRIVATE tiff tiff_port) |
| 206 |
list(APPEND simple_tests test_append_to_strip) |
| 207 |
|
| 208 |
add_executable(test_ifd_loop_detection ../placeholder.h) |
| 209 |
target_sources(test_ifd_loop_detection PRIVATE test_ifd_loop_detection.c) |
| 210 |
target_link_libraries(test_ifd_loop_detection PRIVATE tiff tiff_port) |
| 211 |
target_compile_definitions(test_ifd_loop_detection PRIVATE SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\") |
| 212 |
list(APPEND simple_tests test_ifd_loop_detection) |
| 213 |
|
| 214 |
if(WEBP_SUPPORT AND EMSCRIPTEN) |
| 215 |
# Emscripten is pretty finnicky about linker flags. |
| 216 |
# It needs --shared-memory if and only if atomics or bulk-memory is used. |
| 217 |
foreach(target |
| 218 |
ascii_tag |
| 219 |
long_tag |
| 220 |
short_tag |
| 221 |
strip_rw |
| 222 |
rewrite |
| 223 |
custom_dir |
| 224 |
defer_strile_loading |
| 225 |
defer_strile_writing |
| 226 |
) |
| 227 |
target_link_options(${target} PUBLIC "-Wl,--shared-memory") |
| 228 |
endforeach() |
| 229 |
if(JPEG_SUPPORT) |
| 230 |
target_link_options(raw_decode PUBLIC "-Wl,--shared-memory") |
| 231 |
endif() |
| 232 |
endif() |
| 233 |
|
| 234 |
set(TEST_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output") |
| 235 |
file(MAKE_DIRECTORY "${TEST_OUTPUT}") |
| 236 |
|
| 237 |
set(tiff_test_extra_args "-DLIBTIFF=$<TARGET_FILE:tiff>") |
| 238 |
|
| 239 |
if(tiff-tools) |
| 240 |
list(APPEND tiff_test_extra_args "-DTIFFCP=$<TARGET_FILE:tiffcp>") |
| 241 |
list(APPEND tiff_test_extra_args "-DTIFFINFO=$<TARGET_FILE:tiffinfo>") |
| 242 |
list(APPEND tiff_test_extra_args "-DTIFFSPLIT=$<TARGET_FILE:tiffsplit>") |
| 243 |
endif() |
| 244 |
|
| 245 |
if(WIN32) |
| 246 |
list(APPEND tiff_test_extra_args "-DWIN32=${WIN32}") |
| 247 |
endif() |
| 248 |
if(CYGWIN) |
| 249 |
list(APPEND tiff_test_extra_args "-DCYGWIN=${CYGWIN}") |
| 250 |
endif() |
| 251 |
|
| 252 |
function(tiff_test_convert name command1 command2 command3 infile outfile validate) |
| 253 |
add_test(NAME "${name}" |
| 254 |
COMMAND "${CMAKE_COMMAND}" |
| 255 |
"-DCONVERT_COMMAND1=${command1}" |
| 256 |
"-DCONVERT_COMMAND2=${command2}" |
| 257 |
"-DCONVERT_COMMAND3=${command3}" |
| 258 |
"-DINFILE=${infile}" |
| 259 |
"-DOUTFILE=${outfile}" |
| 260 |
"-DVALIDATE=${validate}" |
| 261 |
${tiff_test_extra_args} |
| 262 |
-P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake") |
| 263 |
endfunction() |
| 264 |
|
| 265 |
function(tiff_test_stdout name suffix command infile outfile) |
| 266 |
if (suffix) |
| 267 |
set(name "${name}-${suffix}") |
| 268 |
endif() |
| 269 |
add_test(NAME "${name}" |
| 270 |
COMMAND "${CMAKE_COMMAND}" |
| 271 |
"-DSTDOUT_COMMAND=${command}" |
| 272 |
"-DINFILE=${infile}" |
| 273 |
"-DOUTFILE=${outfile}" |
| 274 |
${tiff_test_extra_args} |
| 275 |
-P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake") |
| 276 |
endfunction() |
| 277 |
|
| 278 |
function(tiff_test_stdout_noargs name command) |
| 279 |
add_test(NAME "${name}" |
| 280 |
COMMAND "${CMAKE_COMMAND}" |
| 281 |
"-DSTDOUT_COMMAND=$<TARGET_FILE:${command}>" |
| 282 |
${tiff_test_extra_args} |
| 283 |
-P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake" |
| 284 |
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") |
| 285 |
set_tests_properties("${name}" PROPERTIES ENVIRONMENT |
| 286 |
"srcdir=${CMAKE_CURRENT_SOURCE_DIR}") |
| 287 |
endfunction() |
| 288 |
|
| 289 |
function(tiff_test_reader name command infile) |
| 290 |
add_test(NAME "${name}" |
| 291 |
COMMAND "${CMAKE_COMMAND}" |
| 292 |
"-DREADER_COMMAND=${command}" |
| 293 |
"-DINFILE=${infile}" |
| 294 |
${tiff_test_extra_args} |
| 295 |
-P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake") |
| 296 |
endfunction() |
| 297 |
|
| 298 |
function(add_convert_test_multi_out_in commandname1 commandname2 commandname3 |
| 299 |
categoryname commandargs1 commandargs2 commandargs3 |
| 300 |
image validate) |
| 301 |
string(REPLACE " " "^" escaped_commandargs1 "${commandargs1}") |
| 302 |
string(REPLACE " " "^" escaped_commandargs2 "${commandargs2}") |
| 303 |
string(REPLACE " " "^" escaped_commandargs3 "${commandargs3}") |
| 304 |
get_filename_component(name "${image}" NAME) |
| 305 |
get_filename_component(base "${image}" NAME_WE) |
| 306 |
set(testname "${commandname1}-${categoryname}-${base}") |
| 307 |
if(commandname1) |
| 308 |
set(command1 |
| 309 |
"$<TARGET_FILE:${commandname1}>^${escaped_commandargs1}") |
| 310 |
else() |
| 311 |
set(command1) |
| 312 |
endif() |
| 313 |
if(commandname2) |
| 314 |
set(command2 |
| 315 |
"$<TARGET_FILE:${commandname2}>^${escaped_commandargs2}") |
| 316 |
else() |
| 317 |
set(command2) |
| 318 |
endif() |
| 319 |
if(commandname3) |
| 320 |
set(command3 |
| 321 |
"$<TARGET_FILE:${commandname3}>^${escaped_commandargs3}") |
| 322 |
else() |
| 323 |
set(command3) |
| 324 |
endif() |
| 325 |
set(infile "${TEST_OUTPUT}/${image}") |
| 326 |
set(outfile "${TEST_OUTPUT}/${commandname1}-${categoryname}-${base}.tiff") |
| 327 |
tiff_test_convert("${testname}" "${command1}" "${command2}" "${command3}" |
| 328 |
"${infile}" "${outfile}" "${validate}") |
| 329 |
endfunction() |
| 330 |
|
| 331 |
function(add_convert_test_multi commandname1 commandname2 commandname3 |
| 332 |
categoryname commandargs1 commandargs2 commandargs3 |
| 333 |
image validate) |
| 334 |
string(REPLACE " " "^" escaped_commandargs1 "${commandargs1}") |
| 335 |
string(REPLACE " " "^" escaped_commandargs2 "${commandargs2}") |
| 336 |
string(REPLACE " " "^" escaped_commandargs3 "${commandargs3}") |
| 337 |
get_filename_component(name "${image}" NAME) |
| 338 |
get_filename_component(base "${image}" NAME_WE) |
| 339 |
set(testname "${commandname1}-${categoryname}-${base}") |
| 340 |
if(commandname1) |
| 341 |
set(command1 |
| 342 |
"$<TARGET_FILE:${commandname1}>^${escaped_commandargs1}") |
| 343 |
else() |
| 344 |
set(command1) |
| 345 |
endif() |
| 346 |
if(commandname2) |
| 347 |
set(command2 |
| 348 |
"$<TARGET_FILE:${commandname2}>^${escaped_commandargs2}") |
| 349 |
else() |
| 350 |
set(command2) |
| 351 |
endif() |
| 352 |
if(commandname3) |
| 353 |
set(command3 |
| 354 |
"$<TARGET_FILE:${commandname3}>^${escaped_commandargs3}") |
| 355 |
else() |
| 356 |
set(command3) |
| 357 |
endif() |
| 358 |
set(infile "${CMAKE_CURRENT_SOURCE_DIR}/${image}") |
| 359 |
set(outfile "${TEST_OUTPUT}/${commandname1}-${categoryname}-${base}.tiff") |
| 360 |
tiff_test_convert("${testname}" "${command1}" "${command2}" "${command3}" |
| 361 |
"${infile}" "${outfile}" "${validate}") |
| 362 |
endfunction() |
| 363 |
|
| 364 |
function(add_convert_test commandname |
| 365 |
categoryname commandargs |
| 366 |
image validate) |
| 367 |
add_convert_test_multi("${commandname}" "" "" |
| 368 |
"${categoryname}" "${commandargs}" "" "" |
| 369 |
"${image}" "${validate}") |
| 370 |
endfunction() |
| 371 |
|
| 372 |
function(add_convert_tests_multi commandname1 commandname2 commandname3 |
| 373 |
categoryname |
| 374 |
commandargs1 commandargs2 commandargs3 |
| 375 |
images validate) |
| 376 |
foreach(file ${${images}}) |
| 377 |
add_convert_test_multi("${commandname1}" "${commandname2}" |
| 378 |
"${commandname3}" "${categoryname}" |
| 379 |
"${commandargs1}" "${commandargs2}" |
| 380 |
"${commandargs3}" "${file}" "${validate}") |
| 381 |
endforeach() |
| 382 |
endfunction() |
| 383 |
|
| 384 |
function(add_convert_tests commandname categoryname commandargs images validate) |
| 385 |
foreach(file ${${images}}) |
| 386 |
add_convert_test("${commandname}" "${categoryname}" |
| 387 |
"${commandargs}" "${file}" "${validate}") |
| 388 |
endforeach() |
| 389 |
endfunction() |
| 390 |
|
| 391 |
function(add_stdout_test commandname suffix commandargs image) |
| 392 |
string(REPLACE " " "^" escaped_commandargs "${commandargs}") |
| 393 |
get_filename_component(name "${image}" NAME) |
| 394 |
get_filename_component(base "${image}" NAME_WE) |
| 395 |
set(testname "${commandname}-${base}") |
| 396 |
set(command "$<TARGET_FILE:${commandname}>^${escaped_commandargs}") |
| 397 |
set(infile "${CMAKE_CURRENT_SOURCE_DIR}/${image}") |
| 398 |
set(outfile "${TEST_OUTPUT}/${commandname}-${name}") |
| 399 |
string(REGEX REPLACE "\\.tiff\$" "" name "${name}") |
| 400 |
tiff_test_stdout("${testname}" "${suffix}" "${command}" "${infile}" "${outfile}") |
| 401 |
endfunction() |
| 402 |
|
| 403 |
function(add_reader_test commandname commandargs image) |
| 404 |
string(REPLACE " " "^" escaped_commandargs "${commandargs}") |
| 405 |
get_filename_component(name "${image}" NAME) |
| 406 |
get_filename_component(base "${image}" NAME_WE) |
| 407 |
set(testname "${commandname}-${base}") |
| 408 |
set(command "$<TARGET_FILE:${commandname}>^${escaped_commandargs}") |
| 409 |
set(infile "${CMAKE_CURRENT_SOURCE_DIR}/${image}") |
| 410 |
tiff_test_reader("${testname}" "${command}" "${infile}") |
| 411 |
endfunction() |
| 412 |
|
| 413 |
# Plain executables with no arguments |
| 414 |
foreach(target IN LISTS simple_tests) |
| 415 |
tiff_test_stdout_noargs("${target}" "${target}") |
| 416 |
endforeach() |
| 417 |
|
| 418 |
if(tiff-tools) |
| 419 |
# PPM |
| 420 |
add_convert_test(ppm2tiff miniswhite "" "images/miniswhite-1c-1b.pbm" TRUE) |
| 421 |
add_convert_test(ppm2tiff minisblack "" "images/minisblack-1c-8b.pgm" TRUE) |
| 422 |
add_convert_test(ppm2tiff rgb "" "images/rgb-3c-16b.ppm" TRUE) |
| 423 |
add_convert_test(ppm2tiff rgb "" "images/rgb-3c-8b.ppm" TRUE) |
| 424 |
|
| 425 |
# tiffcp |
| 426 |
# Reading / writing TIFF images with different encoding schemes. |
| 427 |
add_convert_tests(tiffcp TIFFIMG "" TIFFIMAGES TRUE) |
| 428 |
|
| 429 |
# Convert some images to another coding scheme. |
| 430 |
add_convert_test(tiffcp g3 "-c g3" "images/miniswhite-1c-1b.tiff" FALSE) |
| 431 |
add_convert_test(tiffcp g31d "-c g3:1d" "images/miniswhite-1c-1b.tiff" FALSE) |
| 432 |
add_convert_test(tiffcp g31dfill "-c g3:1d:fill" "images/miniswhite-1c-1b.tiff" FALSE) |
| 433 |
add_convert_test(tiffcp g32d "-c g3:2d" "images/miniswhite-1c-1b.tiff" FALSE) |
| 434 |
add_convert_test(tiffcp g32dfill "-c g3:2d:fill" "images/miniswhite-1c-1b.tiff" FALSE) |
| 435 |
add_convert_test(tiffcp g4 "-c g4" "images/miniswhite-1c-1b.tiff" FALSE) |
| 436 |
add_convert_test_multi(tiffcp tiffcp "" logluv "-c none" "-c sgilog" "" |
| 437 |
"images/logluv-3c-16b.tiff" FALSE) |
| 438 |
add_convert_test_multi(tiffcp thumbnail "" thumbnail "-c g3:1d" "" "" |
| 439 |
"images/miniswhite-1c-1b.tiff" FALSE) |
| 440 |
add_convert_test(tiffcp none "-c none" "images/quad-lzw-compat.tiff" FALSE) |
| 441 |
add_convert_test(tiffcp noner1 "-c none -r 1" "images/lzw-single-strip.tiff" FALSE) |
| 442 |
add_convert_test(tiffcp float64_lzw_2_le "-c lzw:2" "images/test_float64_predictor2_le_lzw.tif" FALSE) |
| 443 |
add_convert_test(tiffcp float64_lzw_2_be "-c lzw:2" "images/test_float64_predictor2_be_lzw.tif" FALSE) |
| 444 |
if(WEBP_SUPPORT) |
| 445 |
add_convert_test(tiffcp webp_lossless_rgba_alpha_fully_opaque "-c none" "images/webp_lossless_rgba_alpha_fully_opaque.tif" FALSE) |
| 446 |
endif() |
| 447 |
|
| 448 |
add_convert_test(tiff2rgba 32BPP "-B 255 -n" "images/32bpp-None.tiff" TRUE) |
| 449 |
if(JPEG_SUPPORT) |
| 450 |
add_convert_test(tiffcp 32BPP-JPEG "-c jpeg" "images/32bpp-None-jpeg.tiff" TRUE) |
| 451 |
endif() |
| 452 |
|
| 453 |
if(JBIG_SUPPORT) |
| 454 |
add_convert_test(tiffcp jbig "-c jbig" "images/lzw-single-strip.tiff" TRUE) |
| 455 |
endif() |
| 456 |
|
| 457 |
# Old-JPEG tests |
| 458 |
#--- tiffcp does not support subsampled images, as the OldJPEG ones are --- |
| 459 |
# ToDo: a test for OldJPEG is missing. |
| 460 |
#add_convert_tests(test_tiffcp OldJPEG "" TIFFIMAGES_OJPEG TRUE) |
| 461 |
|
| 462 |
# tiffdump |
| 463 |
add_reader_test(tiffdump "" "images/miniswhite-1c-1b.tiff") |
| 464 |
|
| 465 |
# tiffinfo |
| 466 |
add_reader_test(tiffinfo "-c -D -d -j -s" "images/custom_dir_EXIF_GPS.tiff") |
| 467 |
add_reader_test(tiffinfo "-c -D -d -j -s" "images/minisblack-1c-16b.tiff") |
| 468 |
add_reader_test(tiffinfo " " "images/tiff_with_subifd_chain.tif") |
| 469 |
|
| 470 |
# tiffcp split/join |
| 471 |
foreach(image ${UNCOMPRESSEDIMAGES}) |
| 472 |
list(APPEND ESCAPED_UNCOMPRESSED "${CMAKE_CURRENT_SOURCE_DIR}/${image}") |
| 473 |
endforeach() |
| 474 |
string(REPLACE ";" "^" ESCAPED_UNCOMPRESSED "${ESCAPED_UNCOMPRESSED}") |
| 475 |
add_test(NAME "tiffcp-split" |
| 476 |
COMMAND "${CMAKE_COMMAND}" |
| 477 |
"-DTESTFILES=${ESCAPED_UNCOMPRESSED}" |
| 478 |
"-DCONJOINED=${TEST_OUTPUT}/tiffcp-split-conjoined.tiff" |
| 479 |
"-DSPLITFILE=${TEST_OUTPUT}/tiffcp-split-split-" |
| 480 |
${tiff_test_extra_args} |
| 481 |
-P "${CMAKE_CURRENT_SOURCE_DIR}/TiffSplitTest.cmake") |
| 482 |
add_test(NAME "tiffcp-split-join" |
| 483 |
COMMAND "${CMAKE_COMMAND}" |
| 484 |
"-DTESTFILES=${ESCAPED_UNCOMPRESSED}" |
| 485 |
"-DCONJOINED=${TEST_OUTPUT}/tiffcp-split-join-conjoined.tiff" |
| 486 |
"-DSPLITFILE=${TEST_OUTPUT}/tiffcp-split-join-split-" |
| 487 |
"-DRECONJOINED=${TEST_OUTPUT}/tiffcp-split-join-reconjoined.tiff" |
| 488 |
${tiff_test_extra_args} |
| 489 |
-P "${CMAKE_CURRENT_SOURCE_DIR}/TiffSplitTest.cmake") |
| 490 |
|
| 491 |
# PDF |
| 492 |
add_stdout_test(tiff2pdf "" "" "images/miniswhite-1c-1b.tiff" TRUE) |
| 493 |
|
| 494 |
# PS |
| 495 |
add_stdout_test(tiff2ps "ps-1" "-a -p -1" "images/miniswhite-1c-1b.tiff" TRUE) |
| 496 |
add_stdout_test(tiff2ps "ps-2" "-a -p -2" "images/miniswhite-1c-1b.tiff" TRUE) |
| 497 |
add_stdout_test(tiff2ps "ps-3" "-a -p -3" "images/miniswhite-1c-1b.tiff" TRUE) |
| 498 |
add_stdout_test(tiff2ps "eps-1" "-e -1" "images/miniswhite-1c-1b.tiff" TRUE) |
| 499 |
|
| 500 |
# BW |
| 501 |
add_convert_tests(tiff2bw default "" RGBIMAGES TRUE) |
| 502 |
|
| 503 |
# RGBA |
| 504 |
add_convert_tests(tiff2rgba default "" TIFFIMAGES TRUE) |
| 505 |
# RGBA (old-jpeg) |
| 506 |
add_convert_tests(tiff2rgba default "" TIFFIMAGES_OJPEG TRUE) |
| 507 |
# Test rotations |
| 508 |
add_convert_tests(tiffcrop R90 "-R90" TIFFIMAGES TRUE) |
| 509 |
# Test flip (mirror) |
| 510 |
add_convert_tests(tiffcrop doubleflip "-F both" TIFFIMAGES TRUE) |
| 511 |
# Test extracting a section 60 pixels wide and 60 pixels high |
| 512 |
add_convert_tests(tiffcrop extract "-U px -E top -X 60 -Y 60" TIFFIMAGES TRUE) |
| 513 |
# Test extracting the first and fourth quarters from the left side. |
| 514 |
add_convert_tests(tiffcrop extractz14 "-E left -Z1:4,2:4" TIFFIMAGES TRUE) |
| 515 |
endif() |