| Index: tests/html/typed_arrays_2_test.dart
|
| diff --git a/tests/html/typed_arrays_2_test.dart b/tests/html/typed_arrays_2_test.dart
|
| index b0a82eb718bffc1141f051ff5c05d0f3ec6d7f09..994c68902af9b78f13d85a17fc94718f2d1dcc26 100644
|
| --- a/tests/html/typed_arrays_2_test.dart
|
| +++ b/tests/html/typed_arrays_2_test.dart
|
| @@ -6,7 +6,7 @@ library TypedArrays2Test;
|
| import '../../pkg/unittest/lib/unittest.dart';
|
| import '../../pkg/unittest/lib/html_config.dart';
|
| import 'dart:html';
|
| -
|
| +import 'dart:typeddata';
|
|
|
| main() {
|
| useHtmlConfiguration();
|
| @@ -16,13 +16,13 @@ main() {
|
| return;
|
| }
|
|
|
| - test('fromBufferTest_dynamic', () {
|
| - var a1 = new Uint8Array(1024);
|
| + test('viewTest_dynamic', () {
|
| + var a1 = new Uint8List(1024);
|
| for (int i = 0; i < a1.length; i++) {
|
| a1[i] = i; // 0,1,2,...,254,255,0,1,2,...
|
| }
|
|
|
| - var a2 = new Uint32Array.fromBuffer(a1.buffer);
|
| + var a2 = new Uint32List.view(a1.buffer);
|
| expect(1024 ~/ 4, a2.length);
|
| expect(a2[0], 0x03020100);
|
| expect(a2[1], 0x07060504);
|
| @@ -31,53 +31,53 @@ main() {
|
| expect(a2[51], 0xCFCECDCC);
|
| expect(a2[64], 0x03020100);
|
|
|
| - a2 = new Uint32Array.fromBuffer(a1.buffer, 200);
|
| + a2 = new Uint32List.view(a1.buffer, 200);
|
| expect(a2.length, (1024 - 200) ~/ 4);
|
| expect(a2[0], 0xCBCAC9C8);
|
| expect(a2[1], 0xCFCECDCC);
|
| expect(a2[14], 0x03020100);
|
|
|
| - a2 = new Uint32Array.fromBuffer(a1.buffer, 456, 20);
|
| + a2 = new Uint32List.view(a1.buffer, 456, 20);
|
| expect(a2.length, 20);
|
| expect(a2[0], 0xCBCAC9C8);
|
| expect(a2[1], 0xCFCECDCC);
|
| expect(a2[14], 0x03020100);
|
|
|
| - // OPTIONALS a2 = new Uint32Array.fromBuffer(a1.buffer, length: 30, byteOffset: 456);
|
| - a2 = new Uint32Array.fromBuffer(a1.buffer, 456, 30);
|
| + // OPTIONALS a2 = new Uint32List.view(a1.buffer, length: 30, byteOffset: 456);
|
| + a2 = new Uint32List.view(a1.buffer, 456, 30);
|
| expect(a2.length, 30);
|
| expect(a2[0], 0xCBCAC9C8);
|
| expect(a2[1], 0xCFCECDCC);
|
| expect(a2[14], 0x03020100);
|
| });
|
|
|
| - test('fromBufferTest_typed', () {
|
| - Uint8Array a1 = new Uint8Array(1024);
|
| + test('viewTest_typed', () {
|
| + Uint8List a1 = new Uint8List(1024);
|
| for (int i = 0; i < a1.length; i++) {
|
| a1[i] = i;
|
| }
|
|
|
| - Uint32Array a2 = new Uint32Array.fromBuffer(a1.buffer);
|
| + Uint32List a2 = new Uint32List.view(a1.buffer);
|
| expect(a2.length, 1024 ~/ 4);
|
| expect(a2[0], 0x03020100);
|
| expect(a2[50], 0xCBCAC9C8);
|
| expect(a2[51], 0xCFCECDCC);
|
| expect(a2[64], 0x03020100);
|
|
|
| - a2 = new Uint32Array.fromBuffer(a1.buffer, 200);
|
| + a2 = new Uint32List.view(a1.buffer, 200);
|
| expect(a2.length, (1024 - 200) ~/ 4);
|
| expect(a2[0], 0xCBCAC9C8);
|
| expect(a2[1], 0xCFCECDCC);
|
| expect(a2[14], 0x03020100);
|
|
|
| - a2 = new Uint32Array.fromBuffer(a1.buffer, 456, 20);
|
| + a2 = new Uint32List.view(a1.buffer, 456, 20);
|
| expect(20, a2.length);
|
| expect(a2[0], 0xCBCAC9C8);
|
| expect(a2[1], 0xCFCECDCC);
|
| expect(a2[14], 0x03020100);
|
|
|
| - // OPTIONALS a2 = new Uint32Array.fromBuffer(a1.buffer, length: 30, byteOffset: 456);
|
| - a2 = new Uint32Array.fromBuffer(a1.buffer, 456, 30);
|
| + // OPTIONALS a2 = new Uint32List.view(a1.buffer, length: 30, byteOffset: 456);
|
| + a2 = new Uint32List.view(a1.buffer, 456, 30);
|
| expect(a2.length, 30);
|
| expect(a2[0], 0xCBCAC9C8);
|
| expect(a2[1], 0xCFCECDCC);
|
|
|