Bug 1290333 - Add framebuffer size test case; r?ethlin, jgilbert
MozReview-Commit-ID: 3qhBAPiZEpS
--- a/dom/canvas/test/webgl-mochitest/mochitest.ini
+++ b/dom/canvas/test/webgl-mochitest/mochitest.ini
@@ -48,16 +48,17 @@ fail-if = (os == 'android') || (os == 'w
[regress/test_bug_1268096.html]
[test_backends.html]
[test_backbuffer_channels.html]
fail-if = (os == 'b2g')
[test_depth_readpixels.html]
+[test_canvas_size.html]
[test_capture.html]
support-files = ../captureStream_common.js
# Even though we use ../ here, in the test HTML, we need to omit this. Sub-CWD relative
# paths are fine, but they locate the file and dump it in the current directory.
[test_cubemap_must_be_square.html]
[test_depth_tex_lazy_clear.html]
[test_draw.html]
[test_fb_param.html]
new file mode 100644
--- /dev/null
+++ b/dom/canvas/test/webgl-mochitest/test_canvas_size.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset='UTF-8'>
+ <script src='/tests/SimpleTest/SimpleTest.js'></script>
+ <link rel='stylesheet' href='/tests/SimpleTest/test.css'>
+</head>
+<title>WebGL test: Framebuffer maximum size test. (Bug 1290333)</title>
+<body>
+<script>
+function TestSize(contextName, testSize) {
+ var attributes = {
+ antialias: false,
+ };
+
+ var canvas = document.createElement('canvas');
+ var gl = canvas.getContext(contextName, attributes);
+
+ if (!gl) {
+ todo(false, contextName + 'is unavailable.');
+ return;
+ }
+ gl.canvas.width = testSize;
+ gl.canvas.height = testSize;
+
+ ok(true, contextName + 'test complete.');
+}
+
+function run() {
+ TestSize('webgl', 16384);
+ TestSize('webgl2', 16384);
+
+ ok(true, 'Test complete.');
+ SimpleTest.finish();
+}
+
+////////////////////////////////////////
+
+SimpleTest.waitForExplicitFinish();
+
+try {
+ var prefPairList = [
+ ['webgl.force-enabled', true],
+ ];
+ var prefEnv = {'set': prefPairList};
+ SpecialPowers.pushPrefEnv(prefEnv, run);
+} catch (e) {
+ warning('No SpecialPowers, but trying WebGL2 anyway...');
+ run();
+}
+
+</script>
+</body>
+</html>