@@ -9,15 +9,12 @@ import vtkActor from 'vtk.js/Sources/Rendering/Core/Actor';
9
9
import vtkMapper from 'vtk.js/Sources/Rendering/Core/Mapper' ;
10
10
import vtkDataArray from 'vtk.js/Sources/Common/Core/DataArray' ;
11
11
import vtkPolyData from 'vtk.js/Sources/Common/DataModel/PolyData' ;
12
- import Constants from 'vtk.js/Sources/Rendering/Core/ColorTransferFunction/Constants' ;
13
12
14
13
import { areEquals } from 'vtk.js/Sources/Common/Core/Math' ;
15
14
16
15
import baseline from './testColorTransferFunction.png' ;
17
16
import baseline2 from './testColorTransferFunction2.png' ;
18
17
19
- const { ColorSpace } = Constants ;
20
-
21
18
test ( 'Test Color Transfer Function' , ( t ) => {
22
19
const gc = testUtils . createGarbageCollector ( t ) ;
23
20
t . ok ( 'rendering' , 'vtkMapper ColorTransferFunction' ) ;
@@ -163,38 +160,60 @@ test('Test discretized color transfer function', (t) => {
163
160
t . end ( ) ;
164
161
} ) ;
165
162
166
- test ( 'Test applyColorMap calls modfied ' , ( t ) => {
163
+ test ( 'Test applyColorMap calls modified ' , ( t ) => {
167
164
const ctf = vtkColorTransferFunction . newInstance ( ) ;
168
165
169
166
const colorMapA = {
170
- ColorSpace : ColorSpace . RGB ,
167
+ ColorSpace : ' RGB' ,
171
168
RGBPoints : [ 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 ] ,
172
169
} ;
173
170
const colorMapB = {
174
- ColorSpace : ColorSpace . RGB ,
171
+ ColorSpace : ' RGB' ,
175
172
RGBPoints : [ 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 ] ,
176
173
} ;
177
174
178
175
ctf . applyColorMap ( colorMapA ) ;
179
176
180
- let isModfied = false ;
177
+ let isModified = false ;
181
178
ctf . onModified ( ( ) => {
182
- isModfied = true ;
179
+ isModified = true ;
183
180
} ) ;
184
181
185
182
ctf . applyColorMap ( colorMapA ) ;
186
-
187
183
t . notOk (
188
- isModfied ,
184
+ isModified ,
189
185
`Expect applyColorMap does not call modified with same color map`
190
186
) ;
191
187
192
188
ctf . applyColorMap ( colorMapB ) ;
193
-
194
189
t . ok (
195
- isModfied ,
190
+ isModified ,
196
191
`Expect applyColorMap calls modified with different color map`
197
192
) ;
198
193
194
+ colorMapB . ColorSpace = 'LAB' ;
195
+ isModified = false ;
196
+ let modifiedReturn = ctf . applyColorMap ( colorMapB ) ;
197
+ t . ok (
198
+ isModified && modifiedReturn ,
199
+ `Expect applyColorMap calls modified with different ColorSpace`
200
+ ) ;
201
+
202
+ colorMapB . NanColor = [ 0 , 0 , 0 , 1 ] ;
203
+ isModified = false ;
204
+ modifiedReturn = ctf . applyColorMap ( colorMapB ) ;
205
+ t . ok (
206
+ isModified && modifiedReturn ,
207
+ `Expect applyColorMap calls modified with different NanColor`
208
+ ) ;
209
+
210
+ colorMapB . RGBPoints = [ 0 , 0 , 0 , 0 , 0.5 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ] ;
211
+ isModified = false ;
212
+ modifiedReturn = ctf . applyColorMap ( colorMapB ) ;
213
+ t . ok (
214
+ isModified && modifiedReturn ,
215
+ `Expect applyColorMap calls modified with different RGBPoints`
216
+ ) ;
217
+
199
218
t . end ( ) ;
200
219
} ) ;
0 commit comments