Home | History | Annotate | Download | only in DeviceMotion
      1 Tests the optional properties of DeviceMotionEvent. Each property should be null if not set, or set to null or undefined.
      2 
      3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
      4 
      5 
      6 event = document.createEvent('DeviceMotionEvent')
      7 PASS event.acceleration == null is true
      8 PASS event.accelerationIncludingGravity == null is true
      9 PASS event.rotationRate == null is true
     10 PASS event.interval == null is true
     11 event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, y: 4, z: 5}, {alpha: 6, beta: 7, gamma: 8}, 9)
     12 PASS event.acceleration.x == 0 is true
     13 PASS event.acceleration.y == 1 is true
     14 PASS event.acceleration.z == 2 is true
     15 PASS event.accelerationIncludingGravity.x == 3 is true
     16 PASS event.accelerationIncludingGravity.y == 4 is true
     17 PASS event.accelerationIncludingGravity.z == 5 is true
     18 PASS event.rotationRate.alpha == 6 is true
     19 PASS event.rotationRate.beta == 7 is true
     20 PASS event.rotationRate.gamma == 8 is true
     21 PASS event.interval == 9 is true
     22 PASS event.initDeviceMotionEvent('', false, false, objectThrowingException, {x: 3, z: 5}, {gamma: 8, beta: 7}, 9) threw exception Error: x getter exception.
     23 PASS event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, objectThrowingException, {gamma: 8, beta: 7}, 9) threw exception Error: x getter exception.
     24 PASS event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, z: 5}, objectThrowingException, 9) threw exception Error: alpha getter exception.
     25 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.
     26 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.
     27 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.
     28 event.initDeviceMotionEvent('', false, false, {y: 1, x: 0}, {x: 3, z: 5}, {gamma: 8, beta: 7}, 9)
     29 PASS event.acceleration.x == 0 is true
     30 PASS event.acceleration.y == 1 is true
     31 PASS event.acceleration.z == null is true
     32 PASS event.accelerationIncludingGravity.x == 3 is true
     33 PASS event.accelerationIncludingGravity.y == null is true
     34 PASS event.accelerationIncludingGravity.z == 5 is true
     35 PASS event.rotationRate.alpha == null is true
     36 PASS event.rotationRate.beta == 7 is true
     37 PASS event.rotationRate.gamma == 8 is true
     38 PASS event.interval == 9 is true
     39 event.initDeviceMotionEvent()
     40 PASS event.acceleration == null is true
     41 PASS event.accelerationIncludingGravity == null is true
     42 PASS event.rotationRate == null is true
     43 PASS event.interval == null is true
     44 event.initDeviceMotionEvent('', false, false, [], [], [], [])
     45 PASS event.acceleration == null is true
     46 PASS event.accelerationIncludingGravity == null is true
     47 PASS event.rotationRate == null is true
     48 PASS event.interval == 0 is true
     49 event.initDeviceMotionEvent('', false, false, undefined, undefined, undefined, undefined)
     50 PASS event.acceleration == null is true
     51 PASS event.accelerationIncludingGravity == null is true
     52 PASS event.rotationRate == null is true
     53 PASS event.interval == null is true
     54 event.initDeviceMotionEvent('', false, false, '', '', '', '')
     55 PASS event.acceleration == null is true
     56 PASS event.accelerationIncludingGravity == null is true
     57 PASS event.rotationRate == null is true
     58 PASS event.interval == 0 is true
     59 event.initDeviceMotionEvent('', false, false, null, null, null, null)
     60 PASS event.acceleration == null is true
     61 PASS event.accelerationIncludingGravity == null is true
     62 PASS event.rotationRate == null is true
     63 PASS event.interval == null is true
     64 event.initDeviceMotionEvent('', false, false, {x: null, y: null, z: null}, {x: null, y: null, z: null}, {alpha: null, beta: null, gamma: null}, null)
     65 PASS event.acceleration == null is true
     66 PASS event.accelerationIncludingGravity == null is true
     67 PASS event.rotationRate == null is true
     68 PASS event.interval == null is true
     69 event.initDeviceMotionEvent('', false, false, {x: null, y: null, z: 1}, {x: null, y: null, z: 2}, {alpha: null, beta: null, gamma: 3}, null)
     70 PASS event.acceleration.x == null is true
     71 PASS event.acceleration.y == null is true
     72 PASS event.acceleration.z == 1 is true
     73 PASS event.accelerationIncludingGravity.x == null is true
     74 PASS event.accelerationIncludingGravity.y == null is true
     75 PASS event.accelerationIncludingGravity.z == 2 is true
     76 PASS event.rotationRate.alpha == null is true
     77 PASS event.rotationRate.beta == null is true
     78 PASS event.rotationRate.gamma == 3 is true
     79 PASS event.interval == null is true
     80 event.initDeviceMotionEvent('', false, false, {x: undefined, y: undefined, z: undefined}, {x: undefined, y: undefined, z: undefined}, {alpha: undefined, beta: undefined, gamma: undefined}, undefined)
     81 PASS event.acceleration == null is true
     82 PASS event.accelerationIncludingGravity == null is true
     83 PASS event.rotationRate == null is true
     84 PASS event.interval == null is true
     85 event.initDeviceMotionEvent('', false, false, {x: undefined, y: undefined, z: 1}, {x: undefined, y: undefined, z: 2}, {alpha: undefined, beta: undefined, gamma: 3}, undefined)
     86 PASS event.acceleration.x == null is true
     87 PASS event.acceleration.y == null is true
     88 PASS event.acceleration.z == 1 is true
     89 PASS event.accelerationIncludingGravity.x == null is true
     90 PASS event.accelerationIncludingGravity.y == null is true
     91 PASS event.accelerationIncludingGravity.z == 2 is true
     92 PASS event.rotationRate.alpha == null is true
     93 PASS event.rotationRate.beta == null is true
     94 PASS event.rotationRate.gamma == 3 is true
     95 PASS event.interval == null is true
     96 PASS successfullyParsed is true
     97 
     98 TEST COMPLETE
     99 
    100