Mercurial > octave-libtiff
diff scripts/io/Tiff.m @ 31131:7349994f30f8
Tiff: fixed the first test to use a single-pixel image
* Tiff.m: modified the test to use an image with one pixel instead
of an empty image.
* __tiff__.cc: fixed bugs in PlanarConfiguration tag and in type checking
for writeEncodedStrip.
author | magedrifaat <magedrifaat@gmail.com> |
---|---|
date | Mon, 25 Jul 2022 04:15:18 +0200 |
parents | 7851c5b9c950 |
children | c66f7c227e50 |
line wrap: on
line diff
--- a/scripts/io/Tiff.m Sun Jul 24 22:24:10 2022 +0200 +++ b/scripts/io/Tiff.m Mon Jul 25 04:15:18 2022 +0200 @@ -1,6 +1,5 @@ classdef Tiff properties (Constant = true) - % TODO(maged): Add the remaining fields TagID = struct( "SubFileType", 254, "ImageWidth", 256, @@ -112,13 +111,21 @@ endmethods endclassdef -## test empty image +## test one-pixel image %!testif HAVE_TIFF %! filename = [tempname() ".tif"]; %! unwind_protect %! a = Tiff (filename, "w"); +%! setTag(a, "ImageWidth", 1); +%! setTag(a, "ImageLength", 1); +%! setTag(a, "BitsPerSample", 8); +%! data = uint8([255]); +%! writeEncodedStrip(a, 1, data); %! a.close (); -%! a = Tiff (filename, "rh"); +%! a = Tiff (filename, "r"); +%! data2 = a.read(); +%! assert (all (size(data) == [1, 1])); +%! assert (data(1) == 255); %! a.close (); %! unwind_protect_cleanup %! unlink (filename);