@@ -19,24 +19,27 @@ test('Test vtkDataArray instance', (t) => {
1919
2020 t . throws (
2121 ( ) => vtkDataArray . newInstance ( { } ) ,
22- 'Create instance without values '
22+ 'Not allowed to create instance without initialValues '
2323 ) ;
2424
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+ ) ;
2629
2730 t . throws (
2831 ( ) => vtkDataArray . newInstance ( { empty : false } ) ,
29- 'Create instance with empty false, no values '
32+ 'Not allowed to create instance with empty false, no data '
3033 ) ;
3134
3235 t . doesNotThrow (
3336 ( ) => vtkDataArray . newInstance ( { size : 256 } ) ,
34- 'Create instance with only size'
37+ 'Allowed to create instance with only size'
3538 ) ;
3639
3740 const dataArray0 = vtkDataArray . newInstance ( {
3841 empty : true ,
39- values : null ,
42+ data : null ,
4043 } ) ;
4144 t . deepEqual (
4245 {
@@ -46,7 +49,7 @@ test('Test vtkDataArray instance', (t) => {
4649 values : macro . newTypedArray ( DefaultDataType , 0 ) ,
4750 } ,
4851 getDataArrayProperties ( dataArray0 ) ,
49- 'initialValues.values = null'
52+ 'initialValues.data = null'
5053 ) ;
5154
5255 const dataArray1 = vtkDataArray . newInstance ( { size : 256 } ) ;
@@ -62,7 +65,7 @@ test('Test vtkDataArray instance', (t) => {
6265 ) ;
6366
6467 const dataArray2 = vtkDataArray . newInstance ( {
65- values : Uint32Array . from ( [ 1 , 2 , 3 ] ) ,
68+ data : Uint32Array . from ( [ 1 , 2 , 3 ] ) ,
6669 } ) ;
6770 t . deepEqual (
6871 {
@@ -72,11 +75,11 @@ test('Test vtkDataArray instance', (t) => {
7275 values : Uint32Array . from ( [ 1 , 2 , 3 ] ) ,
7376 } ,
7477 getDataArrayProperties ( dataArray2 ) ,
75- 'Create instance with values (typed array)'
78+ 'Create instance with data (typed array)'
7679 ) ;
7780
7881 const dataArray3 = vtkDataArray . newInstance ( {
79- values : [ 1 , 2 , 3 ] ,
82+ data : [ 1 , 2 , 3 ] ,
8083 } ) ;
8184 t . deepEqual (
8285 {
@@ -86,11 +89,11 @@ test('Test vtkDataArray instance', (t) => {
8689 values : macro . newTypedArrayFrom ( DefaultDataType , [ 1 , 2 , 3 ] ) ,
8790 } ,
8891 getDataArrayProperties ( dataArray3 ) ,
89- 'Create instance with values (untyped array)'
92+ 'Create instance with data (untyped array)'
9093 ) ;
9194
9295 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 ] ,
9497 numberOfComponents : 3 ,
9598 } ) ;
9699 t . deepEqual (
@@ -108,7 +111,7 @@ test('Test vtkDataArray instance', (t) => {
108111 ) ;
109112
110113 const dataArray5 = vtkDataArray . newInstance ( {
111- values : [ 1 , 2 , 3 ] ,
114+ data : [ 1 , 2 , 3 ] ,
112115 dataType : null ,
113116 } ) ;
114117 t . deepEqual (
@@ -176,28 +179,29 @@ test('Test vtkDataArray setData', (t) => {
176179 'Empty an instance (pass [] array)'
177180 ) ;
178181
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 ) ;
181184 dataArray . setData ( null ) ;
182185 t . deepEqual (
183186 {
184187 dataType : DefaultDataType ,
185188 size : 0 ,
186189 numberOfComponents : 1 ,
187- values : macro . newTypedArray ( DefaultDataType ) ,
190+ values : null ,
188191 } ,
189192 getDataArrayProperties ( dataArray ) ,
190193 'Call setData with typedArray = null'
191194 ) ;
192195
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 ) ;
194198 dataArray . setData ( ) ;
195199 t . deepEqual (
196200 {
197201 dataType : DefaultDataType ,
198202 size : 0 ,
199203 numberOfComponents : 1 ,
200- values : macro . newTypedArray ( DefaultDataType ) ,
204+ values : null ,
201205 } ,
202206 getDataArrayProperties ( dataArray ) ,
203207 'Call setData with typedArray = undefined'
@@ -227,7 +231,7 @@ test('Test vtkDataArray getRange function with single-channel data.', (t) => {
227231
228232 const da = vtkDataArray . newInstance ( {
229233 numberOfComponents : 1 ,
230- values : newArray ,
234+ data : newArray ,
231235 } ) ;
232236
233237 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) => {
250254
251255 const da = vtkDataArray . newInstance ( {
252256 numberOfComponents : 3 ,
253- values : newArray ,
257+ data : newArray ,
254258 } ) ;
255259
256260 t . ok ( da . getRange ( 0 ) [ 0 ] === 0 , 'component:0 minimum value should be 0' ) ;
0 commit comments