From 1972cbd20ee5589be45098943af084b05ca3554b Mon Sep 17 00:00:00 2001 From: JerryShih Date: Mon, 25 Apr 2016 22:04:00 +0200 Subject: [PATCH] Bug 1267100 - test case for webgl getFramebufferAttachmentParameter() call. r=jgilbert --HG-- extra : rebase_source : a8f5b4d19b3a8f8803ac5d820fb205681436dbb7 --- .../webgl-mochitest/test_fuzzing_bugs.html | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dom/canvas/test/webgl-mochitest/test_fuzzing_bugs.html b/dom/canvas/test/webgl-mochitest/test_fuzzing_bugs.html index 2007d64169d6..e41d9865ec66 100644 --- a/dom/canvas/test/webgl-mochitest/test_fuzzing_bugs.html +++ b/dom/canvas/test/webgl-mochitest/test_fuzzing_bugs.html @@ -53,9 +53,39 @@ function webGL2ClearBufferXXX_bug1252414() { ok(true, 'WebGL2 clearBufferXXX call during loseContext'); } +// Test gl function for multiple gl contexts switch. +function getFramebufferAttachmentParameter_bug1267100() +{ + var canvas1 = document.createElement('canvas'); + var canvas2 = document.createElement('canvas'); + + var gl1 = null; + gl1 = canvas1.getContext('webgl') || canvas1.getContext('experimental-webgl'); + if (!gl1) { + todo(false, 'WebGL getFramebufferAttachmentParameter test, webgl is unavailable.'); + return; + } + var gl2 = null; + gl2 = canvas2.getContext('webgl') || canvas2.getContext('experimental-webgl'); + if (!gl2) { + todo(false, 'WebGL getFramebufferAttachmentParameter test, webgl is unavailable.'); + return; + } + + gl1.bindFramebuffer(gl1.FRAMEBUFFER, gl1.createFramebuffer()); + gl2.scissor(0, 1, 2, 3); + // The gl call should still work even though we use another gl context before. + gl1.getFramebufferAttachmentParameter(gl1.FRAMEBUFFER, + gl1.COLOR_ATTACHMENT0, + gl1.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME); + + ok(true, 'WebGL test getFramebufferAttachmentParameter'); +} + function run() { webGL2ClearBufferXXX_bug1252414(); framebufferTexture2D_bug1257593(); + getFramebufferAttachmentParameter_bug1267100(); SimpleTest.finish(); }