summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-set-invalid-arguments.html
blob: 8ecfd9f8299f24939deccf84aa240021e60d05c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>

<script>

description("Verifies that attempting to set invalid elements to a Typed Array throws an exception");

// Global scope so shouldThrow can see it
var typedArray, otherArray;

function negativeTestSet(typeName) {
    var type = window[typeName];
    typedArray = new type(10);

    shouldThrow("typedArray.set()");
    shouldThrow("typedArray.set('hello world')");

    otherArray = new type(typedArray.length);
    shouldThrow("typedArray.set(otherArray, 1)");
}

negativeTestSet("Int8Array");
negativeTestSet("Uint8Array");
negativeTestSet("Int16Array");
negativeTestSet("Uint16Array");
negativeTestSet("Int32Array");
negativeTestSet("Uint32Array");
negativeTestSet("Float32Array");

</script>

</body>
</html>