4 <script src=
"../../../resources/js-test.js"></script>
6 description('Tests the optional properties of DeviceOrientationEvent. Each property should be null if not set, or set to null or undefined.');
10 evalAndLog("event = document.createEvent('DeviceOrientationEvent')");
11 shouldBeTrue("event.alpha == null");
12 shouldBeTrue("event.beta == null");
13 shouldBeTrue("event.gamma == null");
14 shouldBeTrue("event.absolute == null");
16 evalAndLog("event.initDeviceOrientationEvent('', false, false, 0, 1, 2)");
17 shouldBeTrue("event.alpha == 0");
18 shouldBeTrue("event.beta == 1");
19 shouldBeTrue("event.gamma == 2");
21 evalAndLog("event.initDeviceOrientationEvent('', false, false, 0, 1, 2, true)");
22 shouldBeTrue("event.alpha == 0");
23 shouldBeTrue("event.beta == 1");
24 shouldBeTrue("event.gamma == 2");
25 shouldBeTrue("event.absolute");
27 evalAndLog("event.initDeviceOrientationEvent()");
28 shouldBeTrue("event.alpha == null");
29 shouldBeTrue("event.beta == null");
30 shouldBeTrue("event.gamma == null");
32 evalAndLog("event.initDeviceOrientationEvent('', false, false, [], [], [])");
33 shouldBeTrue("event.alpha == 0");
34 shouldBeTrue("event.beta == 0");
35 shouldBeTrue("event.gamma == 0");
37 evalAndLog("event.initDeviceOrientationEvent('', false, false, undefined, undefined, undefined)");
38 shouldBeTrue("event.alpha == null");
39 shouldBeTrue("event.beta == null");
40 shouldBeTrue("event.gamma == null");
42 evalAndLog("event.initDeviceOrientationEvent('', false, false, '', '', '')");
43 shouldBeTrue("event.alpha == 0");
44 shouldBeTrue("event.beta == 0");
45 shouldBeTrue("event.gamma == 0");
47 evalAndLog("event.initDeviceOrientationEvent('', false, false, null, null, null)");
48 shouldBeTrue("event.alpha == null");
49 shouldBeTrue("event.beta == null");
50 shouldBeTrue("event.gamma == null");