3 <script src=
"../../../resources/js-test.js"></script>
4 <script src=
"resources/webgl-test.js"></script>
7 <div id=
"description"></div>
8 <div id=
"console"></div>
11 description("Test setting WebGL array with offset");
13 debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=76040">https://bugs.webkit.org/show_bug.cgi?id=76040</a> : <code>Int16Array.set(array, offset) fails on first execution</code>');
15 var webGLArray
= null;
19 function testSetters(typeName
, low
, high
) {
21 var type
= window
[typeName
];
22 var array_buffer
= new ArrayBuffer(32);
23 webGLArray
= new type(array_buffer
);
24 debug("Testing " + typeName
);
25 array
= [1, 2, low
, high
];
26 webGLArray
.set(array
, 1);
27 shouldBe("webGLArray[0]", "0");
28 shouldBe("webGLArray[1]", "1");
29 shouldBe("webGLArray[2]", "2");
30 shouldBe("webGLArray[3]", "bounds[0]");
31 shouldBe("webGLArray[4]", "bounds[1]");
34 testSetters("Int8Array", -128, 127);
35 testSetters("Uint8Array", 0, 255);
36 testSetters("Int16Array", -32768, 32767);
37 testSetters("Uint16Array", 0, 65535);
38 testSetters("Int32Array", -2147483648, 2147483647);
39 testSetters("Uint32Array", 0, 4294967295);
40 testSetters("Float32Array", -2.5, 3.5);