RegressionTests__ImageTests.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 18:53:03 +0200
changeset 2327 bf482d49aeaf
parent 1689 a026f67f0767
child 2329 6763cf01c241
permissions -rw-r--r--
#QUALITY by exept class: RegressionTests::StringTests added: #test82c_expanding
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:''
82d861aedadd initial checkin
mawalch
parents:
diff changeset
     9
	category:'tests-Regression'
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
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    72
    |img|
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.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    75
    img photometric:#rgb. "/ that is: ignored,r,g,b    
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    76
    img createPixelStore.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    77
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    78
    self assert:(img bits at:1) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    79
    self assert:(img bits at:2) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    80
    self assert:(img bits at:3) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    81
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    82
    img colorAtX:0 y:0 put:(Color red).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    83
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    84
    self assert:(img bits at:1) == 16rFF.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    85
    self assert:(img bits at:2) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    86
    self assert:(img bits at:3) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    87
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
    img := Image extent:1@1 depth:32.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    91
    img photometric:#rgb. "/ that is: ignored,r,g,b    
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    92
    img createPixelStore.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    93
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    94
    self assert:(img bits at:1) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    95
    self assert:(img bits at:2) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    96
    self assert:(img bits at:3) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    97
    self assert:(img bits at:4) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    98
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
    99
    img colorAtX:0 y:0 put:(Color red).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   100
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   101
    self assert:(img bits at:1) == 0.     "/ alpha - ignored and 0
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   102
    self assert:(img bits at:2) == 16rFF. "/ red
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   103
    self assert:(img bits at:3) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   104
    self assert:(img bits at:4) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   105
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   106
    img colorAtX:0 y:0 put:(Color green).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   107
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   108
    self assert:(img bits at:1) == 0.     "/ alpha - ignored and 0
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   109
    self assert:(img bits at:2) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   110
    self assert:(img bits at:3) == 16rFF. "/ green
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   111
    self assert:(img bits at:4) == 0. 
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   112
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   113
    img colorAtX:0 y:0 put:(Color blue).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   114
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   115
    self assert:(img bits at:1) == 0.     "/ alpha - ignored and 0
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   116
    self assert:(img bits at:2) == 0.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   117
    self assert:(img bits at:3) == 0. 
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   118
    self assert:(img bits at:4) == 16rFF. "/ blue
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   119
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   120
    "/ ----------------------------------
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   121
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   122
    img := Image extent:1@1 depth:32.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   123
    img photometric:#rgba.    
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   124
    img createPixelStore.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   125
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   126
    img colorAtX:0 y:0 put:(Color red).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   127
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   128
    self assert:(img bits at:1) == 16rFF. "/ red
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   129
    self assert:(img bits at:2) == 0.     "/ green 
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   130
    self assert:(img bits at:3) == 0.     "/ blue 
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   131
    self assert:(img bits at:4) == 16rFF. "/ alpha 
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   132
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   133
    img colorAtX:0 y:0 put:(Color green).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   134
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   135
    self assert:(img bits at:1) == 0.     "/ red
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   136
    self assert:(img bits at:2) == 16rFF. "/ green 
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   137
    self assert:(img bits at:3) == 0.     "/ blue 
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   138
    self assert:(img bits at:4) == 16rFF. "/ alpha 
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   139
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   140
    img colorAtX:0 y:0 put:(Color blue).
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   141
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   142
    self assert:(img bits at:1) == 0.     "/ red
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   143
    self assert:(img bits at:2) == 0.     "/ green 
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   144
    self assert:(img bits at:3) == 16rFF. "/ blue 
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   145
    self assert:(img bits at:4) == 16rFF. "/ alpha 
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   146
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
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   149
    img := Image extent:1@1 depth:32.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   150
    img photometric:#argb.    
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   151
    img createPixelStore.
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   152
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   153
    img colorAtX:0 y:0 put:(Color red).
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
    self assert:(img bits at:1) == 16rFF. "/ alpha          
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   156
    self assert:(img bits at:2) == 16rFF. "/ red 
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   157
    self assert:(img bits at:3) == 0.     "/ green  
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   158
    self assert:(img bits at:4) == 0.     "/ blue
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   159
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   160
    img colorAtX:0 y:0 put:(Color green).
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
    self assert:(img bits at:1) == 16rFF. "/ alpha          
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   163
    self assert:(img bits at:2) == 0.     "/ red 
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   164
    self assert:(img bits at:3) == 16rFF. "/ green  
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   165
    self assert:(img bits at:4) == 0.     "/ blue
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   166
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   167
    img colorAtX:0 y:0 put:(Color blue).
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
    self assert:(img bits at:1) == 16rFF. "/ alpha          
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   170
    self assert:(img bits at:2) == 0.     "/ red 
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   171
    self assert:(img bits at:3) == 0.     "/ green  
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   172
    self assert:(img bits at:4) == 16rFF. "/ blue
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   173
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   174
    "Created: / 22-08-2017 / 18:46:14 / cg"
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
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   177
test09_FillRectangle
1686
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   178
    |depths colors rectangle|
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   179
1688
62ad31c3a464 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   180
    depths := { 16 . 24 . 32 }.
