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