RegressionTests__ImageTests.st
author Claus Gittinger <cg@exept.de>
Tue, 25 Feb 2020 17:19:49 +0100
changeset 2586 7dc7be5a6f3d
parent 2565 13ca115a1cee
permissions -rw-r--r--
#OTHER by cg s
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1678
82d861aedadd initial checkin
mawalch
parents:
diff changeset
     1
"{ Package: 'stx:goodies/regression' }"
82d861aedadd initial checkin
mawalch
parents:
diff changeset
     2
82d861aedadd initial checkin
mawalch
parents:
diff changeset
     3
"{ NameSpace: RegressionTests }"
82d861aedadd initial checkin
mawalch
parents:
diff changeset
     4
82d861aedadd initial checkin
mawalch
parents:
diff changeset
     5
TestCase subclass:#ImageTests
82d861aedadd initial checkin
mawalch
parents:
diff changeset
     6
	instanceVariableNames:''
82d861aedadd initial checkin
mawalch
parents:
diff changeset
     7
	classVariableNames:''
82d861aedadd initial checkin
mawalch
parents:
diff changeset
     8
	poolDictionaries:''
2565
13ca115a1cee #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 2337
diff changeset
     9
	category:'tests-Regression-Graphics-Images'
1678
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    10
!
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    11
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    12
!ImageTests class methodsFor:'documentation'!
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    13
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    14
documentation
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    15
"
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    16
    Tests for the image classes in libview, i.e. Image,
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    17
    Depth1Image, Depth2Image, etc.
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    18
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    19
    [author:]
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    20
        mawalch
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    21
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    22
    [instance variables:]
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    23
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    24
    [class variables:]
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    25
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    26
    [see also:]
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    27
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    28
"
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    29
! !
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    30
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    31
!ImageTests methodsFor:'tests'!
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    32
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    33
test01_PixelValue1
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    34
    |img|
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    35
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    36
    img := Image extent:1@1 depth:24.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    37
    img photometric:#rgb. "/ that is: ignored,r,g,b    
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    38
    img createPixelStore.
1678
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    39
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    40
    self assert:(img bits at:1) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    41
    self assert:(img bits at:2) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    42
    self assert:(img bits at:3) == 0.
1678
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    43
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    44
    img pixelAtX:0 y:0 put:16rFF0000.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    45
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    46
    self assert:(img bits at:1) == 16rFF.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    47
    self assert:(img bits at:2) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    48
    self assert:(img bits at:3) == 0.
1678
82d861aedadd initial checkin
mawalch
parents:
diff changeset
    49
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    50
    "/ ----------------------------------
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    51
    
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    52
    img := Image extent:1@1 depth:32.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    53
    img photometric:#rgb. "/ that is: ignored,r,g,b    
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    54
    img createPixelStore.
1686
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
    55
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    56
    self assert:(img bits at:1) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    57
    self assert:(img bits at:2) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    58
    self assert:(img bits at:3) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    59
    self assert:(img bits at:4) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    60
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    61
    img pixelAtX:0 y:0 put:16rFF0000.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    62
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    63
    self assert:(img bits at:1) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    64
    self assert:(img bits at:2) == 16rFF.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    65
    self assert:(img bits at:3) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    66
    self assert:(img bits at:4) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    67
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    68
    "Created: / 22-08-2017 / 18:43:04 / cg"
1686
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
    69
!
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
    70
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    71
test02_PixelColor
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
    72
    |img bytes|
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    73
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    74
    img := Image extent:1@1 depth:24.
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
    75
    img photometric:#rgb. "/ that is: r,g,b    
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    76
    img createPixelStore.
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
    77
    bytes := img bits.
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
    78
    
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
    79
    self assert:(bytes at:1) == 0.
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
    80
    self assert:(bytes at:2) == 0.
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
    81
    self assert:(bytes at:3) == 0.
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    82
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    83
    img colorAtX:0 y:0 put:(Color red).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    84
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
    85
    self assert:(bytes at:1) == 16rFF.
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
    86
    self assert:(bytes at:2) == 0.
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
    87
    self assert:(bytes at:3) == 0.
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    88
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    89
    "/ ----------------------------------
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    90
    
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    91
    img := Image extent:1@1 depth:32.
