changeset 31169:ae41e14bf5c7

Tiff.m: added tests for array and special tags.
author magedrifaat <magedrifaat@gmail.com>
date Sat, 13 Aug 2022 02:45:51 +0200
parents 27ed758c1688
children 72a159bc5a4c
files scripts/io/Tiff.m
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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\")",