OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <body> | 2 <body> |
3 <script src="../resources/js-test.js"></script> | 3 <script src="../resources/js-test.js"></script> |
4 <script> | 4 <script> |
5 description("Validates the exposed Gamepad API.") | 5 description("Validates the exposed Gamepad API.") |
6 | 6 |
7 shouldBeDefined("navigator.getGamepads"); | 7 shouldBeDefined("navigator.getGamepads"); |
8 shouldBeDefined("GamepadEvent"); | 8 shouldBeDefined("GamepadEvent"); |
9 | 9 |
10 gamepads = navigator.getGamepads(); | 10 gamepads = navigator.getGamepads(); |
11 shouldBe("gamepads.length", "4"); | 11 shouldBe("gamepads.length", "4"); |
12 shouldBeUndefined("gamepads[0]"); | 12 shouldBeNull("gamepads[0]"); |
13 shouldBe("gamepads.item.__proto__", "Function.prototype") | 13 shouldBe("gamepads.item.__proto__", "Function.prototype") |
14 shouldBeNull("gamepads.item(0)"); | 14 shouldBeNull("gamepads.item(0)"); |
15 | 15 |
16 if (window.gamepadController) | 16 if (window.gamepadController) |
17 { | 17 { |
18 gamepadController.connect(0); | 18 gamepadController.connect(0); |
19 gamepadController.setId(0, "MockStick 3000"); | 19 gamepadController.setId(0, "MockStick 3000"); |
20 gamepadController.setButtonCount(0, 1); | 20 gamepadController.setButtonCount(0, 1); |
21 gamepadController.setAxisCount(0, 1); | 21 gamepadController.setAxisCount(0, 1); |
22 | 22 |
(...skipping 11 matching lines...) Expand all Loading... |
34 shouldBe("gamepad.buttons[0].pressed.__proto__", "Boolean.prototype"); | 34 shouldBe("gamepad.buttons[0].pressed.__proto__", "Boolean.prototype"); |
35 shouldBe("gamepad.buttons[0].value.__proto__", "Number.prototype"); | 35 shouldBe("gamepad.buttons[0].value.__proto__", "Number.prototype"); |
36 shouldBe("gamepad.mapping.__proto__", "String.prototype"); | 36 shouldBe("gamepad.mapping.__proto__", "String.prototype"); |
37 } | 37 } |
38 else | 38 else |
39 { | 39 { |
40 testFailed("no gamepadController available."); | 40 testFailed("no gamepadController available."); |
41 } | 41 } |
42 </script> | 42 </script> |
43 </body> | 43 </body> |
OLD | NEW |