OLD | NEW |
1 <script> | 1 <!-- |
2 function setCompositionTest() { | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this |
3 chrome.experimental.input.ime.setComposition({ | 3 * source code is governed by a BSD-style license that can be found in the |
4 "contextID": 1, | 4 * LICENSE file. |
5 "text": "Pie", | 5 --> |
6 "selectionStart": 1, | 6 <script src="background.js"></script> |
7 "selectionEnd": 2, | |
8 "cursor": 3, | |
9 "segments": [{ | |
10 "start": 0, | |
11 "end": 1, | |
12 "style": "underline" | |
13 }] | |
14 }, chrome.test.callbackPass()); | |
15 } | |
16 | |
17 | |
18 function clearCompositionTest() { | |
19 chrome.experimental.input.ime.clearComposition({ | |
20 "contextID": 1 | |
21 }, chrome.test.callbackPass()); | |
22 } | |
23 | |
24 | |
25 function commitTextTest() { | |
26 chrome.experimental.input.ime.commitText({ | |
27 "contextID": 2, | |
28 "text": "Seaguls" | |
29 }, chrome.test.callbackPass()); | |
30 } | |
31 | |
32 | |
33 function setCandidateWindowPropertiesTest() { | |
34 chrome.experimental.input.ime.setCandidateWindowProperties({ | |
35 "engineID": "test", | |
36 "properties": { | |
37 "visible": true, | |
38 "cursorVisible": false, | |
39 "vertical": true, | |
40 "pageSize": 6, | |
41 "auxiliaryText": "notes", | |
42 "auxiliaryTextVisible": true | |
43 } | |
44 }, chrome.test.callbackPass()); | |
45 } | |
46 | |
47 | |
48 function setCandidatesTest() { | |
49 chrome.experimental.input.ime.setCandidates({ | |
50 "contextID": 8, | |
51 "candidates": [{ | |
52 "candidate": "one", | |
53 "id": 1, | |
54 "label": "first", | |
55 "annotation": "The first one" | |
56 }, { | |
57 "candidate": "two", | |
58 "id": 2, | |
59 "label": "second", | |
60 "annotation": "The second one" | |
61 }, { | |
62 "candidate": "three", | |
63 "id": 3, | |
64 "label": "third", | |
65 "annotation": "The third one" | |
66 }] | |
67 }, chrome.test.callbackPass()); | |
68 } | |
69 | |
70 | |
71 function setCursorPositionTest() { | |
72 chrome.experimental.input.ime.setCursorPosition({ | |
73 "contextID": 9, | |
74 "candidateID": 1 | |
75 }, chrome.test.callbackPass()); | |
76 } | |
77 | |
78 | |
79 | |
80 function setMenuItemsTest() { | |
81 chrome.experimental.input.ime.setMenuItems({ | |
82 "engineID": "test", | |
83 "items": [{ | |
84 "id": "Menu 1", | |
85 "label": "Menu 1", | |
86 "style": "check", | |
87 "visible": true, | |
88 "enabled": true | |
89 }, { | |
90 "id": "Menu 2", | |
91 "label": "Menu 2", | |
92 "style": "radio", | |
93 "visible": true, | |
94 "enabled": true | |
95 }] | |
96 }, chrome.test.callbackPass()); | |
97 } | |
98 | |
99 function updateMenuItemsTest() { | |
100 chrome.experimental.input.ime.updateMenuItems({ | |
101 "engineID": "test", | |
102 "items": [{ | |
103 "id": "Menu 1", | |
104 "enabled": false | |
105 }, { | |
106 "id": "Menu 2", | |
107 "visible": false, | |
108 }] | |
109 }, chrome.test.callbackPass()); | |
110 } | |
111 | |
112 chrome.test.runTests([setCompositionTest, clearCompositionTest, | |
113 commitTextTest, setCandidateWindowPropertiesTest, | |
114 setCandidatesTest, setCursorPositionTest, | |
115 setMenuItemsTest, updateMenuItemsTest]); | |
116 </script> | |
OLD | NEW |