aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wpt/web-platform-tests/webxr/webGLCanvasContext_create_xrcompatible.https.html
blob: 8b2f196fa76ecc102319bf9409cba143d0d35e13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<body>
  <script src=/resources/testharness.js></script>
  <script src=/resources/testharnessreport.js></script>
  <script src="resources/webxr_util.js"></script>
  <canvas id="webgl-canvas"></canvas>
  <script>
    xr_promise_test("An XR-compatible webglCanvasContext can be created",
      (t) => {
        return XRTest.simulateDeviceConnection({ supportsImmersive:true })
          .then( (controller) => {
            webglCanvas = document.getElementById('webgl-canvas');
            gl = webglCanvas.getContext('webgl', {xrCompatible: true});
            assert_true(gl.getContextAttributes().xrCompatible);

            // Check that an offscreen context behaves no different.
            let offscreenCanvas = document.createElement('canvas');
            let offscreenGl = webglCanvas.getContext(
              'webgl', {xrCompatible: true});
            assert_true(offscreenGl.getContextAttributes().xrCompatible);
          });
      });

  </script>
</body>