RegressionTests__ImageReaderTest.st
author Claus Gittinger <cg@exept.de>
Tue, 08 Mar 2016 18:21:10 +0100
changeset 1341 f42d73c20ffa
parent 1340 bfb577a84a73
child 1342 295feea62309
permissions -rw-r--r--
#BUGFIX class: RegressionTests::ImageReaderTest comment/format in: #test_png_01
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1341
f42d73c20ffa #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
     1
"{ Encoding: utf8 }"
f42d73c20ffa #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
     2
356
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"{ Package: 'exept:regression' }"
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
"{ NameSpace: RegressionTests }"
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
TestCase subclass:#ImageReaderTest
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
	instanceVariableNames:''
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
	classVariableNames:''
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
	poolDictionaries:''
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
	category:'tests-Regression'
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
!
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
!ImageReaderTest class methodsFor:'documentation'!
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
documentation
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
"
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
    documentation to be added.
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
    [author:]
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
        cg (cg@AQUA-DUO)
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
    [instance variables:]
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
    [class variables:]
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
    [see also:]
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
"
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
! !
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
!ImageReaderTest methodsFor:'tests'!
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    34
test001_bmp
356
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
    |img|
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    37
    img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test1.bmp').
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    38
    self assert:(img notNil).
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    39
    self assert:(img depth == 1).
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
    40
    
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    41
    "/ img inspect.
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
    42
    
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    43
    self assert:((img colorAtX:0 y:0) rgbValue = 16r4040FF).
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    44
    self assert:((img colorAtX:0 y:63) rgbValue = 16r4040FF).
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    45
    self assert:((img colorAtX:0 y:18) rgbValue = 16r40FF40).
