Bug 1290333 - Add framebuffer size test case; r?ethlin, jgilbert draft
authordmu@mozilla.com <dmu@mozilla.com>
Mon, 15 Aug 2016 10:05:22 +0000
changeset 413401 c331e2634b80663bd895f1856d89686beea08d6c
parent 412834 b1156b0eb96fcb49966b20e5fcf6a01f634ea2ee
child 531234 993fa0f7bef8db3e61db215c82fb580300d338da
push id29436
push userbmo:dmu@mozilla.com
push dateWed, 14 Sep 2016 09:43:38 +0000
reviewersethlin, jgilbert
bugs1290333
milestone51.0a1
Bug 1290333 - Add framebuffer size test case; r?ethlin, jgilbert MozReview-Commit-ID: 3qhBAPiZEpS
dom/canvas/test/webgl-mochitest/mochitest.ini
dom/canvas/test/webgl-mochitest/test_canvas_size.html
--- 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>