Skip to content

Commit 882ff8d

Browse files
akihiroota87Commit Bot
authored andcommitted
Add ChromeVox test for rich text attributes on editable text.
This test ensures that the correct start/end positions of rich text attributes are reported when moving through editable text by character. This test covers bold, italic, underline, strike through, font size, font family, and font color attributes. Bug: 934962 Change-Id: I96221751a18a63b19b822fa592b6901880675209 Reviewed-on: https://chromium-review.googlesource.com/c/1483672 Reviewed-by: David Tseng <[email protected]> Commit-Queue: Akihiro Ota <[email protected]> Cr-Commit-Position: refs/heads/master@{#635748}
1 parent de8d92e commit 882ff8d

File tree

1 file changed

+124
-0
lines changed

1 file changed

+124
-0
lines changed

chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,130 @@ TEST_F('ChromeVoxEditingTest', 'RichTextMoveByCharacter', function() {
257257
});
258258
});
259259

260+
TEST_F('ChromeVoxEditingTest', 'RichTextMoveByCharacterAllAttributes', function() {
261+
var mockFeedback = this.createMockFeedback();
262+
this.runWithLoadedTree(function() {/*!
263+
<div role="textbox" contenteditable>
264+
<p style="font-size:20px; font-family:times">
265+
<b style="color:#ff0000">Move</b> <i>through</i>
266+
<u style="font-family:georgia">text</u> by
267+
<strike style="font-size:12px; color:#0000ff">character</strike> test
268+
</p>
269+
</div>
270+
<button id="go">Go</button>
271+
272+
<script>
273+
document.getElementById('go').addEventListener('click', function() {
274+
var sel = getSelection();
275+
sel.modify('move', 'forward', 'character');
276+
}, true);
277+
</script>
278+
*/}, function(root) {
279+
var input = root.find({role: RoleType.TEXT_FIELD});
280+
var go = root.find({role: RoleType.BUTTON});
281+
var moveByChar = go.doDefault.bind(go);
282+
var lineText = 'Move through text by character test mled';
283+
284+
this.listenOnce(input, chrome.automation.EventType.FOCUS, function() {
285+
mockFeedback.call(moveByChar)
286+
.expectSpeech('o').expectBraille(lineText, { startIndex: 1, endIndex: 1 })
287+
.call(moveByChar)
288+
.expectSpeech('v').expectBraille(lineText, { startIndex: 2, endIndex: 2 })
289+
.call(moveByChar)
290+
.expectSpeech('e')
291+
.expectSpeech('Bold end')
292+
.expectBraille(lineText, { startIndex: 3, endIndex: 3 })
293+
.call(moveByChar)
294+
.expectSpeech(' ')
295+
.expectSpeech('Black, 100% opacity. start')
296+
.expectBraille(lineText, { startIndex: 4, endIndex: 4 })
297+
.call(moveByChar)
298+
.expectSpeech('t')
299+
.expectSpeech('Italic start')
300+
.expectBraille(lineText, { startIndex: 5, endIndex: 5 })
301+
.call(moveByChar)
302+
.expectSpeech('h').expectBraille(lineText, { startIndex: 6, endIndex: 6 })
303+
.call(moveByChar)
304+
.expectSpeech('r').expectBraille(lineText, { startIndex: 7, endIndex: 7 })
305+
.call(moveByChar)
306+
.expectSpeech('o').expectBraille(lineText, { startIndex: 8, endIndex: 8 })
307+
.call(moveByChar)
308+
.expectSpeech('u').expectBraille(lineText, { startIndex: 9, endIndex: 9 })
309+
.call(moveByChar)
310+
.expectSpeech('g').expectBraille(lineText, { startIndex: 10, endIndex: 10 })
311+
.call(moveByChar)
312+
.expectSpeech('h')
313+
.expectSpeech('Italic end')
314+
.expectBraille(lineText, { startIndex: 11, endIndex: 11 })
315+
.call(moveByChar)
316+
.expectSpeech(' ').expectBraille(lineText, { startIndex: 12, endIndex: 12 })
317+
.call(moveByChar)
318+
.expectSpeech('t')
319+
.expectSpeech('Underline start')
320+
.expectSpeech('georgia start')
321+
.expectBraille(lineText, { startIndex: 13, endIndex: 13 })
322+
.call(moveByChar)
323+
.expectSpeech('e').expectBraille(lineText, { startIndex: 14, endIndex: 14 })
324+
.call(moveByChar)
325+
.expectSpeech('x').expectBraille(lineText, { startIndex: 15, endIndex: 15 })
326+
.call(moveByChar)
327+
.expectSpeech('t')
328+
.expectSpeech('Underline end')
329+
.expectBraille(lineText, { startIndex: 16, endIndex: 16 })
330+
.call(moveByChar)
331+
.expectSpeech(' ')
332+
.expectSpeech('times start')
333+
.expectBraille(lineText, { startIndex: 17, endIndex: 17 })
334+
.call(moveByChar)
335+
.expectSpeech('b').expectBraille(lineText, { startIndex: 18, endIndex: 18 })
336+
.call(moveByChar)
337+
.expectSpeech('y').expectBraille(lineText, { startIndex: 19, endIndex: 19 })
338+
.call(moveByChar)
339+
.expectSpeech(' ').expectBraille(lineText, { startIndex: 20, endIndex: 20 })
340+
.call(moveByChar)
341+
.expectSpeech('c')
342+
.expectSpeech('Size 12 start')
343+
.expectSpeech('Blue, 100% opacity. start')
344+
.expectSpeech('Strike through start')
345+
.expectBraille(lineText, { startIndex: 21, endIndex: 21 })
346+
.call(moveByChar)
347+
.expectSpeech('h').expectBraille(lineText, { startIndex: 22, endIndex: 22 })
348+
.call(moveByChar)
349+
.expectSpeech('a').expectBraille(lineText, { startIndex: 23, endIndex: 23 })
350+
.call(moveByChar)
351+
.expectSpeech('r').expectBraille(lineText, { startIndex: 24, endIndex: 24 })
352+
.call(moveByChar)
353+
.expectSpeech('a').expectBraille(lineText, { startIndex: 25, endIndex: 25 })
354+
.call(moveByChar)
355+
.expectSpeech('c').expectBraille(lineText, { startIndex: 26, endIndex: 26 })
356+
.call(moveByChar)
357+
.expectSpeech('t').expectBraille(lineText, { startIndex: 27, endIndex: 27 })
358+
.call(moveByChar)
359+
.expectSpeech('e').expectBraille(lineText, { startIndex: 28, endIndex: 28 })
360+
.call(moveByChar)
361+
.expectSpeech('r')
362+
.expectSpeech('Strike through end')
363+
.expectBraille(lineText, { startIndex: 29, endIndex: 29 })
364+
.call(moveByChar)
365+
.expectSpeech(' ')
366+
.expectSpeech('Size 20 start')
367+
.expectSpeech('Black, 100% opacity. start')
368+
.expectBraille(lineText, { startIndex: 30, endIndex: 30 })
369+
.call(moveByChar)
370+
.expectSpeech('t').expectBraille(lineText, { startIndex: 31, endIndex: 31 })
371+
.call(moveByChar)
372+
.expectSpeech('e').expectBraille(lineText, { startIndex: 32, endIndex: 32 })
373+
.call(moveByChar)
374+
.expectSpeech('s').expectBraille(lineText, { startIndex: 33, endIndex: 33 })
375+
.call(moveByChar)
376+
.expectSpeech('t').expectBraille(lineText, { startIndex: 34, endIndex: 34 })
377+
378+
.replay();
379+
});
380+
input.focus();
381+
});
382+
});
383+
260384
// Tests specifically for cursor workarounds.
261385
TEST_F('ChromeVoxEditingTest', 'RichTextMoveByCharacterNodeWorkaround', function() {
262386
var mockFeedback = this.createMockFeedback();

0 commit comments

Comments
 (0)