# HG changeset patch # User magedrifaat # Date 1660351551 -7200 # Node ID ae41e14bf5c7571cfd5e8ff8ca4081951e70e951 # Parent 27ed758c1688b8b3e39439506a5908d877fe5527 Tiff.m: added tests for array and special tags. diff -r 27ed758c1688 -r ae41e14bf5c7 scripts/io/Tiff.m --- a/scripts/io/Tiff.m Fri Aug 12 21:50:43 2022 +0200 +++ b/scripts/io/Tiff.m Sat Aug 13 02:45:51 2022 +0200 @@ -385,6 +385,27 @@ %! endfunction %! file_wrapper (@test_fn); +## test setTag array field +%!testif HAVE_TIFF +%! function test_fn (filename) +%! img = Tiff (filename, "w"); +%! setTag (img, "YCbCrCoefficients", [1.5, 2.5, 3.5]); +%! data = getTag (img, "YCbCrCoefficients"); +%! assert (data, [1.5, 2.5, 3.5]); +%! endfunction +%! file_wrapper (@test_fn); + +## test setTag special field +%!testif HAVE_TIFF +%! function test_fn (filename) +%! img = Tiff (filename, "w"); +%! setTag (img, "BitsPerSample", 8); +%! cmap = reshape (1:768, [256, 3]) / 1024.0; +%! setTag (img, "ColorMap", cmap); +%! assert (getTag (img, "ColorMap"), cmap, 1e-5); +%! endfunction +%! file_wrapper (@test_fn); + ## test failure invalid open mode/ invalid filename %!testif HAVE_TIFF %! fail ("Tiff (\"test.tif\", \"rh\")",