356
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    "
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    48
     self run:#test001_bmp
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    49
     self new test001_bmp"
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    50
!
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    51
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    52
test002_bmp
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    53
    |img|
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    54
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    55
    img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test4.bmp').
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    56
    self assert:(img notNil).
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    57
    self assert:(img depth == 4).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    58
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    59
    self assert:((img colorAtX:0 y:15) rgbValue = 16rFF0000).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    60
    self assert:((img colorAtX:35 y:15) rgbValue = 16r004000).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    61
    self assert:((img colorAtX:35 y:30) rgbValue = 16r008000).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    62
    self assert:((img colorAtX:35 y:45) rgbValue = 16r00C000).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    63
    self assert:((img colorAtX:35 y:60) rgbValue = 16r00FF00).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    64
    self assert:((img colorAtX:70 y:15) rgbValue = 16r0000FF).
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
    65
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    66
    "/ img inspect.
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    67
    "
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    68
     self run:#test002_bmp
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    69
     self new test002_bmp"
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    70
!
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    71
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    72
test003_bmp
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    73
    |img|
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    74
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    75
    img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test8.bmp').
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    76
    self assert:(img notNil).
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    77
    self assert:(img depth == 8).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    78
    self assert:((img colorAtX:30 y:0) rgbValue = 16rFF0000).
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
    79
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    80
    "/ img inspect
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    81
    "
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    82
     self run:#test003_bmp
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    83
     self new test003_bmp"
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    84
!
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    85
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    86
test004_bmp
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    87
    |img|
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    88
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    89
    img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/testcompress4.bmp').
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    90
    self assert:(img notNil).
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    91
    self assert:(img depth == 4).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    92
    self assert:((img colorAtX:0 y:15) rgbValue = 16rFF0000).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    93
    self assert:((img colorAtX:35 y:15) rgbValue = 16r004000).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    94
    self assert:((img colorAtX:35 y:30) rgbValue = 16r008000).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    95
    self assert:((img colorAtX:35 y:45) rgbValue = 16r00C000).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    96
    self assert:((img colorAtX:35 y:60) rgbValue = 16r00FF00).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
    97
    self assert:((img colorAtX:70 y:15) rgbValue = 16r0000FF).
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
    98
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
    99
    "/ img inspect.
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   100
    "
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   101
     self run:#test004_bmp
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   102
     self new test004_bmp"
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   103
!
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   104
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   105
test005_bmp
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   106
    |img|
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   107
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   108
    img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/testcompress8.bmp').
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   109
    self assert:(img notNil).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   110
    self assert:(img depth == 8).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   111
    self assert:((img colorAtX:30 y:0) rgbValue = 16rFF0000).
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   112
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   113
    "/ img inspect.
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   114
    "
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   115
     self run:#test005_bmp
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   116
     self new test005_bmp"
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   117
!
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   118
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   119
test006_bmp
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   120
    |img|
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   121
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   122
    img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test8os2.bmp').
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   123
    self assert:(img notNil).
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   124
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   125
    "/ img inspect.
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   126
    "
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   127
     self run:#test006_bmp
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   128
     self new test006_bmp"
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   129
!
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   130
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   131
test007_bmp
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   132
    |img|
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   133
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   134
    img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test4os2v2.bmp').
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   135
    self assert:(img notNil).
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   136
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   137
    "/ img inspect.
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   138
    "
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   139
     self run:#test007_bmp
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   140
     self new test007_bmp"
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   141
!
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   142
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   143
test008_bmp
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   144
    |img|
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   145
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   146
    img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test16.bmp').
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   147
    self assert:(img notNil).
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   148
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   149
    "/ img inspect.
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   150
    "
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   151
     self run:#test008_bmp
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   152
     self new test008_bmp"
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   153
!
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   154
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   155
test009_bmp
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   156
    |img|
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   157
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   158
    img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test24.bmp').
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   159
    self assert:(img notNil).
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   160
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   161
    "/ img inspect.
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   162
    "
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   163
     self run:#test009_bmp
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   164
     self new test009_bmp"
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   165
!
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   166
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   167
test010_bmp
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   168
    |img|
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   169
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   170
    img := Image fromFile:(self class packageDirectory construct:'testData/bmpImages/test32.bmp').
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   171
    self assert:(img notNil).
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   172
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   173
    "/ img inspect.
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   174
    "
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   175
     self run:#test010_bmp
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   176
     self new test010_bmp"
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   177
!
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   178
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   179
test101
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   180
    |alpha s bits img|
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   181
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   182
    img := Depth32Image width:16 height:16.
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   183
    alpha := #[
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   184
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   185
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   186
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   187
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   188
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   189
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   190
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   191
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   192
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   193
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   194
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   195
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   196
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   197
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   198
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   199
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   200
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   201
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   202
                    0 0 0 0 63 63 63 63 127 127 127 127 255 255 255 255
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   203
              ].
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   204
    s := WriteStream on:#[].
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   205
    alpha do:[:a |
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   206
        s nextPut:127.    "/ r
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   207
        s nextPut:127.    "/ g
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   208
        s nextPut:127.    "/ b
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   209
        s nextPut:a.    
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   210
    ].
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   211
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   212
    bits := (s contents).
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   213
    img bits:bits.
699
3316cd60b7c2 changed: #test101
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
   214
    "/ img inspect.
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   215
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   216
    "
526
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   217
     self run:#test101
5494927465be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   218
     self new test101