2335
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
    92
    img photometric:#rgb. "/ that is: r,g,b, ignoredAlpha    
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
    93
    img createPixelStore.
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
    94
    bytes := img bits.
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
    95
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
    96
    self assert:(bytes at:1) == 0.
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
    97
    self assert:(bytes at:2) == 0.
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
    98
    self assert:(bytes at:3) == 0.
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
    99
    self assert:(bytes at:4) == 0.
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   100
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   101
    img colorAtX:0 y:0 put:(Color red).
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   102
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   103
    self assert:(bytes at:1) == 16rFF.  "/ red
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   104
    self assert:(bytes at:2) == 0. 
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   105
    self assert:(bytes at:3) == 0.
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   106
    self assert:(bytes at:4) == 0.      "/ alpha - ignored and 0
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   107
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   108
    img colorAtX:0 y:0 put:(Color green).
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   109
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   110
    self assert:(bytes at:1) == 0.     
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   111
    self assert:(bytes at:2) == 16rFF.  "/ green
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   112
    self assert:(bytes at:3) == 0.
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   113
    self assert:(bytes at:4) == 0.      "/ alpha - ignored and 0
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   114
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   115
    img colorAtX:0 y:0 put:(Color blue).
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   116
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   117
    self assert:(bytes at:1) == 0.     
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   118
    self assert:(bytes at:2) == 0.
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   119
    self assert:(bytes at:3) == 16rFF.  "/ blue
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   120
    self assert:(bytes at:4) == 0.      "/ alpha - ignored and 0
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   121
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   122
    "/ ----------------------------------
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   123
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   124
    img := Image extent:1@1 depth:32.
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   125
    img photometric:#xrgb. "/ that is: alpha,r,g,b    
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   126
    img createPixelStore.
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   127
    bytes := img bits.
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   128
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   129
    self assert:(bytes at:1) == 0.
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   130
    self assert:(bytes at:2) == 0.
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   131
    self assert:(bytes at:3) == 0.
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   132
    self assert:(bytes at:4) == 0.
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   133
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   134
    img colorAtX:0 y:0 put:(Color red).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   135
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   136
    self assert:(bytes at:1) == 0.     "/ alpha - ignored and 0
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   137
    self assert:(bytes at:2) == 16rFF. "/ red
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   138
    self assert:(bytes at:3) == 0.
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   139
    self assert:(bytes at:4) == 0.
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   140
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   141
    img colorAtX:0 y:0 put:(Color green).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   142
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   143
    self assert:(bytes at:1) == 0.     "/ alpha - ignored and 0
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   144
    self assert:(bytes at:2) == 0.
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   145
    self assert:(bytes at:3) == 16rFF. "/ green
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   146
    self assert:(bytes at:4) == 0. 
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   147
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   148
    img colorAtX:0 y:0 put:(Color blue).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   149
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   150
    self assert:(bytes at:1) == 0.     "/ alpha - ignored and 0
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   151
    self assert:(bytes at:2) == 0.
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   152
    self assert:(bytes at:3) == 0. 
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   153
    self assert:(bytes at:4) == 16rFF. "/ blue
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   154
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   155
    "/ ----------------------------------
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   156
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   157
    img := Image extent:1@1 depth:32.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   158
    img photometric:#rgba.    
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   159
    img createPixelStore.
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   160
    bytes := img bits.
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   161
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   162
    img colorAtX:0 y:0 put:(Color red).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   163
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   164
    self assert:(bytes at:1) == 16rFF. "/ red
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   165
    self assert:(bytes at:2) == 0.     "/ green 
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   166
    self assert:(bytes at:3) == 0.     "/ blue 
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   167
    self assert:(bytes at:4) == 16rFF. "/ alpha 
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   168
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   169
    img colorAtX:0 y:0 put:(Color green).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   170
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   171
    self assert:(bytes at:1) == 0.     "/ red
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   172
    self assert:(bytes at:2) == 16rFF. "/ green 
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   173
    self assert:(bytes at:3) == 0.     "/ blue 
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   174
    self assert:(bytes at:4) == 16rFF. "/ alpha 
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   175
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   176
    img colorAtX:0 y:0 put:(Color blue).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   177
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   178
    self assert:(bytes at:1) == 0.     "/ red
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   179
    self assert:(bytes at:2) == 0.     "/ green 
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   180
    self assert:(bytes at:3) == 16rFF. "/ blue 
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   181
    self assert:(bytes at:4) == 16rFF. "/ alpha 
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   182
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   183
    "/ ----------------------------------
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   184
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   185
    img := Image extent:1@1 depth:32.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   186
    img photometric:#argb.    
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   187
    img createPixelStore.
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   188
    bytes := img bits.
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   189
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   190
    img colorAtX:0 y:0 put:(Color red).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   191
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   192
    self assert:(bytes at:1) == 16rFF. "/ alpha          
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   193
    self assert:(bytes at:2) == 16rFF. "/ red 
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   194
    self assert:(bytes at:3) == 0.     "/ green  
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   195
    self assert:(bytes at:4) == 0.     "/ blue
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   196
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   197
    img colorAtX:0 y:0 put:(Color green).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   198
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   199
    self assert:(bytes at:1) == 16rFF. "/ alpha          
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   200
    self assert:(bytes at:2) == 0.     "/ red 
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   201
    self assert:(bytes at:3) == 16rFF. "/ green  
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   202
    self assert:(bytes at:4) == 0.     "/ blue
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   203
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   204
    img colorAtX:0 y:0 put:(Color blue).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   205
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   206
    self assert:(bytes at:1) == 16rFF. "/ alpha          
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   207
    self assert:(bytes at:2) == 0.     "/ red 
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   208
    self assert:(bytes at:3) == 0.     "/ green  
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   209
    self assert:(bytes at:4) == 16rFF. "/ blue
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   210
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   211
    "Created: / 22-08-2017 / 18:46:14 / cg"
