Bug 890353 - move get text for line boundary tests into separate file, r=tbsaunde

--HG--
rename : accessible/tests/mochitest/text/test_singleline.html => accessible/tests/mochitest/text/test_lineboundary.html
This commit is contained in:
Alexander Surkov 2013-07-24 10:56:14 -04:00
parent c928a7a6de
commit 812f2f3899
4 changed files with 132 additions and 251 deletions

View File

@ -18,11 +18,10 @@ MOCHITEST_A11Y_FILES = \
test_doc.html \
test_gettext.html \
test_hypertext.html \
test_lineboundary.html \
test_label.xul \
test_multiline.html \
test_passwords.html \
test_selection.html \
test_singleline.html \
test_wordboundary.html \
test_words.html \
$(NULL)

View File

@ -0,0 +1,131 @@
<!DOCTYPE html>
<html>
<head>
<title>Line boundary getText* functions 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 = [ "input", "div", "editable", "textarea" ];
testTextBeforeOffset(IDs, BOUNDARY_LINE_START,
[ [ 0, 15, "", 0, 0 ] ]);
testTextBeforeOffset(IDs, BOUNDARY_LINE_END,
[ [ 0, 15, "", 0, 0 ] ]);
testTextAtOffset(IDs, BOUNDARY_LINE_START,
[ [ 0, 15, "hello my friend", 0, 15 ] ]);
testTextAtOffset(IDs, BOUNDARY_LINE_END,
[ [ 0, 15, "hello my friend", 0, 15 ] ]);
testTextAfterOffset(IDs, BOUNDARY_LINE_START,
[ [ 0, 15, "", 15, 15 ] ]);
testTextAfterOffset(IDs, BOUNDARY_LINE_END,
[ [ 0, 15, "", 15, 15 ] ]);
//////////////////////////////////////////////////////////////////////////
// __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 = [ "ml_div", "ml_divbr", "ml_editable", "ml_editablebr", "ml_textarea"];
testTextBeforeOffset(IDs, BOUNDARY_LINE_START,
[ [ 0, 7, "", 0, 0 ],
[ 8, 8, "oneword\n", 0, 8 ],
[ 9, 18, "\n", 8, 9 ],
[ 19, 19, "two words\n", 9, 19 ]]);
testTextBeforeOffset(IDs, BOUNDARY_LINE_END,
[ [ 0, 7, "", 0, 0 ],
[ 8, 8, "oneword", 0, 7 ],
[ 9, 18, "\n", 7, 8 ],
[ 19, 19, "\ntwo words", 8, 18 ]]);
testTextAtOffset(IDs, BOUNDARY_LINE_START,
[ [ 0, 7, "oneword\n", 0, 8 ],
[ 8, 8, "\n", 8, 9 ],
[ 9, 18, "two words\n", 9, 19 ],
[ 19, 19, "", 19, 19 ]]);
testTextAtOffset(IDs, BOUNDARY_LINE_END,
[ [ 0, 7, "oneword", 0, 7 ],
[ 8, 8, "\n", 7, 8 ],
[ 9, 18, "\ntwo words", 8, 18 ],
[ 19, 19, "\n", 18, 19 ]]);
testTextAfterOffset(IDs, BOUNDARY_LINE_START,
[ [ 0, 7, "\n", 8, 9 ],
[ 8, 8, "two words\n", 9, 19 ],
[ 9, 19, "", 19, 19 ]]);
testTextAfterOffset(IDs, BOUNDARY_LINE_END,
[ [ 0, 7, "\n", 7, 8 ],
[ 8, 8, "\ntwo words", 8, 18 ],
[ 9, 18, "\n", 18, 19 ],
[ 19, 19, "", 19, 19 ]]);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="getTextAtOffset for word boundaries: beginning of a new life"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=853340">
Bug 853340
</a>
<a target="_blank"
title="getTextBeforeOffset for word boundaries: evolving"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=855732">
Bug 855732
</a>
<a target="_blank"
title=" getTextAfterOffset for line boundary on new rails"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=882292">
Bug 882292
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<input id="input" value="hello my friend"/>
<div id="div">hello my friend</div>
<div id="editable" contenteditable="true">hello my friend</div>
<textarea id="textarea">hello my friend</textarea>
<pre>
<div id="ml_div">oneword
two words
</div>
<div id="ml_divbr">oneword<br/><br/>two words<br/></div>
<div id="ml_editable" contenteditable="true">oneword
two words
</div>
<div id="ml_editablebr" contenteditable="true">oneword<br/><br/>two words<br/></div>
<textarea id="ml_textarea" cols="300">oneword
two words
</textarea>
</pre>
</body>
</html>

