dom/tests/mochitest/pointerlock/file_locksvgelement.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/pointerlock/file_locksvgelement.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,64 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +  <!--
     1.7 +  https://bugzilla.mozilla.org/show_bug.cgi?id=633602
     1.8 +  -->
     1.9 +  <head>
    1.10 +    <title>Bug 633602</title>
    1.11 +    <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
    1.12 +    </script>
    1.13 +    <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
    1.14 +    </script>
    1.15 +    <script type="application/javascript" src="pointerlock_utils.js"></script>
    1.16 +    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.17 +  </head>
    1.18 +  <body>
    1.19 +    <a target="_blank"
    1.20 +       href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
    1.21 +      Mozilla Bug 633602</a>
    1.22 +    <p id="display"></p>
    1.23 +
    1.24 +    <svg width="100" height="100" viewbox="0 0 100 100">
    1.25 +        <rect id="svg-elem" x="10" y="10" width="50" height="50"
    1.26 +        fill="black" stroke="blue" stroke-width="2"/>
    1.27 +    </svg>
    1.28 +
    1.29 +    <pre id="test">
    1.30 +      <script type="application/javascript">
    1.31 +        /*
    1.32 +         * Test for Bug 633602
    1.33 +         * Test locking non-html element.
    1.34 +         */
    1.35 +
    1.36 +        SimpleTest.waitForExplicitFinish(1);
    1.37 +
    1.38 +        var elem,
    1.39 +          elemWasLocked = false;
    1.40 +
    1.41 +        document.addEventListener("mozpointerlockchange", function (e) {
    1.42 +          if (document.mozFullScreen &&
    1.43 +              document.mozPointerLockElement === elem) {
    1.44 +            elemWasLocked = true;
    1.45 +            document.mozExitPointerLock();
    1.46 +          } else {
    1.47 +            document.mozCancelFullScreen();
    1.48 +          }
    1.49 +        }, false);
    1.50 +
    1.51 +        document.addEventListener("mozfullscreenchange", function (e) {
    1.52 +          if (document.mozFullScreenElement === elem) {
    1.53 +            elem.mozRequestPointerLock();
    1.54 +          } else {
    1.55 +            ok(elemWasLocked, "Expected SVG elem to become locked.");
    1.56 +            SimpleTest.finish();
    1.57 +          }
    1.58 +        }, false);
    1.59 +
    1.60 +        function start() {
    1.61 +          elem = document.getElementById("svg-elem");
    1.62 +          elem.mozRequestFullScreen();
    1.63 +        }
    1.64 +      </script>
    1.65 +    </pre>
    1.66 +  </body>
    1.67 +</html>

mercurial