OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
5 <link rel="stylesheet" href="../../resources/js-test-style.css"/> | 5 <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
6 <script src="../../js/resources/js-test-pre.js"></script> | 6 <script src="../../js/resources/js-test-pre.js"></script> |
7 <script src="resources/webgl-test.js"></script> | 7 <script src="resources/webgl-test.js"></script> |
8 <script src="resources/typed-array-test-cases.js"></script> | 8 <script src="resources/typed-array-test-cases.js"></script> |
9 </head> | 9 </head> |
10 <body> | 10 <body> |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 | 116 |
117 function testInheritanceHierarchy() { | 117 function testInheritanceHierarchy() { |
118 debug('test inheritance hierarchy of typed array views'); | 118 debug('test inheritance hierarchy of typed array views'); |
119 | 119 |
120 try { | 120 try { |
121 var foo = ArrayBufferView; | 121 var foo = ArrayBufferView; |
122 testFailed('ArrayBufferView has [NoInterfaceObject] extended attribute and s hould not be defined'); | 122 testFailed('ArrayBufferView has [NoInterfaceObject] extended attribute and s hould not be defined'); |
123 } catch (e) { | 123 } catch (e) { |
124 testPassed('ArrayBufferView has [NoInterfaceObject] extended attribute and w as (correctly) not defined'); | 124 testPassed('ArrayBufferView has [NoInterfaceObject] extended attribute and w as (correctly) not defined'); |
125 } | 125 } |
126 | |
127 // There is currently only one kind of view that inherits from another | |
128 shouldBe('new Uint8ClampedArray(1) instanceof Uint8Array', 'true'); | |
129 } | 126 } |
130 | 127 |
131 // | 128 // |
132 // Tests for unsigned array variants | 129 // Tests for unsigned array variants |
133 // | 130 // |
134 | 131 |
135 function testSetAndGet10To1(type, name) { | 132 function testSetAndGet10To1(type, name) { |
136 running('test ' + name + ' SetAndGet10To1'); | 133 running('test ' + name + ' SetAndGet10To1'); |
137 try { | 134 try { |
138 var array = new type(10); | 135 var array = new type(10); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 array = new type([2, 3]); | 334 array = new type([2, 3]); |
338 shouldBeUndefined("array[2]"); | 335 shouldBeUndefined("array[2]"); |
339 shouldBeUndefined("array[-1]"); | 336 shouldBeUndefined("array[-1]"); |
340 shouldBeUndefined("array[0x20000000]"); | 337 shouldBeUndefined("array[0x20000000]"); |
341 } | 338 } |
342 | 339 |
343 function testOffsetsAndSizes(type, name, elementSizeInBytes) { | 340 function testOffsetsAndSizes(type, name, elementSizeInBytes) { |
344 running('test ' + name + ' OffsetsAndSizes'); | 341 running('test ' + name + ' OffsetsAndSizes'); |
345 try { | 342 try { |
346 var len = 10; | 343 var len = 10; |
347 assertEq('type.BYTES_PER_ELEMENT', elementSizeInBytes, type.BYTES_PER_ELEMEN T); | |
348 var array = new type(len); | 344 var array = new type(len); |
345 assertEq('array.BYTES_PER_ELEMENT', elementSizeInBytes, array.BYTES_PER_ELEM ENT); | |
349 assert('array.buffer', array.buffer); | 346 assert('array.buffer', array.buffer); |
350 assertEq('array.byteOffset', 0, array.byteOffset); | 347 assertEq('array.byteOffset', 0, array.byteOffset); |
351 assertEq('array.length', len, array.length); | 348 assertEq('array.length', len, array.length); |
352 assertEq('array.byteLength', len * elementSizeInBytes, array.byteLength); | 349 assertEq('array.byteLength', len * elementSizeInBytes, array.byteLength); |
353 array = new type(array.buffer, elementSizeInBytes, len - 1); | 350 array = new type(array.buffer, elementSizeInBytes, len - 1); |
354 assert('array.buffer', array.buffer); | 351 assert('array.buffer', array.buffer); |
355 assertEq('array.byteOffset', elementSizeInBytes, array.byteOffset); | 352 assertEq('array.byteOffset', elementSizeInBytes, array.byteOffset); |
356 assertEq('array.length', len - 1, array.length); | 353 assertEq('array.length', len - 1, array.length); |
357 assertEq('array.byteLength', (len - 1) * elementSizeInBytes, array.byteLengt h); | 354 assertEq('array.byteLength', (len - 1) * elementSizeInBytes, array.byteLengt h); |
358 pass(); | 355 pass(); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
640 } | 637 } |
641 | 638 |
642 function testConstructionWithUnalignedLength(type, name, elementSizeInBytes) { | 639 function testConstructionWithUnalignedLength(type, name, elementSizeInBytes) { |
643 if (elementSizeInBytes > 1) { | 640 if (elementSizeInBytes > 1) { |
644 shouldThrowIndexSizeErr(function() { | 641 shouldThrowIndexSizeErr(function() { |
645 var buffer = new ArrayBuffer(elementSizeInBytes + 1); | 642 var buffer = new ArrayBuffer(elementSizeInBytes + 1); |
646 var array = new type(buffer, 0); | 643 var array = new type(buffer, 0); |
647 }, "Construction of " + name + " with unaligned length"); | 644 }, "Construction of " + name + " with unaligned length"); |
648 } | 645 } |
649 } | 646 } |
650 | 647 /* |
651 function testConstructionOfHugeArray(type, name, sz) { | 648 function testConstructionOfHugeArray(type, name, sz) { |
652 if (sz == 1) | 649 if (sz == 1) |
653 return; | 650 return; |
654 try { | 651 try { |
655 // Construction of huge arrays must fail because byteLength is | 652 // Construction of huge arrays must fail because byteLength is |
656 // an unsigned long | 653 // an unsigned long |
657 array = new type(3000000000); | 654 array = new type(3000000000); |
658 testFailed("Construction of huge " + name + " should throw exception"); | 655 testFailed("Construction of huge " + name + " should throw exception"); |
659 } catch (e) { | 656 } catch (e) { |
660 testPassed("Construction of huge " + name + " threw exception"); | 657 testPassed("Construction of huge " + name + " threw exception"); |
661 } | 658 } |
662 } | 659 } |
660 */ | |
663 | 661 |
664 function testConstructionWithBothArrayBufferAndLength(type, name, elementSizeInB ytes) { | 662 function testConstructionWithBothArrayBufferAndLength(type, name, elementSizeInB ytes) { |
665 var bufByteLength = 1000 * elementSizeInBytes; | 663 var bufByteLength = 1000 * elementSizeInBytes; |
666 var buf = new ArrayBuffer(bufByteLength); | 664 var buf = new ArrayBuffer(bufByteLength); |
667 var array1 = new type(buf); | 665 var array1 = new type(buf); |
668 var array2 = new type(bufByteLength / elementSizeInBytes); | 666 var array2 = new type(bufByteLength / elementSizeInBytes); |
669 if (array1.length == array2.length) { | 667 if (array1.length == array2.length) { |
670 testPassed("Array lengths matched with explicit and implicit creation of ArrayBuffer"); | 668 testPassed("Array lengths matched with explicit and implicit creation of ArrayBuffer"); |
671 } else { | 669 } else { |
672 testFailed("Array lengths DID NOT MATCH with explicit and implicit creat ion of ArrayBuffer"); | 670 testFailed("Array lengths DID NOT MATCH with explicit and implicit creat ion of ArrayBuffer"); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
996 testConstructionBoundaryConditions(type, | 994 testConstructionBoundaryConditions(type, |
997 name, | 995 name, |
998 testCase.testValues, | 996 testCase.testValues, |
999 testCase.expectedValues); | 997 testCase.expectedValues); |
1000 testConstructionWithNullBuffer(type, name); | 998 testConstructionWithNullBuffer(type, name); |
1001 testConstructionWithExceptionThrowingObject(type, name); | 999 testConstructionWithExceptionThrowingObject(type, name); |
1002 testConstructionWithOutOfRangeValues(type, name); | 1000 testConstructionWithOutOfRangeValues(type, name); |
1003 testConstructionWithNegativeOutOfRangeValues(type, name); | 1001 testConstructionWithNegativeOutOfRangeValues(type, name); |
1004 testConstructionWithUnalignedOffset(type, name, testCase.elementSizeInBytes) ; | 1002 testConstructionWithUnalignedOffset(type, name, testCase.elementSizeInBytes) ; |
1005 testConstructionWithUnalignedLength(type, name, testCase.elementSizeInBytes) ; | 1003 testConstructionWithUnalignedLength(type, name, testCase.elementSizeInBytes) ; |
1006 testConstructionOfHugeArray(type, name, testCase.elementSizeInBytes); | 1004 // testConstructionOfHugeArray(type, name, testCase.elementSizeInBytes); |
jochen (gone - plz use gerrit)
2013/07/16 08:53:57
can you move this to a separate layout test and ma
Dmitry Lomov (no reviews)
2013/07/16 13:05:48
Done.
| |
1007 testConstructionWithBothArrayBufferAndLength(type, name, testCase.elementSiz eInBytes); | 1005 testConstructionWithBothArrayBufferAndLength(type, name, testCase.elementSiz eInBytes); |
1008 testConstructionWithSubPortionOfArrayBuffer(type, name, testCase.elementSize InBytes); | 1006 testConstructionWithSubPortionOfArrayBuffer(type, name, testCase.elementSize InBytes); |
1009 testSubarrayWithOutOfRangeValues(type, name, testCase.elementSizeInBytes); | 1007 testSubarrayWithOutOfRangeValues(type, name, testCase.elementSizeInBytes); |
1010 testSubarrayWithDefaultValues(type, name, testCase.elementSizeInBytes); | 1008 testSubarrayWithDefaultValues(type, name, testCase.elementSizeInBytes); |
1011 testSettingFromArrayWithOutOfRangeOffset(type, name); | 1009 testSettingFromArrayWithOutOfRangeOffset(type, name); |
1012 testSettingFromTypedArrayWithOutOfRangeOffset(type, name); | 1010 testSettingFromTypedArrayWithOutOfRangeOffset(type, name); |
1013 testSettingFromArrayWithNegativeOffset(type, name); | 1011 testSettingFromArrayWithNegativeOffset(type, name); |
1014 testSettingFromTypedArrayWithNegativeOffset(type, name); | 1012 testSettingFromTypedArrayWithNegativeOffset(type, name); |
1015 testSettingFromArrayWithMinusZeroOffset(type, name); | 1013 testSettingFromArrayWithMinusZeroOffset(type, name); |
1016 testSettingFromTypedArrayWithMinusZeroOffset(type, name); | 1014 testSettingFromTypedArrayWithMinusZeroOffset(type, name); |
(...skipping 10 matching lines...) Expand all Loading... | |
1027 } | 1025 } |
1028 | 1026 |
1029 runTests(); | 1027 runTests(); |
1030 var successfullyParsed = true; | 1028 var successfullyParsed = true; |
1031 | 1029 |
1032 </script> | 1030 </script> |
1033 <script src="../../js/resources/js-test-post.js"></script> | 1031 <script src="../../js/resources/js-test-post.js"></script> |
1034 | 1032 |
1035 </body> | 1033 </body> |
1036 </html> | 1034 </html> |
OLD | NEW |