horizontal-surface-manual.https.html (1026B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>DeviceOrientationEvent: A device lying flat on a horizontal surface</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-12 --> 9 </head> 10 <body> 11 <p>Put the device on a horizontal surface to run the test.</p> 12 <div id="log"></div> 13 <script> 14 var gamma, beta; 15 var run = false; 16 window.addEventListener("deviceorientation", function(e) { 17 if (!run) { 18 run = true; 19 gamma = e.gamma; // Gamma : angle par rapport a x 20 beta = e.beta; // Beta : angle par rapport a y 21 } 22 }, false); 23 24 test(function() { 25 assert_approx_equals(gamma, 0, 2); 26 }, "X angle"); 27 28 test(function() { 29 assert_approx_equals(beta, 0, 2); 30 }, "Y angle"); 31 </script> 32 </body> 33 </html>