2335
a27ed9f806cf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 2334
diff changeset
   212
    "Modified: / 22-07-2019 / 14:05:29 / Claus Gittinger"
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   213
!
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   214
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   215
test09_FillRectangle
1686
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   216
    |depths colors rectangle|
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   217
1688
62ad31c3a464 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   218
    depths := { 16 . 24 . 32 }.
1686
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   219
    colors := {
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   220
            Color red.
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   221
            Color green.
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   222
            Color blue.
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   223
            Color white.
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   224
            Color black
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   225
        }.
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   226
        
1688
62ad31c3a464 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   227
    rectangle := Rectangle left:0 top:0 width:1 height:1.
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   228
            
1686
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   229
    depths do:[:depth | 
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   230
        |img|
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   231
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   232
        img := Image extent:1 @ 1 depth:depth.
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   233
        img createPixelStore.
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   234
        colors do:[:color | 
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   235
            |colorRetrieved|
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   236
            
1678
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   237
            img fillRectangle:rectangle withColor:color.
2334
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   238
            colorRetrieved := img colorAt: 0@0.
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   239
            self assert:(colorRetrieved = color) 
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   240
                 message:('depth:%1; expected:%2 / got:%3' 
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   241
                            bindWith:depth
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   242
                            with:color hexPrintString 
02ec6a2fca2c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2329
diff changeset
   243
                            with:colorRetrieved hexPrintString).
1678
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   244
        ].
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   245
    ].
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   246
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   247
    "Created: / 22-08-2017 / 18:45:44 / cg"
2336
006b8ee0eee6 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   248
    "Modified: / 22-07-2019 / 14:09:14 / Claus Gittinger"
1689
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   249
!
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   250
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   251
test10_FillRectangle_palette
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   252
    |img depths colors rectangle|
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   253
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   254
    depths := { 2 . 4 . 8 }.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   255
    colors := {
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   256
            Color red.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   257
            Color green.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   258
            Color blue.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   259
            Color white.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   260
        }.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   261
        
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   262
    rectangle := Rectangle left:0 top:0 width:1 height:1.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   263
            
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   264
    depths do:[:depth | 
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   265
        img := Image extent:1 @ 1 depth:depth.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   266
        img photometric:#palette.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   267
        img colorMap:colors.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   268
        
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   269
        img createPixelStore.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   270
        colors do:[:color | 
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   271
            img fillRectangle:rectangle withColor:color.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   272
            self assert:((img colorAt:0 @ 0) = color).
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   273
        ].
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   274
    ].
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   275
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   276
    colors := {
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   277
            Color red.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   278
            Color green.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   279
        }.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   280
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   281
    img := Image extent:1 @ 1 depth:1.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   282
    img photometric:#palette.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   283
    img colorMap:colors.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   284
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   285
    img createPixelStore.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   286
    colors do:[:color | 
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   287
        img fillRectangle:rectangle withColor:color.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   288
        self assert:((img colorAt:0 @ 0) = color).
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   289
    ].
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   290
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   291
    "Created: / 22-08-2017 / 18:57:19 / cg"