357
01c5f0c27106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 356
diff changeset
   219
    "
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   220
!
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   221
576
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   222
testPNG_001_basn0g01
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   223
    |img|
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   224
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   225
    img := Image fromFile:(self class packageDirectory construct:'testData/pngImages/basn0g01.png').
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   226
    self assert:(img notNil).
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   227
    self assert:(img depth == 1).
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   228
    self assert:(img extent = (32@32)).
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   229
    self assert:(img colorAt:(0@0)) = Color white.
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   230
    self assert:(img colorAt:(31@31)) = Color black.
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   231
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   232
    "/ img inspect.
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   233
    "
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   234
     self run:#testPNG_001_basn0g01
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   235
     self new testPNG_001_basn0g01
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   236
    "
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   237
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   238
    "Created: / 05-02-2011 / 10:32:32 / cg"
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   239
!
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   240
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   241
testPNG_002_basn0g02
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   242
    |img|
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   243
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   244
    img := Image fromFile:(self class packageDirectory construct:'testData/pngImages/basn0g02.png').
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   245
    self assert:(img notNil).
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   246
    self assert:(img depth == 2).
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   247
    self assert:(img extent = (32@32)).
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   248
    self assert:(img colorAt:(0@0)) rgbValue = 0.
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   249
    self assert:(img colorAt:(31@31)) rgbValue = 16rAAAAAA.
576
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   250
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   251
    "/ img inspect.
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   252
    "
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   253
     self run:#testPNG_002_basn0g02
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   254
     self new testPNG_002_basn0g02
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   255
    "
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   256
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   257
    "Created: / 05-02-2011 / 10:33:24 / cg"
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   258
!
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   259
1339
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   260
testPNG_003_basi0g01
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   261
    |img|
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   262
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   263
    img := Image fromFile:(self class packageDirectory construct:'testData/pngImages/basi0g01.png').
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   264
    self assert:(img notNil).
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   265
    self assert:(img depth == 1).
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   266
    self assert:(img extent = (32@32)).
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   267
    self assert:(img colorAt:(0@0)) = Color white.
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   268
    self assert:(img colorAt:(31@31)) = Color black.
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   269
    "/ img inspect.
1339
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   270
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   271
    "
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   272
     self run:#testPNG_003_basi0g01
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   273
     self new testPNG_003_basi0g01
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   274
    "
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   275
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   276
    "Created: / 05-02-2011 / 10:32:32 / cg"
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   277
!
fe9f7d42c564 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
   278
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   279
test_bmp_01
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   280
    |img allOK failed|
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   281
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   282
    failed := OrderedCollection new.
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   283
    allOK := true.
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   284
    (self class packageDirectory construct:'testData/bmpImages') directoryContentsAsFilenamesDo:[:f |
1334
7361d2e60e51 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   285
        (f isRegularFile and:[f hasSuffix:'bmp']) ifTrue:[
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   286
            Error handle:[:ex |
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   287
                img := nil.
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   288
            ] do:[
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   289
                img := Image fromFile:f.
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   290
            ].
1334
7361d2e60e51 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   291
            img isNil ifTrue:[ 
7361d2e60e51 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   292
                Transcript printf:'failed: %s\n' with:f baseName.
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   293
                allOK := false.
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   294
                failed add:f baseName.
1334
7361d2e60e51 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   295
            ].                
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   296
        ].
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   297
    ].
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   298
    self assert:allOK description:('failed to read: %s' printfWith:(failed asStringWith:', ')).
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   299
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   300
    "
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   301
     self run:#test_bmp_01
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   302
     self new test_bmp_01
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   303
    "
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   304
!
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   305
1338
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   306
test_bmp_02
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   307
    |img allOK failed|
1338
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   308
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   309
    failed := OrderedCollection new.
1338
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   310
    allOK := true.
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   311
    (self class packageDirectory construct:'testData/bmpImages/bmpsuite-2.4') directoryContentsAsFilenamesDo:[:f |
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   312
        (f isRegularFile and:[f hasSuffix:'bmp']) ifTrue:[
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   313
            Error handle:[:ex |
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   314
                img := nil.
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   315
            ] do:[
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   316
                img := Image fromFile:f.
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   317
            ].
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   318
            img isNil ifTrue:[ 
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   319
                Transcript printf:'failed: %s\n' with:f baseName.
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   320
                allOK := false.
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   321
                failed add:f baseName.
1338
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   322
            ].                
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   323
        ].
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   324
    ].
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   325
    self assert:allOK description:('failed to read: %s' printfWith:(failed asStringWith:', ')).
