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