@@ -19,24 +19,27 @@ test('Test vtkDataArray instance', (t) => {
19
19
20
20
t . throws (
21
21
( ) => vtkDataArray . newInstance ( { } ) ,
22
- 'Create instance without values '
22
+ 'Not allowed to create instance without initialValues '
23
23
) ;
24
24
25
- t . doesNotThrow ( ( ) => vtkDataArray . newInstance ( { empty : true } ) ) ;
25
+ t . doesNotThrow (
26
+ ( ) => vtkDataArray . newInstance ( { empty : true } ) ,
27
+ 'Allowed to create instance with empty true, no data'
28
+ ) ;
26
29
27
30
t . throws (
28
31
( ) => vtkDataArray . newInstance ( { empty : false } ) ,
29
- 'Create instance with empty false, no values '
32
+ 'Not allowed to create instance with empty false, no data '
30
33
) ;
31
34
32
35
t . doesNotThrow (
33
36
( ) => vtkDataArray . newInstance ( { size : 256 } ) ,
34
- 'Create instance with only size'
37
+ 'Allowed to create instance with only size'
35
38
) ;
36
39
37
40
const dataArray0 = vtkDataArray . newInstance ( {
38
41
empty : true ,
39
- values : null ,
42
+ data : null ,
40
43
} ) ;
41
44
t . deepEqual (
42
45
{
@@ -46,7 +49,7 @@ test('Test vtkDataArray instance', (t) => {
46
49
values : macro . newTypedArray ( DefaultDataType , 0 ) ,
47
50
} ,
48
51
getDataArrayProperties ( dataArray0 ) ,
49
- 'initialValues.values = null'
52
+ 'initialValues.data = null'
50
53
) ;
51
54
52
55
const dataArray1 = vtkDataArray . newInstance ( { size : 256 } ) ;
@@ -62,7 +65,7 @@ test('Test vtkDataArray instance', (t) => {
62
65
) ;
63
66
64
67
const dataArray2 = vtkDataArray . newInstance ( {
65
- values : Uint32Array . from ( [ 1 , 2 , 3 ] ) ,
68
+ data : Uint32Array . from ( [ 1 , 2 , 3 ] ) ,
66
69
} ) ;
67
70
t . deepEqual (
68
71
{
@@ -72,11 +75,11 @@ test('Test vtkDataArray instance', (t) => {
72
75
values : Uint32Array . from ( [ 1 , 2 , 3 ] ) ,
73
76
} ,
74
77
getDataArrayProperties ( dataArray2 ) ,
75
- 'Create instance with values (typed array)'
78
+ 'Create instance with data (typed array)'
76
79
) ;
77
80
78
81
const dataArray3 = vtkDataArray . newInstance ( {
79
- values : [ 1 , 2 , 3 ] ,
82
+ data : [ 1 , 2 , 3 ] ,
80
83
} ) ;
81
84
t . deepEqual (
82
85
{
@@ -86,11 +89,11 @@ test('Test vtkDataArray instance', (t) => {
86
89
values : macro . newTypedArrayFrom ( DefaultDataType , [ 1 , 2 , 3 ] ) ,
87
90
} ,
88
91
getDataArrayProperties ( dataArray3 ) ,
89
- 'Create instance with values (untyped array)'
92
+ 'Create instance with data (untyped array)'
90
93
) ;
91
94
92
95
const dataArray4 = vtkDataArray . newInstance ( {
93
- values : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] ,
96
+ data : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] ,
94
97
numberOfComponents : 3 ,
95
98
} ) ;
96
99
t . deepEqual (
@@ -108,7 +111,7 @@ test('Test vtkDataArray instance', (t) => {
108
111
) ;
109
112
110
113
const dataArray5 = vtkDataArray . newInstance ( {
111
- values : [ 1 , 2 , 3 ] ,
114
+ data : [ 1 , 2 , 3 ] ,
112
115
dataType : null ,
113
116
} ) ;
114
117
t . deepEqual (
@@ -176,28 +179,29 @@ test('Test vtkDataArray setData', (t) => {
176
179
'Empty an instance (pass [] array)'
177
180
) ;
178
181
179
- // For both of those cases, check it does not change the DataArray
180
- // Not supposed to call setData with typedArray = null
182
+ // Fill the DataArray before so that we are sure the size and the numberOfComponents is updated
183
+ dataArray . setData ( [ 1 , 2 , 3 ] , 3 ) ;
181
184
dataArray . setData ( null ) ;
182
185
t . deepEqual (
183
186
{
184
187
dataType : DefaultDataType ,
185
188
size : 0 ,
186
189
numberOfComponents : 1 ,
187
- values : macro . newTypedArray ( DefaultDataType ) ,
190
+ values : null ,
188
191
} ,
189
192
getDataArrayProperties ( dataArray ) ,
190
193
'Call setData with typedArray = null'
191
194
) ;
192
195
193
- // Not supposed to call setData without parameters
196
+ // Fill the DataArray before so that we are sure the size and the numberOfComponents is updated
197
+ dataArray . setData ( [ 1 , 2 , 3 ] , 3 ) ;
194
198
dataArray . setData ( ) ;
195
199
t . deepEqual (
196
200
{
197
201
dataType : DefaultDataType ,
198
202
size : 0 ,
199
203
numberOfComponents : 1 ,
200
- values : macro . newTypedArray ( DefaultDataType ) ,
204
+ values : null ,
201
205
} ,
202
206
getDataArrayProperties ( dataArray ) ,
203
207
'Call setData with typedArray = undefined'
@@ -227,7 +231,7 @@ test('Test vtkDataArray getRange function with single-channel data.', (t) => {
227
231
228
232
const da = vtkDataArray . newInstance ( {
229
233
numberOfComponents : 1 ,
230
- values : newArray ,
234
+ data : newArray ,
231
235
} ) ;
232
236
233
237
t . ok ( da . getRange ( 0 ) [ 0 ] === 0 , 'getRange minimum value should be 0' ) ;
@@ -250,7 +254,7 @@ test('Test vtkDataArray getRange function with multi-channel data.', (t) => {
250
254
251
255
const da = vtkDataArray . newInstance ( {
252
256
numberOfComponents : 3 ,
253
- values : newArray ,
257
+ data : newArray ,
254
258
} ) ;
255
259
256
260
t . ok ( da . getRange ( 0 ) [ 0 ] === 0 , 'component:0 minimum value should be 0' ) ;
0 commit comments