| Index: LayoutTests/fast/canvas/webgl/data-view-test.html
|
| ===================================================================
|
| --- LayoutTests/fast/canvas/webgl/data-view-test.html (revision 78119)
|
| +++ LayoutTests/fast/canvas/webgl/data-view-test.html (working copy)
|
| @@ -47,7 +47,7 @@
|
| expr += littleEndian ? "true" : "false";
|
| }
|
| expr += ")";
|
| - if (index + getElementSize(func) - 1 < view.byteLength)
|
| + if (index >= 0 && index + getElementSize(func) - 1 < view.byteLength)
|
| shouldBe(expr, expected);
|
| else
|
| shouldThrow(expr);
|
| @@ -61,7 +61,7 @@
|
| expr += littleEndian ? "true" : "false";
|
| }
|
| expr += ")";
|
| - if (index + getElementSize(func) - 1 < view.byteLength) {
|
| + if (index >= 0 && index + getElementSize(func) - 1 < view.byteLength) {
|
| shouldBeUndefined(expr);
|
| checkGet(func, index, value, littleEndian);
|
| } else
|
| @@ -192,6 +192,43 @@
|
| testFloat(isTestingGet, "Float64", isTestingGet ? [255, 255, 255, 255, 255, 255, 255, 255] : emptyArray, start, "-NaN");
|
| }
|
|
|
| +function runNegativeIndexTests(isTestingGet)
|
| +{
|
| + createDataView(intArray1, 0, true, 0, 16);
|
| +
|
| + test(isTestingGet, "Int8", -1, "0");
|
| + test(isTestingGet, "Int8", -2, "0");
|
| +
|
| + test(isTestingGet, "Uint8", -1, "0");
|
| + test(isTestingGet, "Uint8", -2, "0");
|
| +
|
| + test(isTestingGet, "Int16", -1, "0");
|
| + test(isTestingGet, "Int16", -2, "0");
|
| + test(isTestingGet, "Int16", -3, "0");
|
| +
|
| + test(isTestingGet, "Uint16", -1, "0");
|
| + test(isTestingGet, "Uint16", -2, "0");
|
| + test(isTestingGet, "Uint16", -3, "0");
|
| +
|
| + test(isTestingGet, "Int32", -1, "0");
|
| + test(isTestingGet, "Int32", -3, "0");
|
| + test(isTestingGet, "Int32", -5, "0");
|
| +
|
| + test(isTestingGet, "Uint32", -1, "0");
|
| + test(isTestingGet, "Uint32", -3, "0");
|
| + test(isTestingGet, "Uint32", -5, "0");
|
| +
|
| + createDataView([0, 0, 0, 0, 0, 0, 36, 64], 0, true, 0, 8);
|
| +
|
| + test(isTestingGet, "Float32", -1, "0");
|
| + test(isTestingGet, "Float32", -3, "0");
|
| + test(isTestingGet, "Float32", -5, "0");
|
| +
|
| + test(isTestingGet, "Float64", -1, "0");
|
| + test(isTestingGet, "Float64", -5, "0");
|
| + test(isTestingGet, "Float64", -9, "0");
|
| +}
|
| +
|
| function runConstructorTests()
|
| {
|
| arayBuffer = (new Uint8Array([1, 2])).buffer;
|
| @@ -229,11 +266,15 @@
|
| runFloatTestCases(true, 0);
|
|
|
| debug("");
|
| - debug("Test for get methods that might read beyound range");
|
| + debug("Test for get methods that might read beyond range");
|
| runIntegerTestCases(true, intArray2, 3, 2);
|
| runFloatTestCases(true, 3);
|
|
|
| debug("");
|
| + debug("Test for get methods that read from negative index");
|
| + runNegativeIndexTests(true);
|
| +
|
| + debug("");
|
| debug("Test for wrong arguments passed to get methods");
|
| view = new DataView((new Uint8Array([1, 2])).buffer);
|
| shouldThrow("view.getInt8()");
|
| @@ -259,7 +300,11 @@
|
| runFloatTestCases(false, 7);
|
|
|
| debug("");
|
| - debug("Test for wrong arguments passed to get methods");
|
| + debug("Test for set methods that write to negative index");
|
| + runNegativeIndexTests(false);
|
| +
|
| + debug("");
|
| + debug("Test for wrong arguments passed to set methods");
|
| view = new DataView((new Uint8Array([1, 2])).buffer);
|
| shouldThrow("view.setInt8()");
|
| shouldThrow("view.setUint8()");
|
|
|