|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <title>Tests AccessFu content integration</title> |
|
5 <meta charset="utf-8" /> |
|
6 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
7 |
|
8 <script type="application/javascript" |
|
9 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"> |
|
10 </script> |
|
11 <script type="application/javascript" |
|
12 src="chrome://mochikit/content/chrome-harness.js"> |
|
13 </script> |
|
14 |
|
15 <script type="application/javascript" src="../common.js"></script> |
|
16 <script type="application/javascript" src="../browser.js"></script> |
|
17 <script type="application/javascript" src="../events.js"></script> |
|
18 <script type="application/javascript" src="../role.js"></script> |
|
19 <script type="application/javascript" src="../states.js"></script> |
|
20 <script type="application/javascript" src="../layout.js"></script> |
|
21 <script type="application/javascript" src="jsatcommon.js"></script> |
|
22 |
|
23 <script type="application/javascript"> |
|
24 function doTest() { |
|
25 var doc = currentTabDocument(); |
|
26 var textTest = new AccessFuContentTest( |
|
27 [ |
|
28 // Read-only text tests |
|
29 [ContentMessages.simpleMoveFirst, { |
|
30 speak: 'These are my awards, Mother. From Army. ' + |
|
31 'The seal is for marksmanship, and the gorilla is ' + |
|
32 'for sand racing. Text content test document' |
|
33 }], |
|
34 [ContentMessages.moveNextBy('word'), { |
|
35 speak: 'These', |
|
36 speak_checkFunc: 'todo_is', // Bug 980509 |
|
37 android: [{ |
|
38 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
39 fromIndex: 0, |
|
40 toIndex: 5 |
|
41 }] |
|
42 }], |
|
43 [ContentMessages.moveNextBy('word'), { |
|
44 speak: 'are', |
|
45 speak_checkFunc: 'todo_is', // Bug 980509 |
|
46 android: [{ |
|
47 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
48 fromIndex: 6, |
|
49 toIndex: 9 |
|
50 }] |
|
51 }], |
|
52 [ContentMessages.moveNextBy('word'), { |
|
53 speak: 'my', |
|
54 speak_checkFunc: 'todo_is', // Bug 980509 |
|
55 android: [{ |
|
56 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
57 fromIndex: 10, |
|
58 toIndex: 12 |
|
59 }] |
|
60 }], |
|
61 [ContentMessages.moveNextBy('word'), { |
|
62 speak: 'awards,', |
|
63 speak_checkFunc: 'todo_is', // Bug 980509 |
|
64 android: [{ |
|
65 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
66 fromIndex: 13, |
|
67 toIndex: 20 |
|
68 }] |
|
69 }], |
|
70 [ContentMessages.moveNextBy('word'), { |
|
71 speak: 'Mother.', |
|
72 speak_checkFunc: 'todo_is', // Bug 980509 |
|
73 android: [{ |
|
74 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
75 fromIndex: 21, |
|
76 toIndex: 28 |
|
77 }] |
|
78 }], |
|
79 [ContentMessages.movePreviousBy('word'), { |
|
80 speak: 'awards,', |
|
81 speak_checkFunc: 'todo_is', // Bug 980509 |
|
82 android: [{ |
|
83 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
84 fromIndex: 13, |
|
85 toIndex: 20 |
|
86 }] |
|
87 }], |
|
88 [ContentMessages.movePreviousBy('word'), { |
|
89 speak: 'my', |
|
90 speak_checkFunc: 'todo_is', // Bug 980509 |
|
91 android: [{ |
|
92 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
93 fromIndex: 10, |
|
94 toIndex: 12 |
|
95 }] |
|
96 }], |
|
97 [ContentMessages.movePreviousBy('word'), { |
|
98 speak: 'are', |
|
99 speak_checkFunc: 'todo_is', // Bug 980509 |
|
100 android: [{ |
|
101 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
102 fromIndex: 6, |
|
103 toIndex: 9 |
|
104 }] |
|
105 }], |
|
106 [ContentMessages.movePreviousBy('word'), { |
|
107 speak: 'These', |
|
108 speak_checkFunc: 'todo_is', // Bug 980509 |
|
109 android: [{ |
|
110 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
111 fromIndex: 0, |
|
112 toIndex: 5 |
|
113 }] |
|
114 }], |
|
115 // XXX: Bug 980510: doing next after text traversal should |
|
116 // bring us to the next paragraph. |
|
117 [ContentMessages.simpleMoveNext, { |
|
118 speak: 'You\'re a good guy, mon frere. ' + |
|
119 'That means brother in French. ' + |
|
120 'I don\'t know how I know that. ' + |
|
121 'I took four years of Spanish.', |
|
122 speak_checkFunc: 'todo_is' // Bug 980510 |
|
123 }], |
|
124 // XXX: extra move op here because of bug 980510. |
|
125 [ContentMessages.simpleMoveNext, { |
|
126 speak: 'You\'re a good guy, mon frere. ' + |
|
127 'That means brother in French. ' + |
|
128 'I don\'t know how I know that. ' + |
|
129 'I took four years of Spanish.', |
|
130 }], |
|
131 // XXX: Word boundary should be past the apostraphe. |
|
132 [ContentMessages.moveNextBy('word'), { |
|
133 speak: 'You\'re', |
|
134 speak_checkFunc: 'todo_is', // Bug 980509 |
|
135 android: [{ |
|
136 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
137 fromIndex: 0, |
|
138 toIndex: 6 |
|
139 }], |
|
140 android_checkFunc: 'todo' // Bug 980512 |
|
141 }], |
|
142 |
|
143 // Editable text tests. |
|
144 [ContentMessages.focusSelector('textarea'), { |
|
145 speak: 'Please refrain from Mayoneggs during this ' + |
|
146 'salmonella scare. text area' |
|
147 }], |
|
148 [null, { // When we first focus, caret is at 0. |
|
149 android: [{ |
|
150 eventType: AndroidEvent.VIEW_TEXT_SELECTION_CHANGED, |
|
151 brailleOutput: { |
|
152 selectionStart: 0, |
|
153 selectionEnd: 0 |
|
154 } |
|
155 }] |
|
156 } |
|
157 ], |
|
158 [ContentMessages.activateCurrent(10), { |
|
159 android: [{ |
|
160 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
161 fromIndex: 0, |
|
162 toIndex: 10 |
|
163 }] |
|
164 }], |
|
165 [null, { |
|
166 android: [{ |
|
167 eventType: AndroidEvent.VIEW_TEXT_SELECTION_CHANGED, |
|
168 brailleOutput: { |
|
169 selectionStart: 10, |
|
170 selectionEnd: 10 |
|
171 } |
|
172 }] |
|
173 }], |
|
174 [ContentMessages.activateCurrent(20), { |
|
175 android: [{ |
|
176 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
177 fromIndex: 10, |
|
178 toIndex: 20 |
|
179 }] |
|
180 }], |
|
181 [null, { |
|
182 android: [{ |
|
183 eventType: AndroidEvent.VIEW_TEXT_SELECTION_CHANGED, |
|
184 brailleOutput: { |
|
185 selectionStart: 20, |
|
186 selectionEnd: 20 |
|
187 } |
|
188 }] |
|
189 }], |
|
190 [ContentMessages.moveCaretNextBy('word'), { |
|
191 android: [{ |
|
192 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
193 fromIndex: 20, |
|
194 toIndex: 29 |
|
195 }] |
|
196 }], |
|
197 [ContentMessages.moveCaretNextBy('word'), { |
|
198 android: [{ |
|
199 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
200 fromIndex: 29, |
|
201 toIndex: 36 |
|
202 }] |
|
203 }], |
|
204 [ContentMessages.moveCaretNextBy('character'), { |
|
205 android: [{ |
|
206 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
207 fromIndex: 36, |
|
208 toIndex: 37 |
|
209 }] |
|
210 }], |
|
211 [ContentMessages.moveCaretNextBy('character'), { |
|
212 android: [{ |
|
213 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
214 fromIndex: 37, |
|
215 toIndex: 38 |
|
216 }] |
|
217 }], |
|
218 [ContentMessages.moveCaretNextBy('paragraph'), { |
|
219 android: [{ |
|
220 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
221 fromIndex: 38, |
|
222 toIndex: 59 |
|
223 }] |
|
224 }], |
|
225 [ContentMessages.moveCaretPreviousBy('word'), { |
|
226 android: [{ |
|
227 eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, |
|
228 fromIndex: 53, |
|
229 toIndex: 59 |
|
230 }] |
|
231 }] |
|
232 ]); |
|
233 |
|
234 textTest.start(function () { |
|
235 closeBrowserWindow(); |
|
236 SimpleTest.finish(); |
|
237 }); |
|
238 } |
|
239 |
|
240 SimpleTest.waitForExplicitFinish(); |
|
241 addLoadEvent( |
|
242 function () { |
|
243 openBrowserWindow( |
|
244 doTest, |
|
245 getRootDirectory(window.location.href) + "doc_content_text.html"); |
|
246 }); |
|
247 </script> |
|
248 </head> |
|
249 <body id="body"> |
|
250 |
|
251 <a target="_blank" |
|
252 title="Add tests for text editing and navigating" |
|
253 href="https://bugzilla.mozilla.org/show_bug.cgi?id=972047">Mozilla Bug 933808</a> |
|
254 <p id="display"></p> |
|
255 <div id="content" style="display: none"></div> |
|
256 <pre id="test"> |
|
257 </pre> |
|
258 </body> |
|
259 </html> |