changeset 12091:6f1857d0f5c1 release-3-2-x

image/imread.m Test added.
author Alexander Mamonov <mamonov@gmail.com>
date Mon, 14 Sep 2009 07:57:38 +0200
parents f12b581a1572
children cca16271a517
files scripts/ChangeLog scripts/image/imread.m
diffstat 2 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-23  Alexander Mamonov  <mamonov@gmail.com>
+
+	* image/imread.m: New test.
+
 2009-09-09  Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
 
 	* plot/gnuplot_drawnow.m: Avoid flickering windows by avoding
--- a/scripts/image/imread.m
+++ b/scripts/image/imread.m
@@ -88,3 +88,30 @@
   end_try_catch
 
 endfunction
+
+%!test 
+%! vpng = [ ...
+%!  137,  80,  78,  71,  13,  10,  26,  10,   0,   0, ...
+%!    0,  13,  73,  72,  68,  82,   0,   0,   0,   3, ...
+%!    0,   0,   0,   3,   8,   2,   0,   0,   0, 217, ...
+%!   74,  34, 232,   0,   0,   0,   1, 115,  82,  71, ...
+%!   66,   0, 174, 206,  28, 233,   0,   0,   0,   4, ...
+%!  103,  65,  77,  65,   0,   0, 177, 143,  11, 252, ...
+%!   97,   5,   0,   0,   0,  32,  99,  72,  82,  77, ...
+%!    0,   0, 122,  38,   0,   0, 128, 132,   0,   0, ...
+%!  250,   0,   0,   0, 128, 232,   0,   0, 117,  48, ...
+%!    0,   0, 234,  96,   0,   0,  58, 152,   0,   0, ...
+%!   23, 112, 156, 186,  81,  60,   0,   0,   0,  25, ...
+%!   73,  68,  65,  84,  24,  87,  99,  96,  96,  96, ...
+%!  248, 255, 255,  63, 144,   4,  81, 111, 101,  84, ...
+%!   16,  28, 160,  16,   0, 197, 214,  13,  34,  74, ...
+%!  117, 213,  17,   0,   0,   0,   0,  73,  69,  78, ...
+%!   68, 174,  66,  96, 130];
+%! fid = fopen('test.png', 'wb');
+%! fwrite(fid, vpng);
+%! fclose(fid);
+%! A = imread('test.png');
+%! delete('test.png');
+%! assert(A(:,:,1), [0, 255, 0; 255, 237, 255; 0, 255, 0]);
+%! assert(A(:,:,2), [0, 255, 0; 255,  28, 255; 0, 255, 0]);
+%! assert(A(:,:,3), [0, 255, 0; 255,  36, 255; 0, 255, 0]);