tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

screen-upmost-manual.https.html (1553B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>DeviceMotionEvent: A device lying flat on a horizontal surface with the screen upmost</title>
      5    <script src="/resources/testharness.js"></script>
      6    <script src="/resources/testharnessreport.js"></script>
      7    <link rel="author' title='Mosquito FP7">
      8    <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 -->
      9  </head>
     10  <body>
     11    <p>Put the device on a horizontal surface with the screen upmost.</p>
     12    <div id="log"></div>
     13    <script>
     14      var t = async_test();
     15      var run = false;
     16 
     17      /*
     18       * A device lying flat on a horizontal surface with the screen upmost
     19       * has an acceleration of zero and the following value for
     20       * accelerationIncludingGravity:
     21       * {
     22       *   x: 0,
     23       *   y: 0,
     24       *   z: 9.81
     25       * };
     26       */
     27      window.addEventListener("devicemotion", function(e) {
     28        if (!run) {
     29          run = true;
     30          t.step(function() {
     31            var gvt = e.accelerationIncludingGravity;
     32            var acc = e.acceleration;
     33            var rot = e.rotationRate;
     34 
     35            assert_approx_equals(gvt.x, 0, 1);
     36            assert_approx_equals(gvt.y, 0, 1);
     37            assert_approx_equals(gvt.z, 9.81, 1.5);
     38 
     39            assert_approx_equals(acc.x, 0, 1);
     40            assert_approx_equals(acc.y, 0, 1);
     41            assert_approx_equals(acc.z, 0, 1);
     42 
     43            assert_equals(rot, null);
     44          });
     45          t.done();
     46        }
     47      }, false);
     48    </script>
     49  </body>
     50 </html>