free-fall-manual.https.html (1481B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>DeviceMotionEvent: A device in free-fall, with the screen horizontal and 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>Free fall the device to run the test, with the screen horizontal and upmost.</p> 12 <div id="log"></div> 13 <script> 14 var t = async_test(); 15 var run = false; 16 17 /* 18 * A device in free-fall, with the screen horizontal and upmost, 19 * has an accelerationIncludingGravity of zero and 20 * the following value for acceleration: 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 34 assert_approx_equals(gvt.x, 0, 1); 35 assert_approx_equals(gvt.y, 0, 1); 36 assert_approx_equals(gvt.z, 0, 1); 37 38 assert_approx_equals(acc.x, 0, 1); 39 assert_approx_equals(acc.y, 0, 1); 40 assert_approx_equals(acc.z, -9.81, 1.5); 41 }); 42 t.done(); 43 } 44 }, false); 45 </script> 46 </body> 47 </html>