| Ted Mielczarek | 634cdba | 2014-12-11 14:23:30 | [diff] [blame] | 1 | <!doctype html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>Gamepad IDL tests</title> |
| 5 | <link rel="help" href="https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#gamepad-interface"> |
| 6 | <link rel="help" href="https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#gamepadbutton-interface"> |
| 7 | <link rel="help" href="https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#gamepadevent-interface"> |
| 8 | <link rel="help" href="https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension"> |
| 9 | <script src="/resources/testharness.js"></script> |
| 10 | <script src="/resources/testharnessreport.js"></script> |
| 11 | <script src="/resources/WebIDLParser.js"></script> |
| 12 | <script src="/resources/idlharness.js"></script> |
| 13 | </head> |
| 14 | <body> |
| 15 | <pre id="untested_idl" style="display: none"> |
| 16 | interface Navigator { |
| 17 | }; |
| 18 | |
| 19 | interface Event { |
| 20 | }; |
| 21 | </pre> |
| 22 | <pre id="idl" style="display: none"> |
| 23 | interface Gamepad { |
| 24 | readonly attribute DOMString id; |
| 25 | readonly attribute long index; |
| 26 | readonly attribute boolean connected; |
| 27 | readonly attribute DOMHighResTimeStamp timestamp; |
| 28 | readonly attribute GamepadMappingType mapping; |
| 29 | readonly attribute double[] axes; |
| 30 | readonly attribute GamepadButton[] buttons; |
| 31 | }; |
| 32 | |
| 33 | enum GamepadMappingType { |
| 34 | "", |
| 35 | "standard" |
| 36 | }; |
| 37 | |
| 38 | interface GamepadButton { |
| 39 | readonly attribute boolean pressed; |
| 40 | readonly attribute double value; |
| 41 | }; |
| 42 | |
| 43 | [Constructor(DOMString type, optional GamepadEventInit eventInitDict)] |
| 44 | interface GamepadEvent : Event |
| 45 | { |
| 46 | readonly attribute Gamepad? gamepad; |
| 47 | }; |
| 48 | |
| 49 | dictionary GamepadEventInit : EventInit |
| 50 | { |
| 51 | Gamepad? gamepad = null; |
| 52 | }; |
| 53 | |
| 54 | partial interface Navigator { |
| 55 | Gamepad[] getGamepads(); |
| 56 | }; |
| 57 | </pre> |
| 58 | <script> |
| 59 | var idl_array = new IdlArray(); |
| 60 | idl_array.add_untested_idls(document.getElementById("untested_idl").textContent); |
| 61 | idl_array.add_idls(document.getElementById("idl").textContent); |
| 62 | idl_array.add_objects({ |
| 63 | GamepadEvent: [new GamepadEvent("something")], |
| 64 | Navigator: ["navigator"], |
| 65 | }); |
| 66 | idl_array.test(); |
| 67 | </script> |
| 68 | <div id="log"></div> |
| 69 | </body> |
| 70 | </html> |