Bug 451376 – IAccessibleText::attributes provides incorrect info after a mis-spelled word, r=Olli.Pettay, MarcoZ, sr=neil

This commit is contained in:
Alexander Surkov 2008-08-26 11:04:14 +08:00
parent 8c12a88361
commit daf87871dd
4 changed files with 86 additions and 5 deletions

View File

@ -67,7 +67,7 @@
return;
}
var errorMsg = " for " + aID + "at offset " + aOffset;
var errorMsg = " for " + aID + " at offset " + aOffset;
is(startOffset.value, aStartOffset,
"Wrong start offset" + errorMsg);
is(endOffset.value, aEndOffset,
@ -98,10 +98,10 @@
if (!(prop.key in aExpectedAttrs))
ok(false,
"Unexpected attribute '" + prop.key + "'" + aErrorMsg);
"Unexpected attribute '" + prop.key + "' " + aErrorMsg);
else
is(prop.value, aExpectedAttrs[prop.key],
"Attribute '" + prop.key + "' has wrong value" + aErrorMsg);
"Attribute '" + prop.key + " 'has wrong value" + aErrorMsg);
}
for (var name in aExpectedAttrs) {
@ -113,7 +113,7 @@
if (!value)
ok(false,
"There is no expected attribute '" + name + "'" + aErrorMsg);
"There is no expected attribute '" + name + "' " + aErrorMsg);
}
}
@ -176,6 +176,7 @@
testTextAttrs(ID, 0, attrs, 0, 11, defAttrs);
testTextAttrs(ID, 11, misspelledAttrs, 11, 17, defAttrs);
testTextAttrs(ID, 17, attrs, 17, 18, defAttrs);
testTextAttrs(ID, 18, misspelledAttrs, 18, 22, defAttrs);
is(gA11yEventObserver.mTextAttrChangedEventCounter, 2,

View File

@ -398,7 +398,7 @@ nsRange::ComparePoint(nsIDOMNode* aParent, PRInt32 aOffset, PRInt16* aResult)
*aResult = cmp;
}
else if (nsContentUtils::ComparePoints(mEndParent, mEndOffset,
parent, aOffset) == -1) {
parent, aOffset) <= 0) {
*aResult = 1;
}
else {

View File

@ -190,6 +190,7 @@ _TEST_FILES = test_bug5141.html \
bug435425_redirect.sjs \
test_bug438519.html \
test_bug444722.html \
test_bug451376.html \
test_text_replaceWholeText.html \
test_text_wholeText.html \
wholeTexty-helper.xml \

View File

@ -0,0 +1,79 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=451376
-->
<head>
<title>Test for Bug 451376</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="doTest()">
<a target="_blank"
title="IAccessibleText::attributes provides incorrect info after a mis-spelled word"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=451376">Mozilla Bug 451376</a>
<p id="display"></p>
<div id="content" style="display:none">
</div>
<pre id="test">
<div id="area"><button>btn1</button>text<button>btn2</button></div>
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
function testRange(aRangeID,
aStartNode, aStartOffset,
aEndNode, aEndOffset,
aBeforeRangeNode, aBeforeRangeOffset,
aInRangeNode, aInRangeOffset,
aAfterRangeNode, aAfterRangeOffset)
{
var range = document.createRange().
QueryInterface(Components.interfaces.nsIDOMNSRange);
range.setStart(aStartNode, aStartOffset);
range.setEnd(aEndNode, aEndOffset);
if (aBeforeRangeNode)
is(range.comparePoint(aBeforeRangeNode, aBeforeRangeOffset), -1,
"Wrong result for the point before the range '" + aRangeID + "'");
if (aInRangeNode)
is(range.comparePoint(aInRangeNode, aInRangeOffset), 0,
"Wrong result for the point inside the range '" + aRangeID + "'");
if (aAfterRangeNode)
is(range.comparePoint(aAfterRangeNode, aAfterRangeOffset), 1,
"Wrong result for the point after the range '" + aRangeID + "'");
}
function doTest()
{
var area = document.getElementById("area");
var btn1 = area.firstChild;
var text = btn1.nextSibling;
var btn2 = area.lastChild;
testRange("range1", area, 0, area, 1,
null, 0,
area, 0,
area, 1);
testRange("range2", text, 2, text, 4,
text, 0,
text, 3,
text, 4);
testRange("range3", text, 4, area, 2,
text, 0,
text, 4,
area, 2);
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>