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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial