images: consolidated test suite for image decoders

db4
Keith Lazuka 2009-09-30 17:01:09 -04:00
parent 6e12c254ef
commit 31e34acc01
11 changed files with 34 additions and 48 deletions

View File

@ -1,7 +1,10 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test images.png ;
USING: images.png images.testing namespaces tools.test
tools.test.private ;
IN: images.png.tests
: png-test-path ( -- path )
"vocab:images/test-images/rgb.png" ;
verbose-tests? off
"vocab:images/testing/png/rgb.png" decode-test
"vocab:images/testing/png/yin_yang.png" decode-test
verbose-tests? on

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -26,5 +26,6 @@ IN: images.testing
PRIVATE>
: decode-test ( path -- )
[ load-image 1quotation ] [ '[ _ pam-name load-image ] ] bi
[ load-image 1quotation ]
[ '[ _ pam-name load-image ] ] bi
unit-test ;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,44 +1,15 @@
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors images.tiff images.viewer io
io.encodings.binary io.files namespaces sequences tools.test ;
USING: accessors images.testing images.tiff images.viewer io
io.encodings.binary io.files namespaces sequences tools.test
tools.test.private ;
IN: images.tiff.tests
: path>tiff ( path -- tiff )
binary [ input-stream get load-tiff ] with-file-reader ;
: tiff-example1 ( -- tiff )
"resource:extra/images/testing/square.tiff" path>tiff ;
: tiff-example2 ( -- tiff )
"resource:extra/images/testing/cube.tiff" path>tiff ;
: tiff-example3 ( -- tiff )
"resource:extra/images/testing/bi.tiff" path>tiff ;
: tiff-example4 ( -- tiff )
"resource:extra/images/testing/noise.tiff" path>tiff ;
: tiff-example5 ( -- tiff )
"resource:extra/images/testing/alpha.tiff" path>tiff ;
: tiff-example6 ( -- tiff )
"resource:extra/images/testing/color_spectrum.tiff" path>tiff ;
: tiff-example7 ( -- tiff )
"resource:extra/images/testing/small.tiff" path>tiff ;
: tiff-all. ( -- )
{
tiff-example1 tiff-example2 tiff-example3 tiff-example4 tiff-example5
tiff-example6
}
[ execute( -- gif ) tiff>image image. ] each ;
[ 1024 ] [ tiff-example1 ifds>> first bitmap>> length ] unit-test
[ 1024 ] [ tiff-example2 ifds>> first bitmap>> length ] unit-test
[ 131744 ] [ tiff-example3 ifds>> first bitmap>> length ] unit-test
[ 49152 ] [ tiff-example4 ifds>> first bitmap>> length ] unit-test
[ 16 ] [ tiff-example5 ifds>> first bitmap>> length ] unit-test
[ 117504 ] [ tiff-example6 ifds>> first bitmap>> length ] unit-test
verbose-tests? off
"vocab:images/testing/tiff/octagon.tiff" decode-test
"vocab:images/testing/tiff/elephants.tiff" decode-test
"vocab:images/testing/tiff/noise.tiff" decode-test
"vocab:images/testing/tiff/alpha.tiff" decode-test
"vocab:images/testing/tiff/color_spectrum.tiff" decode-test
! "vocab:images/testing/tiff/rgb.tiff" decode-test
verbose-tests? on

View File

@ -1,18 +1,21 @@
! Copyright (C) 2009 Keith Lazuka.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors bitstreams compression.lzw fry images.gif
images.loader images.viewer images.testing io io.encodings.binary io.files
io.pathnames kernel math math.bitwise math.parser namespaces
prettyprint quotations sequences tools.test ;
images.loader images.testing images.viewer io
io.encodings.binary io.files io.pathnames kernel math
math.bitwise math.parser namespaces prettyprint quotations
sequences tools.test tools.test.private ;
QUALIFIED-WITH: bitstreams bs
IN: images.gif.tests
verbose-tests? off
"vocab:images/testing/gif/circle.gif" decode-test
"vocab:images/testing/gif/checkmark.gif" decode-test
"vocab:images/testing/gif/monochrome.gif" decode-test
"vocab:images/testing/gif/alpha.gif" decode-test
! "vocab:images/testing/gif/noise.gif" decode-test
"vocab:images/testing/gif/noise.gif" decode-test
"vocab:images/testing/gif/astronaut_animation.gif" decode-test
verbose-tests? on
: path>gif ( path -- gif )
binary [ input-stream get load-gif ] with-file-reader ;