blob: 13c18b8a3092781271836f06d7d3fc09592e6c81 [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 = new DeviceMotionEvent('', {acceleration: {x: 0, y: 1, z: 2}, accelerationIncludingGravity: {x: 3, y: 4, z: 5}, rotationRate: {alpha: 6, beta: 7, gamma: 8}, interval: 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 = new DeviceMotionEvent('', {acceleration: objectThrowingException, accelerationIncludingGravity: {x: 3, z: 5}, rotationRate: {gamma: 8, beta: 7}, interval: 9}) threw exception Error: x getter exception.
PASS event = new DeviceMotionEvent('', {acceleration: {x: 0, y: 1, z: 2}, accelerationIncludingGravity: objectThrowingException, rotationRate: {gamma: 8, beta: 7}, interval: 9}) threw exception Error: x getter exception.
PASS event = new DeviceMotionEvent('', {acceleration: {x: 0, y: 1, z: 2}, accelerationIncludingGravity: {x: 3, z: 5}, rotationRate: objectThrowingException, interval: 9}) threw exception Error: alpha getter exception.
PASS event = new DeviceMotionEvent('', {acceleration: {x: objectThrowingException, y: 1, z: 2}, accelerationIncludingGravity: {x: 3, y: 4, z: 5}, rotationRate: {alpha: 6, beta: 7, gamma: 8}, interval: 9}) threw exception Error: valueOf threw exception.
PASS event = new DeviceMotionEvent('', {acceleration: {x: 0, y: 1, z: 2}, accelerationIncludingGravity: {x: 3, y: objectThrowingException, z: 5}, rotationRate: {alpha: 6, beta: 7, gamma: 8}, interval: 9}) threw exception Error: valueOf threw exception.
PASS event = new DeviceMotionEvent('', {acceleration: {x: 0, y: 1, z: 2}, accelerationIncludingGravity: {x: 3, y: 4, z: 5}, rotationRate: {alpha: 6, beta: 7, gamma: objectThrowingException}, interval: 9}) threw exception Error: valueOf threw exception.
event = new DeviceMotionEvent('', {acceleration: {y: 1, x: 0}, accelerationIncludingGravity: {x: 3, z: 5}, rotationRate: {gamma: 8, beta: 7}, interval: 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 = new 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 = new DeviceMotionEvent('', {acceleration: [], accelerationIncludingGravity: [], rotationRate: [], interval: []})
PASS event.acceleration.x == null is true
PASS event.acceleration.y == null is true
PASS event.acceleration.z == null is true
PASS event.accelerationIncludingGravity.x == null is true
PASS event.accelerationIncludingGravity.y == null is true
PASS event.accelerationIncludingGravity.z == null is true
PASS event.rotationRate.alpha == null is true
PASS event.rotationRate.beta == null is true
PASS event.rotationRate.gamma == null is true
PASS event.interval == 0 is true
event = new DeviceMotionEvent('', {acceleration: [], accelerationIncludingGravity: undefined, rotationRate: undefined, interval: undefined})
PASS event.acceleration.x == null is true
PASS event.acceleration.y == null is true
PASS event.acceleration.z == null is true
PASS event.accelerationIncludingGravity == null is true
PASS event.rotationRate == null is true
PASS event.interval == null is true
event = new DeviceMotionEvent('', {acceleration: null, accelerationIncludingGravity: null, rotationRate: null, interval: 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 = new DeviceMotionEvent('', {acceleration: {x: null, y: null, z: null}, accelerationIncludingGravity: {x: null, y: null, z: null}, rotationRate: {alpha: null, beta: null, gamma: null}, interval: null})
PASS event.acceleration.x == null is true
PASS event.acceleration.y == null is true
PASS event.acceleration.z == null is true
PASS event.accelerationIncludingGravity.x == null is true
PASS event.accelerationIncludingGravity.y == null is true
PASS event.accelerationIncludingGravity.z == null is true
PASS event.rotationRate.alpha == null is true
PASS event.rotationRate.beta == null is true
PASS event.rotationRate.gamma == null is true
PASS event.interval == null is true
event = new DeviceMotionEvent('', {acceleration: {x: null, y: null, z: 1}, accelerationIncludingGravity: {x: null, y: null, z: 2}, rotationRate: {alpha: null, beta: null, gamma: 3}, interval: 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 = new DeviceMotionEvent('', {acceleration: {x: undefined, y: undefined, z: undefined}, accelerationIncludingGravity: {x: undefined, y: undefined, z: undefined}, rotationRate: {alpha: undefined, beta: undefined, gamma: undefined}, interval: undefined})
PASS event.acceleration.x == null is true
PASS event.acceleration.y == null is true
PASS event.acceleration.z == null is true
PASS event.accelerationIncludingGravity.x == null is true
PASS event.accelerationIncludingGravity.y == null is true
PASS event.accelerationIncludingGravity.z == null is true
PASS event.rotationRate.alpha == null is true
PASS event.rotationRate.beta == null is true
PASS event.rotationRate.gamma == null is true
PASS event.interval == null is true
event = new DeviceMotionEvent('', {acceleration: {x: undefined, y: undefined, z: 1}, accelerationIncludingGravity: {x: undefined, y: undefined, z: 2}, rotationRate: {alpha: undefined, beta: undefined, gamma: 3}, interval: 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