1338
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   326
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   327
    "
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   328
     self run:#test_bmp_02
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   329
     self new test_bmp_02
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   330
    "
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   331
!
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   332
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   333
test_png_01
1341
f42d73c20ffa #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   334
    "/ currently, 4 files fail;
f42d73c20ffa #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   335
    "/ these are greyscale+alpha images
f42d73c20ffa #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   336
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   337
    |img allOK failed|
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   338
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   339
    failed := OrderedCollection new.
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   340
    allOK := true.
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   341
    (self class packageDirectory construct:'testData/pngImages') directoryContentsAsFilenamesDo:[:f |
1334
7361d2e60e51 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   342
        (f isRegularFile and:[f hasSuffix:'png']) ifTrue:[
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   343
            img := nil.
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   344
            (f baseName startsWith:'x') ifTrue:[
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   345
                "/ should fail
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   346
                self should:[ img := Image fromFile:f ] raise:(Image badImageFormatQuerySignal).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   347
                self assert:img == nil.
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   348
            ] ifFalse:[    
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   349
                Error handle:[:ex |
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   350
                    img := nil.
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   351
                ] do:[
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   352
                    img := Image fromFile:f.
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   353
                ].    
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   354
                img isNil ifTrue:[ 
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   355
                    Transcript printf:'failed: %s\n' with:f baseName.
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   356
                    allOK := false.
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   357
                    failed add:f baseName.
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   358
                ].
1334
7361d2e60e51 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   359
            ].
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   360
        ].
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   361
    ].
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   362
    self assert:allOK description:('failed to read: %s' printfWith:(failed asStringWith:', ')).
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   363
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   364
    "
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   365
     self run:#test_png_01
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   366
     self new test_png_01
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   367
    "
1341
f42d73c20ffa #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   368
f42d73c20ffa #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   369
    "Modified (comment): / 08-03-2016 / 18:21:01 / cg"
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   370
!
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   371
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   372
test_png_02
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   373
    |referenceImg img|
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   374
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   375
    img := Image fromFile:(self class packageDirectory construct:'testData/pngImages/basn0g01.png').
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   376
    self assert:(img notNil).
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   377
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   378
    referenceImg := (Depth1Image new) width: 32; height: 32; 
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   379
                            photometric:(#palette); 
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   380
                            bitsPerSample:(#[1]); 
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   381
                            samplesPerPixel:(1); 
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   382
                            bits:(ByteArray fromPackedString:'
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   383
?????/????3????8????<OO3?>C3<??@<?O? OL3?0C3L?8@<3O<@O G>@C8A?@@?L? @O3O0@C??8@@??<@@O?>@@C??@@@?? O8O?0C>C?8@00?<@LLO>@
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   384
C>C?@@? ? @LLO0@CCC8@@? <@@O8N@@@@C@@@@@ @@@@@@@@@@b') ; 
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   385
                            colorMapFromArray:#[0 0 0 255 255 255]; 
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   386
                            yourself.
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   387
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   388
    self assert:(img bits = referenceImg bits).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   389
    self assert:(img width = referenceImg width).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   390
    self assert:(img height = referenceImg height).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   391
    self assert:(img depth = referenceImg depth).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   392
    self assert:(img bitsPerSample asArray = referenceImg bitsPerSample asArray).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   393
    self assert:(img samplesPerPixel = referenceImg samplesPerPixel).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   394
    self assert:(img colorFromValue:0) = (referenceImg colorFromValue:0).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   395
    self assert:(img colorFromValue:1) = (referenceImg colorFromValue:1).
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   396
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   397
    "
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   398
     self run:#test_png_02
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   399
     self new test_png_02
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   400
    "
356
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   401
! !
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
!ImageReaderTest class methodsFor:'documentation'!
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
version
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
    ^ '$Header$'
576
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   407
!
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   408
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   409
version_CVS
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   410
    ^ '$Header$'
356
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
! !
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   412