mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
53d9f3b057
--HG-- extra : rebase_source : 7cbf9ac11b81506a2ffe0a5c3a34ecb78fe54f5b
80 lines
2.2 KiB
HTML
80 lines
2.2 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=662678
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 662678</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=662678">Mozilla Bug 662678</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
|
|
/** Test for Bug 662678 **/
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
var checkMotion = function(event) {
|
|
window.removeEventListener("devicemotion", checkMotion, true);
|
|
|
|
is(event.acceleration.x, 1.5);
|
|
is(event.acceleration.y, 2.5);
|
|
is(event.acceleration.z, 3.5);
|
|
|
|
is(event.accelerationIncludingGravity.x, 4.5);
|
|
is(event.accelerationIncludingGravity.y, 5.5);
|
|
is(event.accelerationIncludingGravity.z, 6.5);
|
|
|
|
is(event.rotationRate.alpha, 7.5);
|
|
is(event.rotationRate.beta, 8.5);
|
|
is(event.rotationRate.gamma, 9.5);
|
|
|
|
var e = document.createEvent("DeviceMotionEvent");
|
|
e.initDeviceMotionEvent('devicemotion', true, true,
|
|
null, null, null, 0);
|
|
is(e.acceleration, null);
|
|
is(e.accelerationIncludingGravity, null);
|
|
is(e.rotationRate, null);
|
|
|
|
e.initDeviceMotionEvent('devicemotion', true, true,
|
|
{}, {}, {}, 0);
|
|
|
|
ok(isNaN(e.acceleration.x));
|
|
ok(isNaN(e.acceleration.y));
|
|
ok(isNaN(e.acceleration.z));
|
|
|
|
ok(isNaN(e.accelerationIncludingGravity.x));
|
|
ok(isNaN(e.accelerationIncludingGravity.y));
|
|
ok(isNaN(e.accelerationIncludingGravity.z));
|
|
|
|
ok(isNaN(e.rotationRate.alpha));
|
|
ok(isNaN(e.rotationRate.beta));
|
|
ok(isNaN(e.rotationRate.gamma));
|
|
|
|
SimpleTest.finish();
|
|
};
|
|
|
|
window.addEventListener("devicemotion", checkMotion, true);
|
|
|
|
var event = DeviceMotionEvent;
|
|
ok(!!event, "Should have seen DeviceMotionEvent!");
|
|
|
|
event = document.createEvent("DeviceMotionEvent");
|
|
event.initDeviceMotionEvent('devicemotion', true, true,
|
|
{x:1.5,y:2.5,z:3.5},
|
|
{x:4.5,y:5.5,z:6.5},
|
|
{alpha:7.5,beta:8.5,gamma:9.5},
|
|
0);
|
|
window.dispatchEvent(event);
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|