summaryrefslogtreecommitdiffstats
path: root/dom/imptests/html/webgl
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/imptests/html/webgl
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/imptests/html/webgl')
-rw-r--r--dom/imptests/html/webgl/common.js13
-rw-r--r--dom/imptests/html/webgl/test_bufferSubData.html26
-rw-r--r--dom/imptests/html/webgl/test_compressedTexImage2D.html30
-rw-r--r--dom/imptests/html/webgl/test_compressedTexSubImage2D.html30
-rw-r--r--dom/imptests/html/webgl/test_texImage2D.html20
-rw-r--r--dom/imptests/html/webgl/test_texSubImage2D.html20
-rw-r--r--dom/imptests/html/webgl/test_uniformMatrixNfv.html33
7 files changed, 172 insertions, 0 deletions
diff --git a/dom/imptests/html/webgl/common.js b/dom/imptests/html/webgl/common.js
new file mode 100644
index 000000000..416c21ce9
--- /dev/null
+++ b/dom/imptests/html/webgl/common.js
@@ -0,0 +1,13 @@
+function getGl() {
+ var c = document.createElement("canvas");
+ var gl = c.getContext("experimental-webgl");
+ assert_true(!!gl, "Should be able to get a context.");
+ return gl;
+}
+
+function shouldGenerateGLError(cx, glError, fn) {
+ test(function() {
+ fn();
+ assert_equals(cx.getError(), glError);
+ }, "Calling " + fn + " should generate a " + glError + " error.");
+}
diff --git a/dom/imptests/html/webgl/test_bufferSubData.html b/dom/imptests/html/webgl/test_bufferSubData.html
new file mode 100644
index 000000000..a97df9062
--- /dev/null
+++ b/dom/imptests/html/webgl/test_bufferSubData.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<title>bufferSubData</title>
+<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger>
+<link rel=help href=https://www.khronos.org/registry/webgl/specs/latest/#5.14.5>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=common.js></script>
+
+<div id=log></div>
+<script>
+test(function() {
+ var gl = getGl();
+ assert_equals(gl.getError(), WebGLRenderingContext.NO_ERROR);
+
+ var b = gl.createBuffer();
+ gl.bindBuffer(gl.ARRAY_BUFFER, b);
+
+ var a = new Float32Array(1);
+ gl.bufferData(gl.ARRAY_BUFFER, a, gl.STATIC_DRAW);
+
+ var nan = 0 / 0;
+ gl.bufferSubData(gl.ARRAY_BUFFER, nan, a);
+
+ assert_equals(gl.getError(), WebGLRenderingContext.NO_ERROR);
+});
+</script>
diff --git a/dom/imptests/html/webgl/test_compressedTexImage2D.html b/dom/imptests/html/webgl/test_compressedTexImage2D.html
new file mode 100644
index 000000000..b0a031add
--- /dev/null
+++ b/dom/imptests/html/webgl/test_compressedTexImage2D.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<title>compressedTexImage2D</title>
+<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger>
+<link rel=help href=https://www.khronos.org/registry/webgl/specs/latest/#5.14.8>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=common.js></script>
+
+<div id=log></div>
+<script>
+test(function() {
+ var COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
+ var gl = getGl();
+
+ var tex = gl.createTexture();
+ gl.bindTexture(gl.TEXTURE_2D, tex);
+
+ shouldGenerateGLError(gl, gl.INVALID_ENUM, function() {
+ gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8));
+ });
+ shouldGenerateGLError(gl, gl.INVALID_ENUM, function() {
+ gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8), null);
+ });
+ test(function() {
+ assert_throws(new TypeError(), function() {
+ gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0);
+ });
+ }, "Should throw a TypeError when passing too few arguments.");
+});
+</script>
diff --git a/dom/imptests/html/webgl/test_compressedTexSubImage2D.html b/dom/imptests/html/webgl/test_compressedTexSubImage2D.html
new file mode 100644
index 000000000..539f9e17f
--- /dev/null
+++ b/dom/imptests/html/webgl/test_compressedTexSubImage2D.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<title>compressedTexSubImage2D</title>
+<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger>
+<link rel=help href=https://www.khronos.org/registry/webgl/specs/latest/#5.14.8>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=common.js></script>
+
+<div id=log></div>
+<script>
+test(function() {
+ var COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
+ var gl = getGl();
+
+ var tex = gl.createTexture();
+ gl.bindTexture(gl.TEXTURE_2D, tex);
+
+ shouldGenerateGLError(gl, gl.INVALID_ENUM, function() {
+ gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 10, 10, COMPRESSED_RGB_S3TC_DXT1_EXT, new Uint8Array(8));
+ });
+ shouldGenerateGLError(gl, gl.INVALID_ENUM, function() {
+ gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 10, 10, COMPRESSED_RGB_S3TC_DXT1_EXT, new Uint8Array(8), null);
+ });
+ test(function() {
+ assert_throws(new TypeError(), function() {
+ gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 10, 10, COMPRESSED_RGB_S3TC_DXT1_EXT);
+ });
+ }, "Should throw a TypeError when passing too few arguments.");
+});
+</script>
diff --git a/dom/imptests/html/webgl/test_texImage2D.html b/dom/imptests/html/webgl/test_texImage2D.html
new file mode 100644
index 000000000..2f769160d
--- /dev/null
+++ b/dom/imptests/html/webgl/test_texImage2D.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<title>texImage2D</title>
+<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger>
+<link rel=help href=https://www.khronos.org/registry/webgl/specs/latest/#5.14.8>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=common.js></script>
+
+<div id=log></div>
+<script>
+test(function() {
+ var gl = getGl();
+ assert_throws(new TypeError(), function() {
+ gl.texImage2D(0, 0, 0, 0, 0, window);
+ });
+ assert_throws(new TypeError(), function() {
+ gl.texImage2D(0, 0, 0, 0, 0, { get width() { throw 7 }, get height() { throw 7 }, data: new Uint8ClampedArray(10) });
+ });
+});
+</script>
diff --git a/dom/imptests/html/webgl/test_texSubImage2D.html b/dom/imptests/html/webgl/test_texSubImage2D.html
new file mode 100644
index 000000000..294b30c76
--- /dev/null
+++ b/dom/imptests/html/webgl/test_texSubImage2D.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<title>texSubImage2D</title>
+<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger>
+<link rel=help href=https://www.khronos.org/registry/webgl/specs/latest/#5.14.8>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=common.js></script>
+
+<div id=log></div>
+<script>
+test(function() {
+ var gl = getGl();
+ assert_throws(new TypeError(), function() {
+ gl.texSubImage2D(0, 0, 0, 0, 0, 0, window);
+ });
+ assert_throws(new TypeError(), function() {
+ gl.texSubImage2D(0, 0, 0, 0, 0, 0, { get width() { throw 7 }, get height() { throw 7 }, data: new Uint8ClampedArray(10) });
+ });
+});
+</script>
diff --git a/dom/imptests/html/webgl/test_uniformMatrixNfv.html b/dom/imptests/html/webgl/test_uniformMatrixNfv.html
new file mode 100644
index 000000000..f75cbcb99
--- /dev/null
+++ b/dom/imptests/html/webgl/test_uniformMatrixNfv.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<title>uniformMatrix*fv</title>
+<link rel=author href=mailto:Ms2ger@gmail.com title=Ms2ger>
+<link rel=help href=https://www.khronos.org/registry/webgl/specs/latest/#WebGLRenderingContext>
+<link rel=help href=http://dev.w3.org/2006/webapi/WebIDL/#es-boolean>
+<link rel=help href=http://es5.github.com/#x9.2>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=common.js></script>
+
+<div id=log></div>
+<script id="vshader" type="x-shader/x-vertex">
+uniform mat2 m2;
+uniform mat3 m3;
+uniform mat4 m4;
+</script>
+<script>
+var floatArray = function(n) {
+ var a = [];
+ for (var i = 0; i < n; ++i) {
+ a.push(1);
+ }
+ return a;
+};
+[2, 3, 4].forEach(function(n) {
+ test(function() {
+ var gl = getGl();
+ var f = "uniformMatrix" + n + "fv";
+ var loc = gl.getUniformLocation(gl.createProgram(), "m" + n);
+ gl[f](loc, { valueOf: function() { throw "Error"; } }, floatArray(n));
+ }, "Should not throw for " + n);
+});
+</script>