1686
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   181
    colors := {
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   182
            Color red.
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   183
            Color green.
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   184
            Color blue.
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   185
            Color white.
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   186
            Color black
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   187
        }.
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   188
        
1688
62ad31c3a464 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   189
    rectangle := Rectangle left:0 top:0 width:1 height:1.
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   190
            
1686
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   191
    depths do:[:depth | 
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   192
        |img|
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   193
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   194
        img := Image extent:1 @ 1 depth:depth.
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   195
        img createPixelStore.
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   196
        colors do:[:color | 
1678
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   197
            img fillRectangle:rectangle withColor:color.
1686
976a342e6acf #FEATURE by mawalch
mawalch
parents: 1678
diff changeset
   198
            self assert:((img colorAt:0 @ 0) = color).
1678
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   199
        ].
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   200
    ].
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   201
1687
30597c99b668 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   202
    "Created: / 22-08-2017 / 18:45:44 / cg"
1689
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   203
!
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   204
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   205
test10_FillRectangle_palette
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   206
    |img depths colors rectangle|
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   207
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   208
    depths := { 2 . 4 . 8 }.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   209
    colors := {
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   210
            Color red.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   211
            Color green.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   212
            Color blue.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   213
            Color white.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   214
        }.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   215
        
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   216
    rectangle := Rectangle left:0 top:0 width:1 height:1.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   217
            
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   218
    depths do:[:depth | 
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   219
        img := Image extent:1 @ 1 depth:depth.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   220
        img photometric:#palette.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   221
        img colorMap:colors.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   222
        
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   223
        img createPixelStore.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   224
        colors do:[:color | 
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   225
            img fillRectangle:rectangle withColor:color.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   226
            self assert:((img colorAt:0 @ 0) = color).
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   227
        ].
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   228
    ].
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   229
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   230
    colors := {
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   231
            Color red.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   232
            Color green.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   233
        }.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   234
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   235
    img := Image extent:1 @ 1 depth:1.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   236
    img photometric:#palette.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   237
    img colorMap:colors.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   238
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   239
    img createPixelStore.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   240
    colors do:[:color | 
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   241
        img fillRectangle:rectangle withColor:color.
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   242
        self assert:((img colorAt:0 @ 0) = color).
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   243
    ].
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   244
a026f67f0767 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1688
diff changeset
   245
    "Created: / 22-08-2017 / 18:57:19 / cg"
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
!ImageTests class methodsFor:'documentation'!
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   249
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   250
version
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   251
    ^ '$Header$'
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   252
!
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   253
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   254
version_CVS
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   255
    ^ '$Header$'
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   256
! !
82d861aedadd initial checkin
mawalch
parents:
diff changeset
   257