summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/DeviceMotion/script-tests/optional-event-properties.js
blob: ab9b53b2c87791dbec380a261ebf6667b0b648ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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;