Index: LayoutTests/fast/canvas/webgl/array-unit-tests.html |
=================================================================== |
--- LayoutTests/fast/canvas/webgl/array-unit-tests.html (revision 91888) |
+++ LayoutTests/fast/canvas/webgl/array-unit-tests.html (working copy) |
@@ -480,7 +480,11 @@ |
shouldThrowIndexSizeErr(function() { |
var buffer = new ArrayBuffer(4); |
var array = new type(buffer, 4, 0x3FFFFFFF); |
- }, "Construction of " + name + " with out-of-range values"); |
+ }, "Construction of " + name + " with out-of-range number of elements"); |
+ shouldThrowIndexSizeErr(function() { |
+ var buffer = new ArrayBuffer(4); |
+ var array = new type(buffer, 8); |
+ }, "Construction of " + name + " with out-of-range offset"); |
} |
function testConstructionWithNegativeOutOfRangeValues(type, name) { |
@@ -545,6 +549,21 @@ |
} |
} |
+function testConstructionWithSubPortionOfArrayBuffer(type, name, elementSizeInBytes) { |
+ if (elementSizeInBytes > 1) { |
+ // Test construction with a valid sub-portion of an array buffer |
+ // (whose size is not an integral multiple of the element size). |
+ var size = 4 * elementSizeInBytes + (elementSizeInBytes / 2); |
+ var buf = new ArrayBuffer(size); |
+ try { |
+ var array = new type(buf, 0, 2); |
+ testPassed("new " + name + "(new ArrayBuffer(" + size + "), 0, 2) succeeded"); |
+ } catch (e) { |
+ testFailed("new " + name + "(new ArrayBuffer(" + size + "), 0, 2) failed: " + e); |
+ } |
+ } |
+} |
+ |
// These need to be global for shouldBe to see them |
var array; |
var typeSize; |
@@ -849,6 +868,7 @@ |
testConstructionWithUnalignedLength(type, name, testCase.elementSizeInBytes); |
testConstructionOfHugeArray(type, name, testCase.elementSizeInBytes); |
testConstructionWithBothArrayBufferAndLength(type, name, testCase.elementSizeInBytes); |
+ testConstructionWithSubPortionOfArrayBuffer(type, name, testCase.elementSizeInBytes); |
testSubarrayWithOutOfRangeValues(type, name, testCase.elementSizeInBytes); |
testSubarrayWithDefaultValues(type, name, testCase.elementSizeInBytes); |
testSettingFromArrayWithOutOfRangeOffset(type, name); |