This repository has been archived by the owner on Aug 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest_plugin_input_event.html
63 lines (50 loc) · 1.87 KB
/
test_plugin_input_event.html
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
<!DOCTYPE HTML>
<html>
<head>
<title>Test for plugin input event</title>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/NativeKeyCodes.js"></script>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display">
<embed id="plugin" type="application/x-test" wmode="opaque">
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
var gPlugin = document.getElementById("plugin");
var gUtils = window.
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
function doTest() {
gPlugin.focus();
is(gUtils.IMEStatus, gUtils.IME_STATUS_PLUGIN,
"Plugin failed to get focus");
is(gPlugin.getLastKeyText(), "", "Must be empty before first key test");
gUtils.sendNativeKeyEvent(0x409 /* US */,
WIN_VK_A, 0,
"a", "a");
is(gPlugin.getLastKeyText(), "a", "Invalid character was inputted");
gUtils.sendNativeKeyEvent(0x407 /* German */,
WIN_VK_OEM_PLUS, 0,
"+", "+");
is(gPlugin.getLastKeyText(), "+", "Invalid character was inputted");
gUtils.sendNativeKeyEvent(0x407 /* German */,
WIN_VK_OEM_PLUS, 0x1400 /* Ctrl + Alt (AltGr) */,
"~", "+");
is(gPlugin.getLastKeyText(), "~", "Invalid character was inputted");
SimpleTest.finish();
}
SimpleTest.waitForFocus(doTest);
</script>
</body>
</html>