View File

@ -1,137 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>nsIAccessibleText getText related function in multiline text</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<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()
{
// __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
////////////////////////////////////////////////////////////////////////
// getText
var IDs = ["div", "divbr", "editable", "editablebr", "textarea"];
////////////////////////////////////////////////////////////////////////
// getTextAfterOffset
// BOUNDARY_LINE_START
testTextAfterOffset(0, BOUNDARY_LINE_START, "\n", 8, 9, IDs);
testTextAfterOffset(7, BOUNDARY_LINE_START, "\n", 8, 9, IDs);
testTextAfterOffset(8, BOUNDARY_LINE_START, "two words\n", 9, 19, IDs);
testTextAfterOffset(9, BOUNDARY_LINE_START, "", 19, 19, IDs);
testTextAfterOffset(19, BOUNDARY_LINE_START, "", 19, 19, IDs);
// BOUNDARY_LINE_END
testTextAfterOffset(0, BOUNDARY_LINE_END, "\n", 7, 8, IDs);
testTextAfterOffset(7, BOUNDARY_LINE_END, "\n", 7, 8, IDs);
testTextAfterOffset(8, BOUNDARY_LINE_END, "\ntwo words", 8, 18, IDs);
testTextAfterOffset(9, BOUNDARY_LINE_END, "\n", 18, 19, IDs);
testTextAfterOffset(18, BOUNDARY_LINE_END, "\n", 18, 19, IDs);
testTextAfterOffset(19, BOUNDARY_LINE_END, "", 19, 19, IDs);
////////////////////////////////////////////////////////////////////////
// getTextBeforeOffset
// BOUNDARY_LINE_START
testTextBeforeOffset(0, BOUNDARY_LINE_START, "", 0, 0, IDs);
testTextBeforeOffset(8, BOUNDARY_LINE_START, "oneword\n", 0, 8, IDs);
testTextBeforeOffset(9, BOUNDARY_LINE_START, "\n", 8, 9, IDs);
testTextBeforeOffset(18, BOUNDARY_LINE_START, "\n", 8, 9, IDs);
testTextBeforeOffset(19, BOUNDARY_LINE_START, "two words\n", 9, 19, IDs);
// BOUNDARY_LINE_END
testTextBeforeOffset(0, BOUNDARY_LINE_END, "", 0, 0, IDs);
testTextBeforeOffset(7, BOUNDARY_LINE_END, "", 0, 0, IDs);
testTextBeforeOffset(8, BOUNDARY_LINE_END, "oneword", 0, 7, IDs);
testTextBeforeOffset(9, BOUNDARY_LINE_END, "\n", 7, 8, IDs);
testTextBeforeOffset(18, BOUNDARY_LINE_END, "\n", 7, 8, IDs);
testTextBeforeOffset(19, BOUNDARY_LINE_END, "\ntwo words", 8, 18, IDs);
////////////////////////////////////////////////////////////////////////
// getTextAtOffset
// BOUNDARY_LINE_START
testTextAtOffset(0, BOUNDARY_LINE_START, "oneword\n", 0, 8, IDs);
testTextAtOffset(7, BOUNDARY_LINE_START, "oneword\n", 0, 8, IDs);
testTextAtOffset(8, BOUNDARY_LINE_START, "\n", 8, 9, IDs);
testTextAtOffset(9, BOUNDARY_LINE_START, "two words\n", 9, 19, IDs);
testTextAtOffset(13, BOUNDARY_LINE_START, "two words\n", 9, 19, IDs);
testTextAtOffset(18, BOUNDARY_LINE_START, "two words\n", 9, 19, IDs);
testTextAtOffset(19, BOUNDARY_LINE_START, "", 19, 19, IDs);
// BOUNDARY_LINE_END
testTextAtOffset(0, BOUNDARY_LINE_END, "oneword", 0, 7, IDs);
testTextAtOffset(7, BOUNDARY_LINE_END, "oneword", 0, 7, IDs);
testTextAtOffset(8, BOUNDARY_LINE_END, "\n", 7, 8, IDs);
testTextAtOffset(9, BOUNDARY_LINE_END, "\ntwo words", 8, 18, IDs);
testTextAtOffset(17, BOUNDARY_LINE_END, "\ntwo words", 8, 18, IDs);
testTextAtOffset(18, BOUNDARY_LINE_END, "\ntwo words", 8, 18, IDs);
testTextAtOffset(19, BOUNDARY_LINE_END, "\n", 18, 19, IDs);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="nsIAccessibleText getText related functions test in multiline text"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=612331">
Bug 612331
</a>
<a target="_blank"
title="getTextAtOffset for word boundaries: beginning of a new life"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=853340">
Bug 853340
</a>
<a target="_blank"
title="getTextBeforeOffset for word boundaries: evolving"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=855732">
Bug 855732
</a>
<a target="_blank"
title=" getTextAfterOffset for line boundary on new rails"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=882292">
Bug 882292
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
<div id="div">oneword
two words
</div>
<div id="divbr">oneword<br/><br/>two words<br/></div>
<div id="editable" contenteditable="true">oneword
two words
</div>
<div id="editablebr" contenteditable="true">oneword<br/><br/>two words<br/></div>
<textarea id="textarea" cols="300">oneword
two words
</textarea>
</pre>
</body>
</html>

View File

@ -1,112 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>nsIAccessibleText getText related function tests for html:input,html:div and html:textarea</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
////////////////////////////////////////////////////////////////////////
// getTextAfterOffset
var IDs = [ "input", "div", "editable", "textarea" ];
var regularIDs = [ "input", "div", "editable" ];
// BOUNDARY_LINE_START
testTextAfterOffset(0, BOUNDARY_LINE_START, "", 15, 15, IDs);
testTextAfterOffset(1, BOUNDARY_LINE_START, "", 15, 15, IDs);
testTextAfterOffset(14, BOUNDARY_LINE_START, "", 15, 15, IDs);
testTextAfterOffset(15, BOUNDARY_LINE_START, "", 15, 15, IDs);
// BOUNDARY_LINE_END
testTextAfterOffset(0, BOUNDARY_LINE_END, "", 15, 15, IDs);
testTextAfterOffset(1, BOUNDARY_LINE_END, "", 15, 15, IDs);
testTextAfterOffset(14, BOUNDARY_LINE_END, "", 15, 15, IDs);
testTextAfterOffset(15, BOUNDARY_LINE_END, "", 15, 15, IDs);
////////////////////////////////////////////////////////////////////////
// getTextBeforeOffset
var IDs = [ "input", "div", "editable", "textarea" ];
// BOUNDARY_LINE_START
testTextBeforeOffset(0, BOUNDARY_LINE_START, "", 0, 0, IDs);
testTextBeforeOffset(1, BOUNDARY_LINE_START, "", 0, 0, IDs);
testTextBeforeOffset(14, BOUNDARY_LINE_START, "", 0, 0, IDs);
testTextBeforeOffset(15, BOUNDARY_LINE_START, "", 0, 0, IDs);
// BOUNDARY_LINE_END
testTextBeforeOffset(0, BOUNDARY_LINE_END, "", 0, 0, IDs);
testTextBeforeOffset(1, BOUNDARY_LINE_END, "", 0, 0, IDs);
testTextBeforeOffset(14, BOUNDARY_LINE_END, "", 0, 0, IDs);
testTextBeforeOffset(15, BOUNDARY_LINE_END, "", 0, 0, IDs);
////////////////////////////////////////////////////////////////////////
// getTextAtOffset
IDs = [ "input", "div", "editable", "textarea" ];
regularIDs = [ "input", "div", "editable" ];
// BOUNDARY_LINE_START
testTextAtOffset(0, BOUNDARY_LINE_START, "hello my friend", 0, 15, IDs);
testTextAtOffset(1, BOUNDARY_LINE_START, "hello my friend", 0, 15, IDs);
testTextAtOffset(14, BOUNDARY_LINE_START, "hello my friend", 0, 15, IDs);
testTextAtOffset(15, BOUNDARY_LINE_START, "hello my friend", 0, 15, IDs);
// BOUNDARY_LINE_END
testTextAtOffset(0, BOUNDARY_LINE_END, "hello my friend", 0, 15, IDs);
testTextAtOffset(1, BOUNDARY_LINE_END, "hello my friend", 0, 15, IDs);
testTextAtOffset(14, BOUNDARY_LINE_END, "hello my friend", 0, 15, IDs);
testTextAtOffset(15, BOUNDARY_LINE_END, "hello my friend", 0, 15, IDs);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="nsIAccessibleText getText related function tests for html:input,html:div and html:textarea"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=452769">
Bug 452769
</a>
<a target="_blank"
title="getTextAtOffset for word boundaries: beginning of a new life"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=853340">
Bug 853340
</a>
<a target="_blank"
title="getTextBeforeOffset for word boundaries: evolving"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=855732">
Bug 855732
</a>
<a target="_blank"
title=" getTextAfterOffset for line boundary on new rails"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=882292">
Bug 882292
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<input id="input" value="hello my friend"/>
<div id="div">hello my friend</div>
<div id="editable" contenteditable="true">hello my friend</div>
<textarea id="textarea">hello my friend</textarea>
</body>
</html>