diff -r 8e5a0f125106 -r e5af485c693d RegressionTests__ImageReaderTest.st --- a/RegressionTests__ImageReaderTest.st Fri Mar 04 08:16:39 2016 +0000 +++ b/RegressionTests__ImageReaderTest.st Tue Mar 08 08:02:28 2016 +0000 @@ -1,3 +1,5 @@ +"{ Encoding: utf8 }" + "{ Package: 'exept:regression' }" "{ NameSpace: RegressionTests }" @@ -29,12 +31,12 @@ !ImageReaderTest methodsFor:'tests'! -test001 +test001_bmp |img| - img := Image - fromFile:(self class packageDirectory construct:'testData/test1.bmp'). + img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test1.bmp'). self assert:(img notNil). + self assert:(img depth == 1). "/ img inspect. @@ -43,125 +45,135 @@ self assert:((img colorAtX:0 y:18) rgbValue = 16r40FF40). " - self run:#test01 - self new test01" + self run:#test001_bmp + self new test001_bmp" ! -test002 +test002_bmp |img| - img := Image - fromFile:(self class packageDirectory construct:'testData/test4.bmp'). + img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test4.bmp'). self assert:(img notNil). + self assert:(img depth == 4). + + self assert:((img colorAtX:0 y:15) rgbValue = 16rFF0000). + self assert:((img colorAtX:35 y:15) rgbValue = 16r004000). + self assert:((img colorAtX:35 y:30) rgbValue = 16r008000). + self assert:((img colorAtX:35 y:45) rgbValue = 16r00C000). + self assert:((img colorAtX:35 y:60) rgbValue = 16r00FF00). + self assert:((img colorAtX:70 y:15) rgbValue = 16r0000FF). "/ img inspect. " - self run:#test02 - self new test02" + self run:#test002_bmp + self new test002_bmp" ! -test003 +test003_bmp |img| - img := Image - fromFile:(self class packageDirectory construct:'testData/test8.bmp'). + img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test8.bmp'). self assert:(img notNil). + self assert:(img depth == 8). + self assert:((img colorAtX:30 y:0) rgbValue = 16rFF0000). "/ img inspect " - self run:#test03 - self new test03" + self run:#test003_bmp + self new test003_bmp" ! -test004 +test004_bmp |img| - img := Image fromFile:(self class packageDirectory - construct:'testData/testcompress4.bmp'). + img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/testcompress4.bmp'). self assert:(img notNil). + self assert:(img depth == 4). + self assert:((img colorAtX:0 y:15) rgbValue = 16rFF0000). + self assert:((img colorAtX:35 y:15) rgbValue = 16r004000). + self assert:((img colorAtX:35 y:30) rgbValue = 16r008000). + self assert:((img colorAtX:35 y:45) rgbValue = 16r00C000). + self assert:((img colorAtX:35 y:60) rgbValue = 16r00FF00). + self assert:((img colorAtX:70 y:15) rgbValue = 16r0000FF). "/ img inspect. " - self run:#test04 - self new test04" + self run:#test004_bmp + self new test004_bmp" ! -test005 +test005_bmp |img| - img := Image fromFile:(self class packageDirectory - construct:'testData/testcompress8.bmp'). + img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/testcompress8.bmp'). + self assert:(img notNil). + self assert:(img depth == 8). + self assert:((img colorAtX:30 y:0) rgbValue = 16rFF0000). + + "/ img inspect. + " + self run:#test005_bmp + self new test005_bmp" +! + +test006_bmp + |img| + + img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test8os2.bmp'). self assert:(img notNil). "/ img inspect. " - self run:#test05 - self new test05" + self run:#test006_bmp + self new test006_bmp" ! -test006 +test007_bmp |img| - img := Image - fromFile:(self class packageDirectory construct:'testData/test8os2.bmp'). + img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test4os2v2.bmp'). self assert:(img notNil). "/ img inspect. " - self run:#test06 - self new test06" + self run:#test007_bmp + self new test007_bmp" ! -test007 +test008_bmp |img| - img := Image - fromFile:(self class packageDirectory construct:'testData/test4os2v2.bmp'). + img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test16.bmp'). self assert:(img notNil). "/ img inspect. " - self run:#test07 - self new test07" + self run:#test008_bmp + self new test008_bmp" ! -test008 +test009_bmp |img| - img := Image - fromFile:(self class packageDirectory construct:'testData/test16.bmp'). + img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test24.bmp'). self assert:(img notNil). "/ img inspect. " - self run:#test08 - self new test08" + self run:#test009_bmp + self new test009_bmp" ! -test009 +test010_bmp |img| - img := Image - fromFile:(self class packageDirectory construct:'testData/test24.bmp'). + img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test32.bmp'). self assert:(img notNil). "/ img inspect. " - self run:#test09 - self new test09" -! - -test010 - |img| - - img := Image - fromFile:(self class packageDirectory construct:'testData/test32.bmp'). - self assert:(img notNil). - - "/ img inspect. - " - self run:#test10 - self new test10" + self run:#test010_bmp + self new test010_bmp" ! test101 @@ -233,8 +245,8 @@ self assert:(img notNil). self assert:(img depth == 2). self assert:(img extent = (32@32)). - self assert:(img colorAt:(0@0)) = Color black. - self assert:(img colorAt:(31@31)) = (Color rgbValue:16rAAAAAA). + self assert:(img colorAt:(0@0)) rgbValue = 0. + self assert:(img colorAt:(31@31)) rgbValue = 16rAAAAAA. "/ img inspect. " @@ -245,13 +257,93 @@ "Created: / 05-02-2011 / 10:33:24 / cg" ! -test_png_01 +testPNG_003_basi0g01 |img| + img := Image fromFile:(self class packageDirectory construct:'testData/pngImages/basi0g01.png'). + self assert:(img notNil). + self assert:(img depth == 1). + self assert:(img extent = (32@32)). + self assert:(img colorAt:(0@0)) = Color white. + self assert:(img colorAt:(31@31)) = Color black. + + "/ img inspect. + " + self run:#testPNG_003_basi0g01 + self new testPNG_003_basi0g01 + " + + "Created: / 05-02-2011 / 10:32:32 / cg" +! + +test_bmp_01 + |img allOK| + + allOK := true. + (self class packageDirectory construct:'testData/bmpImages') directoryContentsAsFilenamesDo:[:f | + (f isRegularFile and:[f hasSuffix:'bmp']) ifTrue:[ + Error handle:[:ex | + img := nil. + ] do:[ + img := Image fromFile:f. + ]. + img isNil ifTrue:[ + Transcript printf:'failed: %s\n' with:f baseName. + allOK := false + ]. + ]. + ]. + self assert:allOK. + + " + self run:#test_bmp_01 + self new test_bmp_01 + " +! + +test_bmp_02 + |img allOK| + + allOK := true. + (self class packageDirectory construct:'testData/bmpImages/bmpsuite-2.4') directoryContentsAsFilenamesDo:[:f | + (f isRegularFile and:[f hasSuffix:'bmp']) ifTrue:[ + Error handle:[:ex | + img := nil. + ] do:[ + img := Image fromFile:f. + ]. + img isNil ifTrue:[ + Transcript printf:'failed: %s\n' with:f baseName. + allOK := false + ]. + ]. + ]. + self assert:allOK. + + " + self run:#test_bmp_02 + self new test_bmp_02 + " +! + +test_png_01 + |img allOK| + + allOK := true. (self class packageDirectory construct:'testData/pngImages') directoryContentsAsFilenamesDo:[:f | - img := Image fromFile:f. - self assert:(img notNil). + (f isRegularFile and:[f hasSuffix:'png']) ifTrue:[ + Error handle:[:ex | + img := nil. + ] do:[ + img := Image fromFile:f. + ]. + img isNil ifTrue:[ + Transcript printf:'failed: %s\n' with:f baseName. + allOK := false + ]. + ]. ]. + self assert:allOK. " self run:#test_png_01 @@ -292,3 +384,4 @@ version_CVS ^ '$Header$' ! ! +