Reviewed by Darin.
[WebKit-https.git] / LayoutTests / platform / win / fast / events / keyLocation-numpad.html
1 <body>
2     <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=16410">bug 16410</a>:
3         Implement isKeypadEvent() on Windows
4     </p>
5     <div contenteditable id=ce onkeyup="keyEvent(event)" onkeydown="keyEvent(event)"></div>
6     <div id="log"></div>
7     <script>
8         function locationName(code) {
9           switch (code) {
10             case 0:
11                 return "DOM_KEY_LOCATION_STANDARD";
12             case 1:
13                 return "DOM_KEY_LOCATION_LEFT";
14             case 2:
15                 return "DOM_KEY_LOCATION_RIGHT";
16             case 3:
17                 return "DOM_KEY_LOCATION_NUMPAD";
18             default:
19                 return code.toString();
20           }
21         }
22
23         function keyEvent(event) {
24             document.getElementById("log").innerHTML += (event.type + ": " + locationName(event.keyLocation) + "<br>");
25         }
26
27         document.getElementById("ce").focus();
28
29         if (window.layoutTestController) {
30             layoutTestController.dumpAsText();
31
32             eventSender.dispatchMessage(eventSender.WM_KEYDOWN, 96 /* VK_NUMPAD0 */, 0x00520001);
33             eventSender.dispatchMessage(eventSender.WM_KEYUP, 96 /* VK_NUMPAD0 */, 0xc0520001);
34             eventSender.dispatchMessage(eventSender.WM_KEYDOWN, 45 /* VK_INSERT */, 0x00520001);
35             eventSender.dispatchMessage(eventSender.WM_KEYUP, 45 /* VK_INSERT */, 0xc0520001);
36             eventSender.dispatchMessage(eventSender.WM_KEYDOWN, 13 /* VK_RETURN */, 0x011c0001);
37             eventSender.dispatchMessage(eventSender.WM_KEYUP, 13 /* VK_RETURN */, 0xc11c0001);
38         } else
39             document.write("To test manually, press any key on numpad.");
40     </script>
41 </body>