RegressionTests__ImageReaderTest.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 18:53:03 +0200
changeset 2327 bf482d49aeaf
parent 2146 30dfe8a8c589
permissions -rw-r--r--
#QUALITY by exept class: RegressionTests::StringTests added: #test82c_expanding
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2146
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
     1
"{ Encoding: utf8 }"
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
     2
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
     3
"{ Package: 'stx:goodies/regression' }"
356
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:''
2146
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
    11
	category:'tests-Regression-File Formats'
356
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:]
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
    21
	cg (cg@AQUA-DUO)
356
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
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
    37
    img := Image fromFile:(Helper packageDirectoryForRegressionTests 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).
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
    "/ img inspect.
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1342
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
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
    55
    img := Image fromFile:(Helper packageDirectoryForRegressionTests 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
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
    75
    img := Image fromFile:(Helper packageDirectoryForRegressionTests 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
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
    89
    img := Image fromFile:(Helper packageDirectoryForRegressionTests 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
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   108
    img := Image fromFile:(Helper packageDirectoryForRegressionTests construct:'testData/bmpImages/testcompress8.bmp').
1326
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
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   122
    img := Image fromFile:(Helper packageDirectoryForRegressionTests 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
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   134
    img := Image fromFile:(Helper packageDirectoryForRegressionTests 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
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   146
    img := Image fromFile:(Helper packageDirectoryForRegressionTests 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
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   158
    img := Image fromFile:(Helper packageDirectoryForRegressionTests 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
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   170
    img := Image fromFile:(Helper packageDirectoryForRegressionTests 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 := #[
1447
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
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
   186
		    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
   187
		    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
   188
1447
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
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
   191
		    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
   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
1447
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
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
   196
		    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
   197
		    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
   198
1447
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
		    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
   202
		    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
   203
	      ].
526
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 |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
   206
	s nextPut:127.    "/ r
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
   207
	s nextPut:127.    "/ g
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
   208
	s nextPut:127.    "/ b
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
   209
	s nextPut:a.
526
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
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   225
    img := Image fromFile:(Helper packageDirectoryForRegressionTests construct:'testData/pngImages/basn0g01.png').
576
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
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   244
    img := Image fromFile:(Helper packageDirectoryForRegressionTests construct:'testData/pngImages/basn0g02.png').
576
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
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   263
    img := Image fromFile:(Helper packageDirectoryForRegressionTests construct:'testData/pngImages/basi0g01.png').
1339
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
1593
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   279
testPNG_004_tbbn0g04
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   280
    "a grayscale image with mask"
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   281
    
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   282
    |img|
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   283
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   284
    img := Image fromFile:(Helper packageDirectoryForRegressionTests construct:'testData/pngImages/tbbn0g04.png').
1593
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   285
    self assert:(img notNil).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   286
    self assert:(img depth == 4).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   287
    self assert:(img extent = (32@32)).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   288
    self assert:(img photometric = #blackIs0).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   289
    self assert:(img mask notNil).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   290
    "/ img inspect.
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   291
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   292
    "
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   293
     self run:#testPNG_004_tbbn0g04
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   294
     self new testPNG_004_tbbn0g04
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   295
    "
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   296
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   297
    "Created: / 17-02-2017 / 14:11:44 / cg"
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   298
!
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   299
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   300
testPNG_004_tbbn3p03
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   301
    |img|
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   302
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   303
    img := Image fromFile:(Helper packageDirectoryForRegressionTests construct:'testData/pngImages/tbbn0g04.png').
1593
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   304
    self assert:(img notNil).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   305
    self assert:(img depth == 4).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   306
    self assert:(img extent = (32@32)).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   307
    self assert:(img photometric = #blackIs0).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   308
    self assert:(img mask notNil).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   309
    "/ img inspect.
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   310
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   311
    "
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   312
     self run:#testPNG_004_tbbn0g04
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   313
     self new testPNG_004_tbbn0g04
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   314
    "
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   315
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   316
    "Created: / 17-02-2017 / 14:12:55 / cg"
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   317
!
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   318
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   319
testPNG_005_tbbn3p08
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   320
    "a palette image with mask"
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   321
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   322
    |img|
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   323
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   324
    img := Image fromFile:(Helper packageDirectoryForRegressionTests construct:'testData/pngImages/tbbn3p08.png').
1593
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   325
    self assert:(img notNil).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   326
    self assert:(img depth == 8).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   327
    self assert:(img extent = (32@32)).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   328
    self assert:(img photometric = #palette).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   329
    self assert:(img mask notNil).
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   330
    "/ img inspect.
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   331
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   332
    "
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   333
     self run:#testPNG_005_tbbn3p08
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   334
     self new testPNG_005_tbbn3p08
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   335
    "
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   336
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   337
    "Created: / 17-02-2017 / 14:13:50 / cg"
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   338
!
187438322e6c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   339
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   340
test_bmp_01
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   341
    |img allOK failed|
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   342
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   343
    failed := OrderedCollection new.
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   344
    allOK := true.
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   345
    (Helper packageDirectoryForRegressionTests construct:'testData/bmpImages') directoryContentsAsFilenamesDo:[:f |
1838
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   346
        (f isRegularFile and:[f hasSuffix:'bmp']) ifTrue:[
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   347
            Error handle:[:ex |
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   348
                img := nil.
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   349
            ] do:[
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   350
                img := Image fromFile:f.
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   351
            ].
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   352
            img isNil ifTrue:[
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   353
                Transcript printf:'failed: %s\n' with:f baseName.
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   354
                allOK := false.
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   355
                failed add:f baseName.
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   356
            ].
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   357
        ].
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   358
    ].
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   359
    self assert:allOK description:('failed to read: %s' printfWith:(failed asStringWith:', ')).
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   360
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   361
    "
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   362
     self run:#test_bmp_01
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   363
     self new test_bmp_01
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   364
    "
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   365
!
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   366
1338
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   367
test_bmp_02
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   368
    |img allOK failed|
1338
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   369
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   370
    failed := OrderedCollection new.
1338
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   371
    allOK := true.
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   372
    (Helper packageDirectoryForRegressionTests construct:'testData/bmpImages/bmpsuite-2.4') directoryContentsAsFilenamesDo:[:f |
1838
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   373
        (f isRegularFile and:[f hasSuffix:'bmp']) ifTrue:[
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   374
            Error handle:[:ex |
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   375
                img := nil.
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   376
            ] do:[
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   377
                img := Image fromFile:f.
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   378
            ].
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   379
            img isNil ifTrue:[
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   380
                Transcript printf:'failed: %s\n' with:f baseName.
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   381
                allOK := false.
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   382
                failed add:f baseName.
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   383
            ].
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   384
        ].
1338
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   385
    ].
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   386
    self assert:allOK description:('failed to read: %s' printfWith:(failed asStringWith:', ')).
1338
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   387
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   388
    "
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   389
     self run:#test_bmp_02
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   390
     self new test_bmp_02
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   391
    "
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   392
!
9e39590870b2 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   393
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   394
test_png_01
1341
f42d73c20ffa #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   395
    "/ currently, 4 files fail;
f42d73c20ffa #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   396
    "/ these are greyscale+alpha images
f42d73c20ffa #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   397
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   398
    |img allOK failed|
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   399
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   400
    failed := OrderedCollection new.
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   401
    allOK := true.
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   402
    (Helper packageDirectoryForRegressionTests construct:'testData/pngImages') directoryContentsAsFilenamesDo:[:f |
1591
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   403
        (f isRegularFile and:[f hasSuffix:'png']) ifTrue:[
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   404
            img := nil.
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   405
            (f baseName startsWith:'x') ifTrue:[
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   406
                "/ should fail
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   407
                self should:[ img := Image fromFile:f ] raise:(Image badImageFormatQuerySignal).
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   408
                self assert:img == nil.
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   409
            ] ifFalse:[
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   410
                Error handle:[:ex |
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   411
                    Transcript printf:'PNG failed: %s (%s)\n' with:f baseName with:ex description.
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   412
                    img := nil.
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   413
                ] do:[
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   414
                    img := Image fromFile:f.
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   415
                ].
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   416
                img isNil ifTrue:[
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   417
                    allOK := false.
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   418
                    failed add:f baseName.
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   419
                    "/ self halt.
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   420
                    "/ img := Image fromFile:f.
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   421
                ].
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   422
            ].
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   423
        ].
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   424
    ].
1342
295feea62309 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   425
    "/ self assert:allOK description:('failed to read: %s' printfWith:(failed asStringWith:', ')).
295feea62309 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   426
    allOK ifFalse:[
1591
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   427
        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
   428
    ].
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   429
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   430
    "
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   431
     self run:#test_png_01
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   432
     self new test_png_01
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   433
    "
1341
f42d73c20ffa #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   434
1591
cbe7313a8c69 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   435
    "Modified: / 17-02-2017 / 11:36:53 / cg"
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   436
!
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   437
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   438
test_png_02
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   439
    |referenceImg img|
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   440
1841
c17fef15c434 #REFACTORING by sr
sr
parents: 1838
diff changeset
   441
    img := Image fromFile:(Helper packageDirectoryForRegressionTests construct:'testData/pngImages/basn0g01.png').
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   442
    self assert:(img notNil).
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   443
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1342
diff changeset
   444
    referenceImg := (Depth1Image new) width: 32; height: 32;
1838
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   445
                            photometric:(#palette);
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   446
                            bitsPerSample:(#[1]);
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   447
                            samplesPerPixel:(1);
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   448
                            bits:(ByteArray fromPackedString:'
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   449
?????/????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
   450
C>C?@@? ? @LLO0@CCC8@@? <@@O8N@@@@C@@@@@ @@@@@@@@@@b') ;
1838
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   451
                            colorMapFromArray:#[0 0 0 255 255 255];
152bdbf36c77 #BUGFIX by sr
sr
parents: 1777
diff changeset
   452
                            yourself.
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   453
1340
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   454
    self assert:(img bits = referenceImg bits).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   455
    self assert:(img width = referenceImg width).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   456
    self assert:(img height = referenceImg height).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   457
    self assert:(img depth = referenceImg depth).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   458
    self assert:(img bitsPerSample asArray = referenceImg bitsPerSample asArray).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   459
    self assert:(img samplesPerPixel = referenceImg samplesPerPixel).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   460
    self assert:(img colorFromValue:0) = (referenceImg colorFromValue:0).
bfb577a84a73 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
   461
    self assert:(img colorFromValue:1) = (referenceImg colorFromValue:1).
382
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   462
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   463
    "
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   464
     self run:#test_png_02
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   465
     self new test_png_02
25933e1d5a67 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
   466
    "
1694
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   467
!
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   468
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   469
test_save_1BitPaletteImage
1695
6c4f02c25e07 #OTHER by mawalch
mawalch
parents: 1694
diff changeset
   470
    |testImage readerImage
1694
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   471
     testView expectedImage gotFromReaderImage|
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   472
2146
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
   473
    self skip:'some image formats read back different images; needs fix'.
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
   474
    
1777
9259359fd6f2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
   475
    true "Display isNil" ifTrue:[
1697
70f420537e44 #QUALITY by mawalch
mawalch
parents: 1696
diff changeset
   476
        self skip.
70f420537e44 #QUALITY by mawalch
mawalch
parents: 1696
diff changeset
   477
    ].
70f420537e44 #QUALITY by mawalch
mawalch
parents: 1696
diff changeset
   478
1694
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   479
    "/ a palette; with white at0, black at 1
1695
6c4f02c25e07 #OTHER by mawalch
mawalch
parents: 1694
diff changeset
   480
    testImage := (Depth1Image width:32 height:32)
1694
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   481
                        bits:(ByteArray fromPackedString:'
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   482
@@@@@P@@@@L@@@@G@@@@C00L@A<LC@@?C@0@_03L@O<L3@G?CL0C?0_8A?<G>@??@3@_?0L0O?<@@G??@@C??0@A??<@@???@@_0G0@O<A<@G?OO@C?330A?
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   483
<A<@??@_@_?330O?<<<G??@_C??0G1????<?????_?????????<b')
1695
6c4f02c25e07 #OTHER by mawalch
mawalch
parents: 1694
diff changeset
   484
                        colorMapFromArray:#[255 255 255 0 0 0];
1694
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   485
                        yourself.
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   486
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   487
    "/ generate the reference (expected)
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   488
    testView := View new origin:10@10 corner:100@100.
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   489
    testView viewBackground:Color red.
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   490
    testView openAndWait.
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   491
    testView clear.
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   492
    testImage displayOpaqueOn:testView x:5 y:5.
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   493
    expectedImage := Image fromView:testView.
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   494
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   495
    "/ save in various formats
1695
6c4f02c25e07 #OTHER by mawalch
mawalch
parents: 1694
diff changeset
   496
    #( 'bmp' 'png' 'tiff' 'pbm' ) do:[:suffix |
1694
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   497
        testImage saveOn:('/tmp/test.',suffix).
1695
6c4f02c25e07 #OTHER by mawalch
mawalch
parents: 1694
diff changeset
   498
        "/ read - they all must generate the same...
1694
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   499
        readerImage := Image fromFile:('/tmp/test.',suffix).
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   500
        "/ ...when drawn into a window
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   501
        testView clear.
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   502
        readerImage displayOpaqueOn:testView x:5 y:5.
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   503
1695
6c4f02c25e07 #OTHER by mawalch
mawalch
parents: 1694
diff changeset
   504
        "/ readout
1694
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   505
        gotFromReaderImage := Image fromView:testView.
2146
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
   506
        expectedImage photometric = gotFromReaderImage photometric ifFalse:[
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
   507
            Transcript showCR:'saved photometric: %1; read photometric: %2' with:expectedImage photometric with:gotFromReaderImage photometric.
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
   508
        ].
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
   509
        expectedImage depth = gotFromReaderImage depth ifFalse:[
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
   510
            Transcript showCR:'saved depth: %1; read depth: %2' with:expectedImage depth with:gotFromReaderImage depth.
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
   511
            gotFromReaderImage := (Image implementorForDepth:expectedImage depth) fromImage:gotFromReaderImage
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
   512
        ].
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
   513
        
1694
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   514
        (expectedImage bits = gotFromReaderImage bits) ifFalse:[
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   515
            "/ expectedImage bits indexOfFirstDifferenceWith:gotFromReaderImage bits.
1695
6c4f02c25e07 #OTHER by mawalch
mawalch
parents: 1694
diff changeset
   516
6c4f02c25e07 #OTHER by mawalch
mawalch
parents: 1694
diff changeset
   517
            DiffTextView
6c4f02c25e07 #OTHER by mawalch
mawalch
parents: 1694
diff changeset
   518
                openOn:(' ' split:expectedImage bits printString) label:'expected'
2146
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
   519
                and:(' ' split:gotFromReaderImage bits printString) label:('from ',suffix).
1694
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   520
            self assert:false.
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   521
        ].
1695
6c4f02c25e07 #OTHER by mawalch
mawalch
parents: 1694
diff changeset
   522
    ].
1694
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   523
1696
3397badfbdb6 #QUALITY by mawalch
mawalch
parents: 1695
diff changeset
   524
    testView close.
1697
70f420537e44 #QUALITY by mawalch
mawalch
parents: 1696
diff changeset
   525
"/self halt.
1695
6c4f02c25e07 #OTHER by mawalch
mawalch
parents: 1694
diff changeset
   526
1694
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   527
    "
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   528
     self run:#test_save_1BitPaletteImage
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   529
     self new test_save_1BitPaletteImage
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   530
    "
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   531
05b9b2d48573 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1593
diff changeset
   532
    "Created: / 31-08-2017 / 19:09:35 / cg"
1697
70f420537e44 #QUALITY by mawalch
mawalch
parents: 1696
diff changeset
   533
    "Modified: / 06-09-2017 / 15:51:38 / mawalch"
1777
9259359fd6f2 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
   534
    "Modified: / 10-10-2017 / 17:45:40 / cg"
2146
30dfe8a8c589 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2044
diff changeset
   535
    "Modified: / 24-03-2019 / 13:27:21 / Claus Gittinger"
356
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
! !
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
!ImageReaderTest class methodsFor:'documentation'!
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
version
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
    ^ '$Header$'
576
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   542
!
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   543
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   544
version_CVS
0cbc67ca4ab3 png stuff
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   545
    ^ '$Header$'
356
3f420735d670 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
! !
1326
3497aa4bf680 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 699
diff changeset
   547