diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/orientation-event | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/orientation-event')
17 files changed, 674 insertions, 0 deletions
diff --git a/testing/web-platform/tests/orientation-event/free-fall-manual.html b/testing/web-platform/tests/orientation-event/free-fall-manual.html new file mode 100644 index 000000000..eaec7eb09 --- /dev/null +++ b/testing/web-platform/tests/orientation-event/free-fall-manual.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<html> + <head> + <title>DeviceMotionEvent: A device in free-fall, with the screen horizontal and upmost</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author' title='Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 --> + </head> + <body> + <p>Free fall the device to run the test, with the screen horizontal and upmost.</p> + <div id="log"></div> + <script> + var t = async_test(document.title); + var run = false; + + /* + * A device in free-fall, with the screen horizontal and upmost, + * has an accelerationIncludingGravity of zero and + * the following value for acceleration: + * { + * x: 0, + * y: 0, + * z: -9.81 + * }; + */ + window.addEventListener("devicemotion", function(e) { + if (!run) { + run = true; + t.step(function() { + var gvt = e.accelerationIncludingGravity; + var acc = e.acceleration; + + assert_approx_equals(gvt.x, 0, 1); + assert_approx_equals(gvt.y, 0, 1); + assert_approx_equals(gvt.z, 0, 1); + + assert_approx_equals(acc.x, 0, 1); + assert_approx_equals(acc.y, 0, 1); + assert_approx_equals(acc.z, -9.81, 1.5); + }); + t.done(); + } + }, false); + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/horizontal-surface-manual.html b/testing/web-platform/tests/orientation-event/horizontal-surface-manual.html new file mode 100644 index 000000000..0b7302e70 --- /dev/null +++ b/testing/web-platform/tests/orientation-event/horizontal-surface-manual.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> + <head> + <title>DeviceOrientationEvent: A device lying flat on a horizontal surface</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author' title='Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 --> + </head> + <body> + <p>Put the device on a horizontal surface to run the test.</p> + <div id="log"></div> + <script> + var gamma, beta; + var run = false; + window.addEventListener("deviceorientation", function(e) { + if (!run) { + run = true; + gamma = e.gamma; // Gamma : angle par rapport a x + beta = e.beta; // Beta : angle par rapport a y + } + }, false); + + test(function() { + assert_approx_equals(gamma, 0, 2); + }, "X angle"); + + test(function() { + assert_approx_equals(beta, 0, 2); + }, "Y angle"); + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/idlharness.html b/testing/web-platform/tests/orientation-event/idlharness.html new file mode 100644 index 000000000..d8139a800 --- /dev/null +++ b/testing/web-platform/tests/orientation-event/idlharness.html @@ -0,0 +1,84 @@ +<!DOCTYPE html> +<meta charset="utf-8" /> +<title>DeviceOrientation Event IDL tests</title> +<link rel="author" title="Intel" href="http://www.intel.com"> +<link rel="help" href="http://dev.w3.org/geo/api/spec-source-orientation.html"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/WebIDLParser.js"></script> +<script src="/resources/idlharness.js"></script> +<style> + pre { + display: none; + } +</style> +<div id="log"></div> + +<pre id="untested_idl"> +interface Event { +}; + +dictionary EventInit { +}; +</pre> + +<pre id='idl'> +[Constructor(DOMString type, optional DeviceOrientationEventInit eventInitDict)] +interface DeviceOrientationEvent : Event { + readonly attribute double? alpha; + readonly attribute double? beta; + readonly attribute double? gamma; + readonly attribute boolean absolute; +}; + +dictionary DeviceOrientationEventInit : EventInit { + double? alpha; + double? beta; + double? gamma; + boolean absolute; +}; + +[Callback, NoInterfaceObject] +interface DeviceAcceleration { + readonly attribute double? x; + readonly attribute double? y; + readonly attribute double? z; +}; + +[Callback, NoInterfaceObject] +interface DeviceRotationRate { + readonly attribute double? alpha; + readonly attribute double? beta; + readonly attribute double? gamma; +}; + +[Constructor(DOMString type, optional DeviceMotionEventInit eventInitDict)] +interface DeviceMotionEvent : Event { + readonly attribute DeviceAcceleration? acceleration; + readonly attribute DeviceAcceleration? accelerationIncludingGravity; + readonly attribute DeviceRotationRate? rotationRate; + readonly attribute double? interval; +}; + +dictionary DeviceMotionEventInit : EventInit { + DeviceAcceleration? acceleration; + DeviceAcceleration? accelerationIncludingGravity; + DeviceRotationRate? rotationRate; + double? interval; +}; +</pre> + +<script> +"use strict"; +var idl_array = new IdlArray(); + +idl_array.add_untested_idls(document.getElementById("untested_idl").textContent); +idl_array.add_idls(document.getElementById("idl").textContent); + +idl_array.add_objects({ + DeviceOrientationEvent: ['new DeviceOrientationEvent("foo")'], + DeviceMotionEvent: ['new DeviceMotionEvent("foo")'], +}); + +idl_array.test(); +</script> diff --git a/testing/web-platform/tests/orientation-event/screen-upmost-manual.html b/testing/web-platform/tests/orientation-event/screen-upmost-manual.html new file mode 100644 index 000000000..87ad62c58 --- /dev/null +++ b/testing/web-platform/tests/orientation-event/screen-upmost-manual.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<html> + <head> + <title>DeviceMotionEvent: A device lying flat on a horizontal surface with the screen upmost</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author' title='Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 --> + </head> + <body> + <p>Put the device on a horizontal surface with the screen upmost.</p> + <div id="log"></div> + <script> + var t = async_test(document.title); + var run = false; + + /* + * A device lying flat on a horizontal surface with the screen upmost + * has an acceleration of zero and the following value for + * accelerationIncludingGravity: + * { + * x: 0, + * y: 0, + * z: 9.81 + * }; + */ + window.addEventListener("devicemotion", function(e) { + if (!run) { + run = true; + t.step(function() { + var gvt = e.accelerationIncludingGravity; + var acc = e.acceleration; + var rot = e.rotationRate; + + assert_approx_equals(gvt.x, 0, 1); + assert_approx_equals(gvt.y, 0, 1); + assert_approx_equals(gvt.z, 9.81, 1.5); + + assert_approx_equals(acc.x, 0, 1); + assert_approx_equals(acc.y, 0, 1); + assert_approx_equals(acc.z, 0, 1); + + assert_equals(rot, null); + }); + t.done(); + } + }, false); + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/screen-upright-manual.html b/testing/web-platform/tests/orientation-event/screen-upright-manual.html new file mode 100644 index 000000000..0896a3810 --- /dev/null +++ b/testing/web-platform/tests/orientation-event/screen-upright-manual.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<html> + <head> + <title>DeviceMotionEvent: A device with the screen upright</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author' title='Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 --> + </head> + <body> + <p>Put the device with the screen upright.</p> + <div id="log"></div> + <script> + var t = async_test(document.title); + var run = false; + + /* + * A device with the screen upright has an acceleration of zero + * and the following value for accelerationIncludingGravity: + * { + * x: 0, + * y: -9.81, + * z: 0 + * }; + */ + window.addEventListener("devicemotion", function(e) { + if (!run) { + run = true; + t.step(function() { + var gvt = e.accelerationIncludingGravity; + var acc = e.acceleration; + var rot = e.rotationRate; + + assert_approx_equals(gvt.x, 0, 1); + assert_approx_equals(gvt.y, -9.81, 1.5); + assert_approx_equals(gvt.z, 0, 1); + + assert_approx_equals(acc.x, 0, 1); + assert_approx_equals(acc.y, 0, 1); + assert_approx_equals(acc.z, 0, 1); + + assert_equals(rot, null); + }); + t.done(); + } + }, false); + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/t001-manual.html b/testing/web-platform/tests/orientation-event/t001-manual.html new file mode 100644 index 000000000..3f8c46d94 --- /dev/null +++ b/testing/web-platform/tests/orientation-event/t001-manual.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<html> + <head> + <title>User agents implementing this specification must provide a new DOM event, named deviceorientation</title> + <meta name=viewport content="width=device-width, maximum-scale=1.0"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author" title="Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 --> + </head> + <body> + <p>Rotate the device to run the test.</p> + <div id="log"></div> + <script> + var t = async_test(); + var run = false; + window.addEventListener("deviceorientation", function(e) { + if (!run) { + run = true; + t.done(); + } + }, false); + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/t002-manual.html b/testing/web-platform/tests/orientation-event/t002-manual.html new file mode 100644 index 000000000..13acb4683 --- /dev/null +++ b/testing/web-platform/tests/orientation-event/t002-manual.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> + <head> + <title>The corresponding event must be of type DeviceOrientationEvent and must fire on the window object.</title> + <meta name=viewport content="width=device-width, maximum-scale=1.0"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author" title="Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 --> + </head> + <body> + <p>Rotate the device to run the tests.</p> + <div id="log"></div> + <script> + var t1 = async_test("The corresponding event must be of type DeviceOrientationEvent"); + var t2 = async_test("The corresponding event must fire on the window object"); + var run = false; + window.addEventListener("deviceorientation", function(e) { + if (!run) { + run = true; + var _this = this; + t1.step(function() { + assert_equals(e.type, "deviceorientation"); + }); + t1.done(); + t2.step(function() { + assert_equals(_this, window); + }); + t2.done(); + } + }, false); + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/t003-manual.html b/testing/web-platform/tests/orientation-event/t003-manual.html new file mode 100644 index 000000000..210ebbb57 --- /dev/null +++ b/testing/web-platform/tests/orientation-event/t003-manual.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> + <head> + <title>User agents must also provide an event handler IDL attribute [HTML5] named ondeviceorientation on the window object</title> + <meta name=viewport content="width=device-width, maximum-scale=1.0"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author" title="Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 --> + </head> + <body> + <p>Rotate the device to run the tests.</p> + <div id="log"></div> + <script> + var t1 = async_test("Provide an event handler IDL attribute [HTML5] named ondeviceorientation"); + var t2 = async_test("The type of this event handler must be 'DeviceOrientationEvent'"); + var run = false; + window.ondeviceorientation = function(e) { + if (!run) { + run = true; + t1.step(function() { + assert_equals(e.type, "deviceorientation"); + }); + t1.done(); + t2.step(function() { + assert_true(e.constructor.lastIndexOf("DeviceOrientationEvent") != -1); + }); + t2.done(); + } + }; + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/t006-manual.html b/testing/web-platform/tests/orientation-event/t006-manual.html new file mode 100644 index 000000000..204972ace --- /dev/null +++ b/testing/web-platform/tests/orientation-event/t006-manual.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> + <head> + <title>Rotate the device frame around its z axis</title> + <meta name=viewport content="width=device-width, maximum-scale=1.0"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author" title="Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 --> + </head> + <body> + <p>Rotate the device frame around its z axis to run the test.</p> + <div id="log"></div> + <script> + var alpha = 0; + var run = false; + window.addEventListener("deviceorientation", function(e) { + if (!run) { + run = true; + alpha = e.alpha; + } + }, false); + + test(function() { + assert_true(alpha > 0 && alpha < 360); + }, "Alpha is between 0 and 360"); + + test(function() { + assert_false(alpha > -2 && alpha < 2); + }, "Alpha is not around zero (between 0 and 2)"); + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/t009-manual.html b/testing/web-platform/tests/orientation-event/t009-manual.html new file mode 100644 index 000000000..8b8cdc866 --- /dev/null +++ b/testing/web-platform/tests/orientation-event/t009-manual.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> + <head> + <title>Rotate the device frame around its x axis</title> + <meta name=viewport content="width=device-width, maximum-scale=1.0"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author" title="Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 --> + </head> + <body> + <p>Rotate the device frame around its x axis to run the test.</p> + <div id="log"></div> + <script> + var beta = 180; + var run = false; + window.addEventListener("deviceorientation", function(e) { + if (!run) { + run = true; + beta = e.beta; + } + }, false); + + test(function() { + assert_true(beta > -180 && beta < 180); + }, "Beta is between -180 and 180"); + + test(function() { + assert_false(beta > -2 && beta < 2); + }, "Beta is not around zero (between -2 and 2)"); + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/t010-manual.html b/testing/web-platform/tests/orientation-event/t010-manual.html new file mode 100644 index 000000000..e8a6c0b52 --- /dev/null +++ b/testing/web-platform/tests/orientation-event/t010-manual.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> + <head> + <title>Rotate the device frame around its y axis</title> + <meta name=viewport content="width=device-width, maximum-scale=1.0"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author" title="Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 --> + </head> + <body> + <p>Rotate the device frame around its y axis to run the test.</p> + <div id="log"></div> + <script> + var gamma = 90; + var run = false; + window.addEventListener("deviceorientation", function(e) { + if (!run) { + run = true; + gamma = e.gamma; + } + }, false); + + test(function() { + assert_true(gamma > -90 && gamma < 90); + }, "Gamma is between -90 and 90"); + + test(function() { + assert_false(gamma > -2 && gamma < 2); + }, "Gamma is not around zero (between -2 and 2)"); + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/t012-manual.html b/testing/web-platform/tests/orientation-event/t012-manual.html new file mode 100644 index 000000000..cae4979ff --- /dev/null +++ b/testing/web-platform/tests/orientation-event/t012-manual.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<html> + <head> + <title>Implementations that are unable to provide all three angles must set the values of the unknown angles to null</title> + <meta name=viewport content="width=device-width, maximum-scale=1.0"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author" title="Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 --> + </head> + <body> + <p>Precondition: implementation is unable to provide all three angles</p> + <p>Rotate the device to run the test.</p> + <div id="log"></div> + <script> + var gamma, beta, alpha; + var run = false; + window.addEventListener("deviceorientation", function(e) { + if (!run) { + run = true; + gamma = e.gamma; // Gamma : angle par rapport a x + beta = e.beta; // Beta : angle par rapport a y + alpha = e.alpha; // Alpha : orientation (N-S-E-O) + } + }, false); + + test(function() { + assert_equals(gamma, null); + }, "Check if gamma is set to null"); + + test(function() { + assert_equals(beta, null); + }, "Check if beta is set to null"); + + test(function() { + assert_equals(alpha, null); + }, "Check if alpha is set to null"); + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/t021-manual.html b/testing/web-platform/tests/orientation-event/t021-manual.html new file mode 100644 index 000000000..4d421c926 --- /dev/null +++ b/testing/web-platform/tests/orientation-event/t021-manual.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<html> + <head> + <title>User agents implementing this specification must provide a new DOM event, named devicemotion</title> + <meta name=viewport content="width=device-width, maximum-scale=1.0"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author" title="Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 --> + </head> + <body> + <p>Move the device to run the test.</p> + <div id="log"></div> + <script> + var t = async_test(); + var run = false; + window.addEventListener("devicemotion", function(e) { + if (!run) { + run = true; + t.done(); + } + }, false); + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/t022-manual.html b/testing/web-platform/tests/orientation-event/t022-manual.html new file mode 100644 index 000000000..9f61fe2d3 --- /dev/null +++ b/testing/web-platform/tests/orientation-event/t022-manual.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> + <head> + <title>The corresponding event must be of type DeviceOrientationEvent and must fire on the window object</title> + <meta name=viewport content="width=device-width, maximum-scale=1.0"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author" title="Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 --> + </head> + <body> + <p>Move the device to run the test.</p> + <div id="log"></div> + <script> + var t1 = async_test("The corresponding event must be of type DeviceMotionEvent"); + var t2 = async_test("The corresponding event must fire on the window object"); + var run = false; + window.addEventListener("devicemotion", function(e) { + if (!run) { + run = true; + var _this = this; + t1.step(function() { + assert_equals(e.type, "devicemotion"); + }); + t1.done(); + t2.step(function() { + assert_equals(_this, window); + }); + t2.done(); + } + }, false); + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/t023-manual.html b/testing/web-platform/tests/orientation-event/t023-manual.html new file mode 100644 index 000000000..6202777f0 --- /dev/null +++ b/testing/web-platform/tests/orientation-event/t023-manual.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> + <head> + <title>User agents must also provide an event handler IDL attribute HTML5 named ondevicemotion on the window object</title> + <meta name=viewport content="width=device-width, maximum-scale=1.0"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author" title="Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 --> + </head> + <body> + <p>Move the device to run the test.</p> + <div id="log"></div> + <script> + var t1 = async_test("User agents provide an event handler IDL attribute HTML5 named ondevicemotion"); + var t2 = async_test("The type of this event handler must be 'DeviceMotionEvent'"); + var run = false; + window.ondevicemotion = function(e) { + if (!run) { + run = true; + t1.step(function() { + assert_equals(e.type, "devicemotion"); + }); + t1.done(); + t2.step(function() { + assert_true(e.constructor.lastIndexOf("DeviceMotionEvent") != -1); + }); + t2.done(); + } + }; + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/t025-manual.html b/testing/web-platform/tests/orientation-event/t025-manual.html new file mode 100644 index 000000000..9489855fc --- /dev/null +++ b/testing/web-platform/tests/orientation-event/t025-manual.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html> + <head> + <title>Implementations that are unable to provide acceleration data without the effect of gravity may instead supply the acceleration including the effect of gravity</title> + <meta name=viewport content="width=device-width, maximum-scale=1.0"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author" title="Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 --> + </head> + <body> + <p>Move the device to run the test.</p> + <div id="log"></div> + <script> + var t1 = async_test("Implementation is unable to provide 'acceleration' property"); + var t2 = async_test("Implementation is able to provide 'acceleration IncludingGravity' property"); + var run = false; + window.ondevicemotion = function(e) { + if (!run) { + run = true; + t1.step(function() { + assert_equals(e.acceleration, null); + }); + t1.done(); + t2.step(function() { + var eaccgvt = e.accelerationIncludingGravity; + assert_equals(typeof eaccgvt, "object"); + assert_not_equals(eaccgvt.x, 0); + assert_not_equals(eaccgvt.y, 0); + assert_not_equals(eaccgvt.z, 0); + }); + t2.done(); + } + }; + </script> + </body> +</html> + diff --git a/testing/web-platform/tests/orientation-event/t028-manual.html b/testing/web-platform/tests/orientation-event/t028-manual.html new file mode 100644 index 000000000..669c4e47e --- /dev/null +++ b/testing/web-platform/tests/orientation-event/t028-manual.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<html> + <head> + <title>The interval property must be expressed in milliseconds. It must be a constant, to simplify filtering of the data by the Web application</title> + <meta name=viewport content="width=device-width, maximum-scale=1.0"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author" title="Mosquito FP7"> + <link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 --> + </head> + <body> + <p>Move the device to run the test.</p> + <div id="log"></div> + <script> + var t = async_test("The interval property must be different to zero and must be a constant"); + var inter1 = 0; + var inter2 = 0; + var run = false; + window.addEventListener("devicemotion", function(e) { + if (!run) { + run = true; + t.step(function() { + if (inter1 == 0) { + inter2 = e.interval; + } + inter1 = e.interval; + assert_not_equals(inter1, 0); + assert_not_equals(inter1, inter2); + }); + t.done(); + } + }, false); + </script> + </body> +</html> + |