1678
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   292
! !
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   293
2329
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   294
!ImageTests methodsFor:'tests - converting'!
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   295
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   296
test49_24bit
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   297
    |img24|
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   298
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   299
    img24 := Depth24Image
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   300
                 width:4
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   301
                 height:4
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   302
                 fromArray:#[
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   303
                        16rFF 16r00 16r00   16rFF 16r00 16r00   16rFF 16r00 16r00   16rFF 16r00 16r00 
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   304
                        16r00 16rFF 16r00   16r00 16rFF 16r00   16r00 16rFF 16r00   16r00 16rFF 16r00 
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   305
                        16r00 16r00 16rFF   16r00 16r00 16rFF   16r00 16r00 16rFF   16r00 16r00 16rFF 
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   306
                        16rFF 16rFF 16rFF   16rFF 16rFF 16rFF   16rFF 16rFF 16rFF   16rFF 16rFF 16rFF 
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   307
                            ].
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   308
    img24 photometric:#rgb.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   309
    img24 samplesPerPixel:3.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   310
    img24 bitsPerSample:#(8 8 8).
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   311
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   312
    self assert:(img24 pixelAtX:0 y:0) = 16rFF0000.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   313
    self assert:(img24 colorAtX:0 y:0) = Color red.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   314
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   315
    "Created: / 12-07-2019 / 14:34:50 / Stefan Reise"
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   316
!
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   317
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   318
test49_32bit
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   319
    |img32|
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   320
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   321
    img32 := Depth32Image
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   322
                 width:4
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   323
                 height:4
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   324
                 fromArray:#[
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   325
                        16rFF 16r00 16r00 16r00  16rFF 16r00 16r00 16r00  16rFF 16r00 16r00 16r00  16rFF 16r00 16r00 16r00
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   326
                        16r00 16rFF 16r00 16r00  16r00 16rFF 16r00 16r00  16r00 16rFF 16r00 16r00  16r00 16rFF 16r00 16r00
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   327
                        16r00 16r00 16rFF 16r00  16r00 16r00 16rFF 16r00  16r00 16r00 16rFF 16r00  16r00 16r00 16rFF 16r00
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   328
                        16rFF 16rFF 16rFF 16r00  16rFF 16rFF 16rFF 16r00  16rFF 16rFF 16rFF 16r00  16rFF 16rFF 16rFF 16r00
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   329
                            ].
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   330
    img32 photometric:#rgb.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   331
    img32 samplesPerPixel:4.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   332
    img32 bitsPerSample:#(8 8 8 8).
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   333
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   334
    self assert:(img32 pixelAtX:0 y:0) = 16rFF000000.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   335
    self assert:(img32 colorAtX:0 y:0) = Color red.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   336
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   337
    "Created: / 12-07-2019 / 14:35:43 / Stefan Reise"
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   338
!
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   339
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   340
test50_32_to_24
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   341
    |img32 img24|
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   342
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   343
    img32 := Depth32Image
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   344
                 width:4
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   345
                 height:4
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   346
                 fromArray:#[
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   347
                        16rFF 16r00 16r00 16r00  16rFF 16r00 16r00 16r00  16rFF 16r00 16r00 16r00  16rFF 16r00 16r00 16r00
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   348
                        16r00 16rFF 16r00 16r00  16r00 16rFF 16r00 16r00  16r00 16rFF 16r00 16r00  16r00 16rFF 16r00 16r00
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   349
                        16r00 16r00 16rFF 16r00  16r00 16r00 16rFF 16r00  16r00 16r00 16rFF 16r00  16r00 16r00 16rFF 16r00
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   350
                        16rFF 16rFF 16rFF 16r00  16rFF 16rFF 16rFF 16r00  16rFF 16rFF 16rFF 16r00  16rFF 16rFF 16rFF 16r00
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   351
                            ].
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   352
    img32 photometric:#rgb.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   353
    img32 samplesPerPixel:4.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   354
    img32 bitsPerSample:#(8 8 8 8).
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   355
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   356
    self assert:(img32 pixelAtX:0 y:0) = 16rFF000000.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   357
    self assert:(img32 colorAtX:0 y:0) = Color red.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   358
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   359
    self assert:(img32 pixelAtX:0 y:1) = 16r00FF0000.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   360
    self assert:(img32 colorAtX:0 y:1) = Color green.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   361
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   362
    img24 := img32 asImageWithDepth:24.
2337
15179aed1dfe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
   363
    self assert:(img24 pixelAtX:0 y:0) = 16r00FF0000.
2329
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   364
    self assert:(img24 colorAtX:0 y:0) = Color red.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   365
2337
15179aed1dfe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
   366
    self assert:(img24 pixelAtX:0 y:1) = 16r0000FF00.
2329
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   367
    self assert:(img24 colorAtX:0 y:1) = Color green.
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   368
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   369
    "Created: / 12-07-2019 / 14:32:48 / Stefan Reise"
2337
15179aed1dfe #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
   370
    "Modified (format): / 22-07-2019 / 14:10:04 / Claus Gittinger"
2329
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   371
! !
6763cf01c241 #QUALITY by Stefan Reise
sr
parents: 1689
diff changeset
   372
1678
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   373
!ImageTests class methodsFor:'documentation'!
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   374
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   375
version
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   376
    ^ '$Header$'
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   377
!
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   378
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   379
version_CVS
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   380
    ^ '$Header$'
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   381
! !
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   382