mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 873393 - move get text for char boundary tests into separate file, r=tbsaunde
This commit is contained in:
parent
02b38dd3e3
commit
f2b12cc809
@ -11,8 +11,8 @@ const BOUNDARY_ATTRIBUTE_RANGE = nsIAccessibleText.BOUNDARY_ATTRIBUTE_RANGE;
|
||||
const kTextEndOffset = nsIAccessibleText.TEXT_OFFSET_END_OF_TEXT;
|
||||
const kCaretOffset = nsIAccessibleText.TEXT_OFFSET_CARET;
|
||||
|
||||
const kTodo = 1;
|
||||
const kOk = 2;
|
||||
const kTodo = 1; // a test is expected to fail
|
||||
const kOk = 2; // a test doesn't fail
|
||||
|
||||
/**
|
||||
* Test characterCount for the given array of accessibles.
|
||||
|
@ -14,6 +14,7 @@ include $(DEPTH)/config/autoconf.mk
|
||||
MOCHITEST_A11Y_FILES = \
|
||||
doc.html \
|
||||
test_atcaretoffset.html \
|
||||
test_charboundary.html \
|
||||
test_doc.html \
|
||||
test_gettext.html \
|
||||
test_hypertext.html \
|
||||
|
153
accessible/tests/mochitest/text/test_charboundary.html
Normal file
153
accessible/tests/mochitest/text/test_charboundary.html
Normal file
@ -0,0 +1,153 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Char boundary text tests</title>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../text.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// __h__e__l__l__o__ __m__y__ __f__r__i__e__n__d__
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
|
||||
var IDs = [ "i1", "d1", "e1", "t1" ];
|
||||
|
||||
testCharBeforeOffset(IDs, 0, "", 0, 0);
|
||||
testCharBeforeOffset(IDs, 1, "h", 0, 1);
|
||||
testCharBeforeOffset(IDs, 14, "n", 13, 14);
|
||||
testCharBeforeOffset(IDs, 15, "d", 14, 15);
|
||||
|
||||
testCharAtOffset(IDs, 0, "h", 0, 1);
|
||||
testCharAtOffset(IDs, 1, "e", 1, 2);
|
||||
testCharAtOffset(IDs, 14, "d", 14, 15);
|
||||
testCharAtOffset([ "i1", "d1", "e1" ], 15, "", 15, 15);
|
||||
testTextAfterOffset(15, BOUNDARY_CHAR, "", 15, 15,
|
||||
"t1", kOk, kTodo, kTodo);
|
||||
|
||||
testCharAfterOffset(IDs, 0, "e", 1, 2);
|
||||
testCharAfterOffset(IDs, 1, "l", 2, 3);
|
||||
testCharAfterOffset([ "i1", "d1", "e1" ], 14, "", 15, 15);
|
||||
testTextAfterOffset(14, BOUNDARY_CHAR, "", 15, 15,
|
||||
"t1", kTodo, kOk, kTodo);
|
||||
|
||||
// 15 is out of range offset for get text after, keep todos until we
|
||||
// decide how to handle out of range values (ATK and IA2 seems to have
|
||||
// different expectations.
|
||||
testTextAfterOffset(15, BOUNDARY_CHAR, "", 15, 15,
|
||||
"i1", kOk, kTodo, kTodo,
|
||||
"d1", kOk, kTodo, kTodo,
|
||||
"e1", kOk, kTodo, kTodo);
|
||||
testTextAfterOffset(15, BOUNDARY_CHAR, "", 15, 15,
|
||||
"t1", kOk, kTodo, kTodo);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// __B__r__a__v__e__ __S__i__r__ __ __R__o__b__i__n__ __ __ __r__a__n
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
||||
|
||||
IDs = [ "i2", "d2", "e2", "t2" ];
|
||||
|
||||
testCharBeforeOffset(IDs, 0, "", 0, 0);
|
||||
testCharBeforeOffset(IDs, 1, "B", 0, 1);
|
||||
testCharBeforeOffset(IDs, 6, " ", 5, 6);
|
||||
testCharBeforeOffset(IDs, 10, " ", 9, 10);
|
||||
testCharBeforeOffset(IDs, 11, " ", 10, 11);
|
||||
testCharBeforeOffset(IDs, 17, " ", 16, 17);
|
||||
testCharBeforeOffset(IDs, 19, " ", 18, 19);
|
||||
|
||||
testCharAtOffset(IDs, 0, "B", 0, 1);
|
||||
testCharAtOffset(IDs, 1, "r", 1, 2);
|
||||
testCharAtOffset(IDs, 5, " ", 5, 6);
|
||||
testCharAtOffset(IDs, 9, " ", 9, 10);
|
||||
testCharAtOffset(IDs, 10, " ", 10, 11);
|
||||
testCharAtOffset(IDs, 17, " ", 17, 18);
|
||||
|
||||
testCharAfterOffset(IDs, 0, "r", 1, 2);
|
||||
testCharAfterOffset(IDs, 1, "a", 2, 3);
|
||||
testCharAfterOffset(IDs, 4, " ", 5, 6);
|
||||
testCharAfterOffset(IDs, 5, "S", 6, 7);
|
||||
testCharAfterOffset(IDs, 8, " ", 9, 10);
|
||||
testCharAfterOffset(IDs, 9, " ", 10, 11);
|
||||
testCharAfterOffset(IDs, 10, "R", 11, 12);
|
||||
testCharAfterOffset(IDs, 15, " ", 16, 17);
|
||||
testCharAfterOffset(IDs, 16, " ", 17, 18);
|
||||
testCharAfterOffset(IDs, 17, " ", 18, 19);
|
||||
testCharAfterOffset(IDs, 18, "r", 19, 20);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// __o__n__e__w__o__r__d__\n
|
||||
// 0 1 2 3 4 5 6 7
|
||||
// __\n
|
||||
// 8
|
||||
// __t__w__o__ __w__o__r__d__s__\n
|
||||
// 9 10 11 12 13 14 15 16 17 18
|
||||
|
||||
IDs = ["d3", "dbr3", "e3", "ebr3", "t3"];
|
||||
|
||||
testCharBeforeOffset(IDs, 8, "\n", 7, 8);
|
||||
testCharBeforeOffset(IDs, 9, "\n", 8, 9);
|
||||
testCharBeforeOffset(IDs, 10, "t", 9, 10);
|
||||
|
||||
testCharAtOffset(IDs, 7, "\n", 7, 8);
|
||||
testCharAtOffset(IDs, 8, "\n", 8, 9);
|
||||
testCharAtOffset(IDs, 9, "t", 9, 10);
|
||||
|
||||
testCharAfterOffset(IDs, 6, "\n", 7, 8);
|
||||
testCharAfterOffset(IDs, 7, "\n", 8, 9);
|
||||
testCharAfterOffset(IDs, 8, "t", 9, 10);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<input id="i1" value="hello my friend"/>
|
||||
<div id="d1">hello my friend</div>
|
||||
<div id="e1" contenteditable="true">hello my friend</div>
|
||||
<textarea id="t1" contenteditable="true">hello my friend</textarea>
|
||||
|
||||
<input id="i2" value="Brave Sir Robin ran"/>
|
||||
<pre>
|
||||
<div id="d2">Brave Sir Robin ran</div>
|
||||
<div id="e2" contenteditable="true">Brave Sir Robin ran</div>
|
||||
</pre>
|
||||
<textarea id="t2" cols="300">Brave Sir Robin ran</textarea>
|
||||
|
||||
<pre>
|
||||
<div id="d3">oneword
|
||||
|
||||
two words
|
||||
</div>
|
||||
<div id="dbr3">oneword<br/><br/>two words<br/></div>
|
||||
<div id="e3" contenteditable="true">oneword
|
||||
|
||||
two words
|
||||
</div>
|
||||
<div id="ebr3" contenteditable="true">oneword<br/><br/>two words<br/></div>
|
||||
<textarea id="t3" cols="300">oneword
|
||||
|
||||
two words</textarea>
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -36,26 +36,6 @@
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// getTextAfterOffset
|
||||
|
||||
// BOUNDARY_CHAR
|
||||
testTextAfterOffset(6, BOUNDARY_CHAR, "\n", 7, 8,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAfterOffset(7, BOUNDARY_CHAR, "\n", 8, 9,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAfterOffset(8, BOUNDARY_CHAR, "t", 9, 10,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
|
||||
// BOUNDARY_WORD_START
|
||||
testTextAfterOffset(0, BOUNDARY_WORD_START, "two ", 9, 13, IDs);
|
||||
testTextAfterOffset(8, BOUNDARY_WORD_START, "two ", 9, 13,
|
||||
@ -145,26 +125,6 @@
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// getTextBeforeOffset
|
||||
|
||||
// BOUNDARY_CHAR
|
||||
testTextBeforeOffset(8, BOUNDARY_CHAR, "\n", 7, 8,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextBeforeOffset(9, BOUNDARY_CHAR, "\n", 8, 9,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextBeforeOffset(10, BOUNDARY_CHAR, "t", 9, 10,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
|
||||
// BOUNDARY_WORD_START
|
||||
testTextBeforeOffset(0, BOUNDARY_WORD_START, "", 0, 0, IDs);
|
||||
testTextBeforeOffset(7, BOUNDARY_WORD_START, "", 0, 0, IDs);
|
||||
@ -272,26 +232,6 @@
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// getTextAtOffset
|
||||
|
||||
// BOUNDARY_CHAR
|
||||
testTextAtOffset(7, BOUNDARY_CHAR, "\n", 7, 8,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(8, BOUNDARY_CHAR, "\n", 8, 9,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(9, BOUNDARY_CHAR, "t", 9, 10,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
|
||||
// BOUNDARY_WORD_START
|
||||
testTextAtOffset(0, BOUNDARY_WORD_START, "oneword\n\n", 0, 9, IDs);
|
||||
testTextAtOffset(8, BOUNDARY_WORD_START, "oneword\n\n", 0, 9,
|
||||
|
@ -28,21 +28,6 @@
|
||||
var IDs = [ "input", "div", "editable", "textarea" ];
|
||||
var regularIDs = [ "input", "div", "editable" ];
|
||||
|
||||
// BOUNDARY_CHAR
|
||||
|
||||
testCharAfterOffset(IDs, 0, "e", 1, 2);
|
||||
testCharAfterOffset(IDs, 1, "l", 2, 3);
|
||||
testCharAfterOffset(regularIDs, 14, "", 15, 15);
|
||||
testCharAfterOffset("textarea", 14, "\n", 15, 16);
|
||||
|
||||
// XXX: why are 15/15 expected? there's no 16 offset we are trying to
|
||||
// get an offset for?
|
||||
testTextAfterOffset(15, BOUNDARY_CHAR, "", 15, 15,
|
||||
"input", kOk, kTodo, kTodo,
|
||||
"div", kOk, kTodo, kTodo,
|
||||
"editable", kOk, kTodo, kTodo);
|
||||
testCharAfterOffset("textarea", 15, "", 16, 16);
|
||||
|
||||
// BOUNDARY_WORD_START
|
||||
testTextAfterOffset(0, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
|
||||
testTextAfterOffset(1, BOUNDARY_WORD_START, "my ", 6, 9, IDs);
|
||||
@ -116,12 +101,6 @@
|
||||
|
||||
var IDs = [ "input", "div", "editable", "textarea" ];
|
||||
|
||||
// BOUNDARY_CHAR
|
||||
testCharBeforeOffset(IDs, 0, "", 0, 0);
|
||||
testCharBeforeOffset(IDs, 1, "h", 0, 1);
|
||||
testCharBeforeOffset(IDs, 14, "n", 13, 14);
|
||||
testCharBeforeOffset(IDs, 15, "d", 14, 15);
|
||||
|
||||
// BOUNDARY_WORD_START
|
||||
testTextBeforeOffset(0, BOUNDARY_WORD_START, "", 0, 0, IDs);
|
||||
testTextBeforeOffset(1, BOUNDARY_WORD_START, "", 0, 0, IDs);
|
||||
@ -200,15 +179,6 @@
|
||||
IDs = [ "input", "div", "editable", "textarea" ];
|
||||
regularIDs = [ "input", "div", "editable" ];
|
||||
|
||||
// BOUNDARY_CHAR
|
||||
|
||||
testCharAtOffset(IDs, 0, "h", 0, 1);
|
||||
testCharAtOffset(IDs, 1, "e", 1, 2);
|
||||
testCharAtOffset(IDs, 14, "d", 14, 15);
|
||||
testCharAtOffset(regularIDs, 15, "", 15, 15);
|
||||
testCharAtOffset("textarea", 15, "\n", 15, 16);
|
||||
testCharAtOffset("textarea", 16, "", 16, 16);
|
||||
|
||||
// BOUNDARY_WORD_START
|
||||
testTextAtOffset(0, BOUNDARY_WORD_START, "hello ", 0, 6, IDs);
|
||||
testTextAtOffset(1, BOUNDARY_WORD_START, "hello ", 0, 6, IDs);
|
||||
|
@ -23,19 +23,6 @@
|
||||
|
||||
var IDs = [ "input", "div", "editable", "textarea" ];
|
||||
|
||||
// BOUNDARY_CHAR
|
||||
testCharAfterOffset(IDs, 0, "r", 1, 2);
|
||||
testCharAfterOffset(IDs, 1, "a", 2, 3);
|
||||
testCharAfterOffset(IDs, 4, " ", 5, 6);
|
||||
testCharAfterOffset(IDs, 5, "S", 6, 7);
|
||||
testCharAfterOffset(IDs, 8, " ", 9, 10);
|
||||
testCharAfterOffset(IDs, 9, " ", 10, 11);
|
||||
testCharAfterOffset(IDs, 10, "R", 11, 12);
|
||||
testCharAfterOffset(IDs, 15, " ", 16, 17);
|
||||
testCharAfterOffset(IDs, 16, " ", 17, 18);
|
||||
testCharAfterOffset(IDs, 17, " ", 18, 19);
|
||||
testCharAfterOffset(IDs, 18, "r", 19, 20);
|
||||
|
||||
// BOUNDARY_WORD_START
|
||||
testTextAfterOffset(0, BOUNDARY_WORD_START, "Sir ", 6, 11, IDs);
|
||||
testTextAfterOffset(5, BOUNDARY_WORD_START, "Sir ", 6, 11, IDs);
|
||||
@ -105,15 +92,6 @@
|
||||
|
||||
var IDs = [ "input", "div", "editable", "textarea" ];
|
||||
|
||||
// BOUNDARY_CHAR
|
||||
testCharBeforeOffset(IDs, 0, "", 0, 0);
|
||||
testCharBeforeOffset(IDs, 1, "B", 0, 1);
|
||||
testCharBeforeOffset(IDs, 6, " ", 5, 6);
|
||||
testCharBeforeOffset(IDs, 10, " ", 9, 10);
|
||||
testCharBeforeOffset(IDs, 11, " ", 10, 11);
|
||||
testCharBeforeOffset(IDs, 17, " ", 16, 17);
|
||||
testCharBeforeOffset(IDs, 19, " ", 18, 19);
|
||||
|
||||
// BOUNDARY_WORD_START
|
||||
testTextBeforeOffset(0, BOUNDARY_WORD_START, "", 0, 0, IDs);
|
||||
testTextBeforeOffset(1, BOUNDARY_WORD_START, "", 0, 0, IDs);
|
||||
@ -152,38 +130,6 @@
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// getTextAtOffset
|
||||
|
||||
// BOUNDARY_CHAR
|
||||
testTextAtOffset(0, BOUNDARY_CHAR, "B", 0, 1,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(1, BOUNDARY_CHAR, "r", 1, 2,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(5, BOUNDARY_CHAR, " ", 5, 6,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(9, BOUNDARY_CHAR, " ", 9, 10,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(10, BOUNDARY_CHAR, " ", 10, 11,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(17, BOUNDARY_CHAR, " ", 17, 18,
|
||||
"input", kOk, kOk, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
|
||||
// BOUNDARY_WORD_START
|
||||
testTextAtOffset(0, BOUNDARY_WORD_START, "Brave ", 0, 6,
|
||||
"input", kOk, kOk, kOk,
|
||||
|
Loading…
Reference in New Issue
Block a user