blob: c2230b2922291c2da28be2ee7fadc30628804292 [file] [log] [blame]
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.acceleration == null is true
PASS event.accelerationIncludingGravity == null is true
PASS event.rotationRate == null is true
PASS event.interval == null is true
event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, y: 4, z: 5}, {alpha: 6, beta: 7, gamma: 8}, 9)
PASS event.acceleration.x == 0 is true
PASS event.acceleration.y == 1 is true
PASS event.acceleration.z == 2 is true
PASS event.accelerationIncludingGravity.x == 3 is true
PASS event.accelerationIncludingGravity.y == 4 is true
PASS event.accelerationIncludingGravity.z == 5 is true
PASS event.rotationRate.alpha == 6 is true
PASS event.rotationRate.beta == 7 is true
PASS event.rotationRate.gamma == 8 is true
PASS event.interval == 9 is true
PASS event.initDeviceMotionEvent('', false, false, objectThrowingException, {x: 3, z: 5}, {gamma: 8, beta: 7}, 9) threw exception Error: x getter exception.
PASS event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, objectThrowingException, {gamma: 8, beta: 7}, 9) threw exception Error: x getter exception.
PASS event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, z: 5}, objectThrowingException, 9) threw exception Error: alpha getter exception.
PASS event.initDeviceMotionEvent('', false, false, {x: objectThrowingException, y: 1, z: 2}, {x: 3, y: 4, z: 5}, {alpha: 6, beta: 7, gamma: 8}, 9) threw exception Error: valueOf threw exception.
PASS event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, y: objectThrowingException, z: 5}, {alpha: 6, beta: 7, gamma: 8}, 9) threw exception Error: valueOf threw exception.
PASS event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, y: 4, z: 5}, {alpha: 6, beta: 7, gamma: objectThrowingException}, 9) threw exception Error: valueOf threw exception.
event.initDeviceMotionEvent('', false, false, {y: 1, x: 0}, {x: 3, z: 5}, {gamma: 8, beta: 7}, 9)
PASS event.acceleration.x == 0 is true
PASS event.acceleration.y == 1 is true
PASS event.acceleration.z == null is true
PASS event.accelerationIncludingGravity.x == 3 is true
PASS event.accelerationIncludingGravity.y == null is true
PASS event.accelerationIncludingGravity.z == 5 is true
PASS event.rotationRate.alpha == null is true
PASS event.rotationRate.beta == 7 is true
PASS event.rotationRate.gamma == 8 is true
PASS event.interval == 9 is true
event.initDeviceMotionEvent()
PASS event.acceleration == null is true
PASS event.accelerationIncludingGravity == null is true
PASS event.rotationRate == null is true
PASS event.interval == null is true
event.initDeviceMotionEvent('', false, false, [], [], [], [])
PASS event.acceleration == null is true
PASS event.accelerationIncludingGravity == null is true
PASS event.rotationRate == null is true
PASS event.interval == 0 is true
event.initDeviceMotionEvent('', false, false, undefined, undefined, undefined, undefined)
PASS event.acceleration == null is true
PASS event.accelerationIncludingGravity == null is true
PASS event.rotationRate == null is true
PASS event.interval == null is true
event.initDeviceMotionEvent('', false, false, '', '', '', '')
PASS event.acceleration == null is true
PASS event.accelerationIncludingGravity == null is true
PASS event.rotationRate == null is true
PASS event.interval == 0 is true
event.initDeviceMotionEvent('', false, false, null, null, null, null)
PASS event.acceleration == null is true
PASS event.accelerationIncludingGravity == null is true
PASS event.rotationRate == null is true
PASS event.interval == null is true
event.initDeviceMotionEvent('', false, false, {x: null, y: null, z: null}, {x: null, y: null, z: null}, {alpha: null, beta: null, gamma: null}, null)
PASS event.acceleration == null is true
PASS event.accelerationIncludingGravity == null is true
PASS event.rotationRate == null is true
PASS event.interval == null is true
event.initDeviceMotionEvent('', false, false, {x: null, y: null, z: 1}, {x: null, y: null, z: 2}, {alpha: null, beta: null, gamma: 3}, null)
PASS event.acceleration.x == null is true
PASS event.acceleration.y == null is true
PASS event.acceleration.z == 1 is true
PASS event.accelerationIncludingGravity.x == null is true
PASS event.accelerationIncludingGravity.y == null is true
PASS event.accelerationIncludingGravity.z == 2 is true
PASS event.rotationRate.alpha == null is true
PASS event.rotationRate.beta == null is true
PASS event.rotationRate.gamma == 3 is true
PASS event.interval == null is true
event.initDeviceMotionEvent('', false, false, {x: undefined, y: undefined, z: undefined}, {x: undefined, y: undefined, z: undefined}, {alpha: undefined, beta: undefined, gamma: undefined}, undefined)
PASS event.acceleration == null is true
PASS event.accelerationIncludingGravity == null is true
PASS event.rotationRate == null is true
PASS event.interval == null is true
event.initDeviceMotionEvent('', false, false, {x: undefined, y: undefined, z: 1}, {x: undefined, y: undefined, z: 2}, {alpha: undefined, beta: undefined, gamma: 3}, undefined)
PASS event.acceleration.x == null is true
PASS event.acceleration.y == null is true
PASS event.acceleration.z == 1 is true
PASS event.accelerationIncludingGravity.x == null is true
PASS event.accelerationIncludingGravity.y == null is true
PASS event.accelerationIncludingGravity.z == 2 is true
PASS event.rotationRate.alpha == null is true
PASS event.rotationRate.beta == null is true
PASS event.rotationRate.gamma == 3 is true
PASS event.interval == null is true
PASS successfullyParsed is true
TEST COMPLETE