diff options
Diffstat (limited to 'LayoutTests/fast/dom/DeviceMotion')
10 files changed, 290 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/DeviceMotion/create-event-expected.txt b/LayoutTests/fast/dom/DeviceMotion/create-event-expected.txt new file mode 100644 index 0000000..fdc40c4 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceMotion/create-event-expected.txt @@ -0,0 +1,30 @@ +Tests that document.createEvent() works with DeviceMotinEvent. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS typeof event == 'object' is true +PASS 'type' in event is true +PASS 'bubbles' in event is true +PASS 'cancelable' in event is true +PASS 'xAcceleration' in event is true +PASS 'yAcceleration' in event is true +PASS 'zAcceleration' in event is true +PASS 'xRotationRate' in event is true +PASS 'yRotationRate' in event is true +PASS 'zRotationRate' in event is true +PASS 'interval' in event is true +PASS typeof event.type == 'string' is true +PASS typeof event.bubbles == 'boolean' is true +PASS typeof event.cancelable == 'boolean' is true +PASS typeof event.xAcceleration == 'object' is true +PASS typeof event.yAcceleration == 'object' is true +PASS typeof event.zAcceleration == 'object' is true +PASS typeof event.xRotationRate == 'object' is true +PASS typeof event.yRotationRate == 'object' is true +PASS typeof event.zRotationRate == 'object' is true +PASS typeof event.interval == 'object' is true +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceMotion/create-event.html b/LayoutTests/fast/dom/DeviceMotion/create-event.html new file mode 100644 index 0000000..545f962 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceMotion/create-event.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/create-event.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt b/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt new file mode 100644 index 0000000..0eabe35 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt @@ -0,0 +1,65 @@ +Tests the optional properties of DeviceMotionEvent. Each property should be null if not set, or set to null or undefined. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +event = document.createEvent('DeviceMotionEvent') +PASS event.xAcceleration == null is true +PASS event.yAcceleration == null is true +PASS event.zAcceleration == null is true +PASS event.xRotationRate == null is true +PASS event.yRotationRate == null is true +PASS event.zRotationRate == null is true +PASS event.interval == null is true +event.initDeviceMotionEvent('', false, false, 0, 1, 2, 3, 4, 5, 6) +PASS event.xAcceleration == 0 is true +PASS event.yAcceleration == 1 is true +PASS event.zAcceleration == 2 is true +PASS event.xRotationRate == 3 is true +PASS event.yRotationRate == 4 is true +PASS event.zRotationRate == 5 is true +PASS event.interval == 6 is true +event.initDeviceMotionEvent() +PASS event.xAcceleration == null is true +PASS event.yAcceleration == null is true +PASS event.zAcceleration == null is true +PASS event.xRotationRate == null is true +PASS event.yRotationRate == null is true +PASS event.zRotationRate == null is true +PASS event.interval == null is true +event.initDeviceMotionEvent('', false, false, [], [], [], [], [], [], []) +PASS event.xAcceleration == 0 is true +PASS event.yAcceleration == 0 is true +PASS event.zAcceleration == 0 is true +PASS event.xRotationRate == 0 is true +PASS event.yRotationRate == 0 is true +PASS event.zRotationRate == 0 is true +PASS event.interval == 0 is true +event.initDeviceMotionEvent('', false, false, undefined, undefined, undefined, undefined, undefined, undefined, undefined) +PASS event.xAcceleration == null is true +PASS event.yAcceleration == null is true +PASS event.zAcceleration == null is true +PASS event.xRotationRate == null is true +PASS event.yRotationRate == null is true +PASS event.zRotationRate == null is true +PASS event.interval == null is true +event.initDeviceMotionEvent('', false, false, '', '', '', '', '', '', '') +PASS event.xAcceleration == 0 is true +PASS event.yAcceleration == 0 is true +PASS event.zAcceleration == 0 is true +PASS event.xRotationRate == 0 is true +PASS event.yRotationRate == 0 is true +PASS event.zRotationRate == 0 is true +PASS event.interval == 0 is true +event.initDeviceMotionEvent('', false, false, null, null, null, null, null, null, null) +PASS event.xAcceleration == null is true +PASS event.yAcceleration == null is true +PASS event.zAcceleration == null is true +PASS event.xRotationRate == null is true +PASS event.yRotationRate == null is true +PASS event.zRotationRate == null is true +PASS event.interval == null is true +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceMotion/optional-event-properties.html b/LayoutTests/fast/dom/DeviceMotion/optional-event-properties.html new file mode 100644 index 0000000..212669f --- /dev/null +++ b/LayoutTests/fast/dom/DeviceMotion/optional-event-properties.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/optional-event-properties.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/DeviceMotion/script-tests/TEMPLATE.html b/LayoutTests/fast/dom/DeviceMotion/script-tests/TEMPLATE.html new file mode 100644 index 0000000..b31963d --- /dev/null +++ b/LayoutTests/fast/dom/DeviceMotion/script-tests/TEMPLATE.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="YOUR_JS_FILE_HERE"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/DeviceMotion/script-tests/create-event.js b/LayoutTests/fast/dom/DeviceMotion/script-tests/create-event.js new file mode 100644 index 0000000..167329d --- /dev/null +++ b/LayoutTests/fast/dom/DeviceMotion/script-tests/create-event.js @@ -0,0 +1,29 @@ +description("Tests that document.createEvent() works with DeviceMotinEvent."); + +var event = document.createEvent('DeviceMotionEvent'); + +shouldBeTrue("typeof event == 'object'"); + +shouldBeTrue("'type' in event"); +shouldBeTrue("'bubbles' in event"); +shouldBeTrue("'cancelable' in event"); +shouldBeTrue("'xAcceleration' in event"); +shouldBeTrue("'yAcceleration' in event"); +shouldBeTrue("'zAcceleration' in event"); +shouldBeTrue("'xRotationRate' in event"); +shouldBeTrue("'yRotationRate' in event"); +shouldBeTrue("'zRotationRate' in event"); +shouldBeTrue("'interval' in event"); + +shouldBeTrue("typeof event.type == 'string'"); +shouldBeTrue("typeof event.bubbles == 'boolean'"); +shouldBeTrue("typeof event.cancelable == 'boolean'"); +shouldBeTrue("typeof event.xAcceleration == 'object'"); +shouldBeTrue("typeof event.yAcceleration == 'object'"); +shouldBeTrue("typeof event.zAcceleration == 'object'"); +shouldBeTrue("typeof event.xRotationRate == 'object'"); +shouldBeTrue("typeof event.yRotationRate == 'object'"); +shouldBeTrue("typeof event.zRotationRate == 'object'"); +shouldBeTrue("typeof event.interval == 'object'"); + +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceMotion/script-tests/optional-event-properties.js b/LayoutTests/fast/dom/DeviceMotion/script-tests/optional-event-properties.js new file mode 100644 index 0000000..ab9b53b --- /dev/null +++ b/LayoutTests/fast/dom/DeviceMotion/script-tests/optional-event-properties.js @@ -0,0 +1,68 @@ +description("Tests the optional properties of DeviceMotionEvent. Each property should be null if not set, or set to null or undefined."); + +var event; + +evalAndLog("event = document.createEvent('DeviceMotionEvent')"); +shouldBeTrue("event.xAcceleration == null"); +shouldBeTrue("event.yAcceleration == null"); +shouldBeTrue("event.zAcceleration == null"); +shouldBeTrue("event.xRotationRate == null"); +shouldBeTrue("event.yRotationRate == null"); +shouldBeTrue("event.zRotationRate == null"); +shouldBeTrue("event.interval == null"); + +evalAndLog("event.initDeviceMotionEvent('', false, false, 0, 1, 2, 3, 4, 5, 6)"); +shouldBeTrue("event.xAcceleration == 0"); +shouldBeTrue("event.yAcceleration == 1"); +shouldBeTrue("event.zAcceleration == 2"); +shouldBeTrue("event.xRotationRate == 3"); +shouldBeTrue("event.yRotationRate == 4"); +shouldBeTrue("event.zRotationRate == 5"); +shouldBeTrue("event.interval == 6"); + +evalAndLog("event.initDeviceMotionEvent()"); +shouldBeTrue("event.xAcceleration == null"); +shouldBeTrue("event.yAcceleration == null"); +shouldBeTrue("event.zAcceleration == null"); +shouldBeTrue("event.xRotationRate == null"); +shouldBeTrue("event.yRotationRate == null"); +shouldBeTrue("event.zRotationRate == null"); +shouldBeTrue("event.interval == null"); + +evalAndLog("event.initDeviceMotionEvent('', false, false, [], [], [], [], [], [], [])"); +shouldBeTrue("event.xAcceleration == 0"); +shouldBeTrue("event.yAcceleration == 0"); +shouldBeTrue("event.zAcceleration == 0"); +shouldBeTrue("event.xRotationRate == 0"); +shouldBeTrue("event.yRotationRate == 0"); +shouldBeTrue("event.zRotationRate == 0"); +shouldBeTrue("event.interval == 0"); + +evalAndLog("event.initDeviceMotionEvent('', false, false, undefined, undefined, undefined, undefined, undefined, undefined, undefined)"); +shouldBeTrue("event.xAcceleration == null"); +shouldBeTrue("event.yAcceleration == null"); +shouldBeTrue("event.zAcceleration == null"); +shouldBeTrue("event.xRotationRate == null"); +shouldBeTrue("event.yRotationRate == null"); +shouldBeTrue("event.zRotationRate == null"); +shouldBeTrue("event.interval == null"); + +evalAndLog("event.initDeviceMotionEvent('', false, false, '', '', '', '', '', '', '')"); +shouldBeTrue("event.xAcceleration == 0"); +shouldBeTrue("event.yAcceleration == 0"); +shouldBeTrue("event.zAcceleration == 0"); +shouldBeTrue("event.xRotationRate == 0"); +shouldBeTrue("event.yRotationRate == 0"); +shouldBeTrue("event.zRotationRate == 0"); +shouldBeTrue("event.interval == 0"); + +evalAndLog("event.initDeviceMotionEvent('', false, false, null, null, null, null, null, null, null)"); +shouldBeTrue("event.xAcceleration == null"); +shouldBeTrue("event.yAcceleration == null"); +shouldBeTrue("event.zAcceleration == null"); +shouldBeTrue("event.xRotationRate == null"); +shouldBeTrue("event.yRotationRate == null"); +shouldBeTrue("event.zRotationRate == null"); +shouldBeTrue("event.interval == null"); + +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceMotion/script-tests/window-property.js b/LayoutTests/fast/dom/DeviceMotion/script-tests/window-property.js new file mode 100644 index 0000000..3d22ba8 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceMotion/script-tests/window-property.js @@ -0,0 +1,32 @@ +description("Tests that the window.DeviceMotionEvent and window.ondevicemotion properties are present."); + +function hasDeviceMotionEventProperty() +{ + for (var property in window) { + if (property == "DeviceMotionEvent") + return true; + } + return false; +} + +shouldBeTrue("typeof window.DeviceMotionEvent == 'object'"); +shouldBeFalse("typeof window.DeviceMotionEvent == 'function'"); +shouldBeTrue("hasDeviceMotionEventProperty()"); +shouldBeTrue("'DeviceMotionEvent' in window"); +shouldBeTrue("window.hasOwnProperty('DeviceMotionEvent')"); + +function hasOnDeviceMotionProperty() +{ + for (var property in window) { + if (property == "ondevicemotion") + return true; + } + return false; +} + +shouldBeTrue("typeof window.ondevicemotion == 'object'"); +shouldBeTrue("hasOnDeviceMotionProperty()"); +shouldBeTrue("'ondevicemotion' in window"); +shouldBeTrue("window.hasOwnProperty('ondevicemotion')"); + +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceMotion/window-property-expected.txt b/LayoutTests/fast/dom/DeviceMotion/window-property-expected.txt new file mode 100644 index 0000000..391677a --- /dev/null +++ b/LayoutTests/fast/dom/DeviceMotion/window-property-expected.txt @@ -0,0 +1,18 @@ +Tests that the window.DeviceMotionEvent and window.ondevicemotion properties are present. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS typeof window.DeviceMotionEvent == 'object' is true +PASS typeof window.DeviceMotionEvent == 'function' is false +PASS hasDeviceMotionEventProperty() is true +PASS 'DeviceMotionEvent' in window is true +PASS window.hasOwnProperty('DeviceMotionEvent') is true +PASS typeof window.ondevicemotion == 'object' is true +PASS hasOnDeviceMotionProperty() is true +PASS 'ondevicemotion' in window is true +PASS window.hasOwnProperty('ondevicemotion') is true +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceMotion/window-property.html b/LayoutTests/fast/dom/DeviceMotion/window-property.html new file mode 100644 index 0000000..e122033 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceMotion/window-property.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/window-property.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> |