content/canvas/test/webgl-mochitest/test_webgl_request_mismatch.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <title>WebGL test: Mismatched 'webgl' and 'experimental-webgl' context requests</title>
michael@0 3 <script src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 4 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
michael@0 5 <body>
michael@0 6 <canvas id="c1"></canvas>
michael@0 7 <canvas id="c2"></canvas>
michael@0 8 <canvas id="c3"></canvas>
michael@0 9 <canvas id="c4"></canvas>
michael@0 10 <script>
michael@0 11
michael@0 12 function testContextRetrieval(canvasId, creationId, requestId) {
michael@0 13 var canvas = document.getElementById(canvasId);
michael@0 14 ok(canvas, 'Invalid `canvasId`: ' + canvasId);
michael@0 15
michael@0 16 var createdGL = canvas.getContext(creationId);
michael@0 17 if (!createdGL)
michael@0 18 return; // No WebGL on this machine?
michael@0 19
michael@0 20 var requestedGL = canvas.getContext(requestId);
michael@0 21 if (creationId == requestId) {
michael@0 22 ok(requestedGL, 'Request for \'' + requestId + '\' on from \'' + creationId + '\' should succeed.');
michael@0 23 ok(requestedGL == createdGL, 'Request for \'' + requestId + '\' on from \'' + creationId + '\' should match.');
michael@0 24 } else {
michael@0 25 ok(!requestedGL, 'Request for \'' + requestId + '\' on from \'' + creationId + '\' should fail.');
michael@0 26 }
michael@0 27 }
michael@0 28
michael@0 29 testContextRetrieval('c1', 'experimental-webgl', 'webgl');
michael@0 30 testContextRetrieval('c2', 'webgl', 'experimental-webgl');
michael@0 31 testContextRetrieval('c3', 'experimental-webgl', 'experimental-webgl');
michael@0 32 testContextRetrieval('c4', 'webgl', 'webgl');
michael@0 33
michael@0 34 </script>
michael@0 35

mercurial