OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script src="../../../resources/js-test.js"></script> | |
4 <script src="resources/webgl-test.js"></script> | |
5 </head> | |
6 <body> | |
7 <div id="description"></div> | |
8 <div id="console"></div> | |
9 | |
10 <script> | |
11 description("Test all permutations of WebGLArray setters to make sure values don
't get truncated"); | |
12 | |
13 debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=3335
0">https://bugs.webkit.org/show_bug.cgi?id=33350</a> : <code>WebGLArray subclass
es do the wrong conversion in indexSetter</code>'); | |
14 | |
15 var webGLArray = null; | |
16 var array = null; | |
17 | |
18 function testSetters(typeName, low, high) { | |
19 var type = window[typeName]; | |
20 webGLArray = new type(2); | |
21 array = [low, high]; | |
22 debug("Testing " + typeName); | |
23 webGLArray.set(array); | |
24 shouldBe("webGLArray", "array"); | |
25 shouldBe("webGLArray[0]", "array[0]"); | |
26 shouldBe("webGLArray[1]", "array[1]"); | |
27 webGLArray[0] = 0; | |
28 webGLArray[1] = 0; | |
29 shouldBe("webGLArray[0]", "0"); | |
30 shouldBe("webGLArray[1]", "0"); | |
31 webGLArray[0] = array[0]; | |
32 shouldBe("webGLArray[0]", "array[0]"); | |
33 webGLArray[1] = array[1]; | |
34 shouldBe("webGLArray[1]", "array[1]"); | |
35 | |
36 // Verify set() behaves correctly with shared underlying buffer. | |
37 array = [0, 1, 2, 3, 4, 5]; | |
38 webGLArray = new type(6); | |
39 webGLArray.set(array); | |
40 array = webGLArray.subarray(2, 4); | |
41 array[0] = 88; | |
42 array[1] = 99; | |
43 shouldBe("webGLArray[2]", "88"); | |
44 shouldBe("webGLArray[3]", "99"); | |
45 // pre-overlap | |
46 webGLArray.set(array, 1); | |
47 shouldBe("webGLArray[1]", "88"); | |
48 shouldBe("webGLArray[2]", "99"); | |
49 shouldBe("array[0]", "99"); | |
50 shouldBe("array[1]", "99"); | |
51 array[1] = 77; | |
52 // post-overlap | |
53 webGLArray.set(array, 3); | |
54 shouldBe("webGLArray[3]", "99"); | |
55 shouldBe("webGLArray[4]", "77"); | |
56 shouldBe("array[0]", "99"); | |
57 shouldBe("array[1]", "99"); | |
58 } | |
59 | |
60 testSetters("Int8Array", -128, 127); | |
61 testSetters("Uint8Array", 0, 255); | |
62 testSetters("Int16Array", -32768, 32767); | |
63 testSetters("Uint16Array", 0, 65535); | |
64 testSetters("Int32Array", -2147483648, 2147483647); | |
65 testSetters("Uint32Array", 0, 4294967295); | |
66 testSetters("Float32Array", -2.5, 3.5); | |
67 </script> | |
68 | |
69 </body> | |
70 </html> | |
OLD | NEW |