images.testing: consolidated TIFF/GIF/PNG/PAM test images and wrote PAM unit tests

db4
Keith Lazuka 2009-09-30 13:33:10 -04:00
parent dc509f111b
commit 19107de7d8
35 changed files with 70 additions and 0 deletions

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 44 B

After

Width:  |  Height:  |  Size: 44 B

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 129 B

After

Width:  |  Height:  |  Size: 129 B

View File

Before

Width:  |  Height:  |  Size: 51 B

After

Width:  |  Height:  |  Size: 51 B

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -0,0 +1,13 @@
! Copyright (C) 2009 Keith Lazuka.
! See http://factorcode.org/license.txt for BSD license.
USING: io io.encodings.binary io.files
io.streams.byte-array kernel quotations sequences tools.test ;
IN: images.testing
:: encode-test ( path image-class -- )
path binary file-contents 1quotation
[
binary <byte-writer> dup [
path load-image image-class image>stream
] with-output-stream B{ } like
] unit-test ;

View File

@ -0,0 +1,57 @@
! Copyright (C) 2009 Keith Lazuka.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors byte-arrays images.loader images.pam
images.testing io io.encodings.binary io.files
io.streams.byte-array kernel quotations tools.test ;
IN: images.pam.tests
! ----------- Encoder Tests ------------------------------
"vocab:images/testing/pam/rgb1x1.pam" pam-image encode-test
"vocab:images/testing/pam/rgba1x1.pam" pam-image encode-test
"vocab:images/testing/pam/rgb2x2.pam" pam-image encode-test
"vocab:images/testing/pam/rgba2x2.pam" pam-image encode-test
"vocab:images/testing/pam/rgb3x3.pam" pam-image encode-test
"vocab:images/testing/pam/rgba3x3.pam" pam-image encode-test
! ----------- Decoder Tests ------------------------------
! 1x1
[ { 1 1 } ] [ "vocab:images/testing/pam/rgb1x1.pam" load-image dim>> ] unit-test
[ B{ 0 0 0 } ]
[ "vocab:images/testing/pam/rgb1x1.pam" load-image bitmap>> ] unit-test
[ B{ 0 0 0 0 } ]
[ "vocab:images/testing/pam/rgba1x1.pam" load-image bitmap>> ] unit-test
! 2x2
[ { 2 2 } ] [ "vocab:images/testing/pam/rgb2x2.pam" load-image dim>> ] unit-test
[ B{ 0 0 0 255 255 255 255 255 255 0 0 0 } ]
[ "vocab:images/testing/pam/rgb2x2.pam" load-image bitmap>> ] unit-test
[ B{ 0 0 0 255 255 255 255 0 255 255 255 0 0 0 0 255 } ]
[ "vocab:images/testing/pam/rgba2x2.pam" load-image bitmap>> ] unit-test
! 3x3
[
B{
255 0 0 0 255 0 0 0 255
4 252 253 254 1 127 252 253 2
255 255 255 0 0 0 255 255 255
}
]
[ "vocab:images/testing/pam/rgb3x3.pam" load-image bitmap>> ] unit-test
[
B{
255 0 0 255 0 255 0 255 0 0 255 255
4 252 253 255 254 1 127 255 252 253 2 255
255 255 255 255 0 0 0 255 255 255 255 0
}
]
[ "vocab:images/testing/pam/rgba3x3.pam" load-image bitmap>> ] unit-test

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Binary file not shown.