[webkit-changes] cvs commit: LayoutTests/editing/selection
anchor-focus1-expected.txt anchor-focus1.html
anchor-focus2-expected.txt anchor-focus2.html
anchor-focus3-expected.txt anchor-focus3.html
getRangeAt-expected.txt getRangeAt.html unrendered-001-expected.txt
Justin
justing at opensource.apple.com
Tue Jan 3 04:37:08 PST 2006
justing 06/01/03 04:37:08
Modified: . ChangeLog
editing/selection unrendered-001-expected.txt
Added: editing/selection anchor-focus1-expected.txt
anchor-focus1.html anchor-focus2-expected.txt
anchor-focus2.html anchor-focus3-expected.txt
anchor-focus3.html getRangeAt-expected.txt
getRangeAt.html
Log:
New/updated layout tests for:
<http://bugzilla.opendarwin.org/show_bug.cgi?id=4904>
Bug with baseOffset and extentOffset in selections (for writely.com)
<rdar://problem/4259818>
selection object incorrect after double-clicking a word
* editing/selection/anchor-focus1-expected.txt: Added.
* editing/selection/anchor-focus1.html: Added.
* editing/selection/anchor-focus2-expected.txt: Added.
* editing/selection/anchor-focus2.html: Added.
* editing/selection/anchor-focus3-expected.txt: Added.
* editing/selection/anchor-focus3.html: Added.
* editing/selection/getRangeAt-expected.txt: Added.
* editing/selection/getRangeAt.html: Added.
* editing/selection/unrendered-001-expected.txt:
Revision Changes Path
1.214 +18 -0 LayoutTests/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/LayoutTests/ChangeLog,v
retrieving revision 1.213
retrieving revision 1.214
diff -u -r1.213 -r1.214
--- ChangeLog 3 Jan 2006 10:06:35 -0000 1.213
+++ ChangeLog 3 Jan 2006 12:37:05 -0000 1.214
@@ -1,3 +1,21 @@
+2006-01-03 Justin Garcia <justin.garcia at apple.com>
+
+ New/updated layout tests for:
+ <http://bugzilla.opendarwin.org/show_bug.cgi?id=4904>
+ Bug with baseOffset and extentOffset in selections (for writely.com)
+ <rdar://problem/4259818>
+ selection object incorrect after double-clicking a word
+
+ * editing/selection/anchor-focus1-expected.txt: Added.
+ * editing/selection/anchor-focus1.html: Added.
+ * editing/selection/anchor-focus2-expected.txt: Added.
+ * editing/selection/anchor-focus2.html: Added.
+ * editing/selection/anchor-focus3-expected.txt: Added.
+ * editing/selection/anchor-focus3.html: Added.
+ * editing/selection/getRangeAt-expected.txt: Added.
+ * editing/selection/getRangeAt.html: Added.
+ * editing/selection/unrendered-001-expected.txt:
+
2006-01-03 Anders Carlsson <andersca at mac.com>
Reviewed by Maciej.
1.7 +1 -1 LayoutTests/editing/selection/unrendered-001-expected.txt
Index: unrendered-001-expected.txt
===================================================================
RCS file: /cvs/root/LayoutTests/editing/selection/unrendered-001-expected.txt,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- unrendered-001-expected.txt 18 Aug 2005 04:23:00 -0000 1.6
+++ unrendered-001-expected.txt 3 Jan 2006 12:37:06 -0000 1.7
@@ -10,4 +10,4 @@
text run at (74,84) width 32: "foo"
RenderText {TEXT} at (106,84) size 40x48
text run at (106,84) width 40: " baz"
-caret: position 0 of child 3 {TEXT} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
+caret: position 3 of child 0 {TEXT} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
1.1 LayoutTests/editing/selection/anchor-focus1-expected.txt
Index: anchor-focus1-expected.txt
===================================================================
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > SPAN > DIV > BODY > HTML > #document to 4 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
This tests the anchorNode, anchorOffset, focusNode and focusOffset properties of the Selection object. These properties are part of Mozilla's Selection object API, and so their values should be consistent in both browsers.
text
Anchor ([object Text], 0) is correct.
Focus ([object Text], 4) is correct.
1.1 LayoutTests/editing/selection/anchor-focus1.html
Index: anchor-focus1.html
===================================================================
<html>
<head>
<script>
function log(str) {
var li = document.createElement("li");
li.appendChild(document.createTextNode(str));
var console = document.getElementById("console");
console.appendChild(li);
}
function runTest() {
var elem = document.getElementById("test");
var selection = window.getSelection();
var anchorNode = selection.anchorNode;
var anchorOffset = selection.anchorOffset;
var focusNode = selection.focusNode;
var focusOffset = selection.focusOffset;
var anchorString = "Anchor (" + anchorNode + ", " + anchorOffset + ")";
var anchorCorrect = (anchorNode == elem || anchorNode == elem.firstChild) && anchorOffset == 0;
if (anchorCorrect)
log(anchorString + " is correct.");
else
throw(anchorString + " is incorrect.");
var focusString = "Focus (" + focusNode + ", " + focusOffset + ")";
var focusCorrect = (focusNode == elem && focusOffset == 1 || focusNode == elem.firstChild && focusOffset == elem.firstChild.length);
if (focusCorrect)
log(focusString + " is correct.");
else
throw(focusString + " is incorrect.");
}
function manualTest() {
try {
runTest();
} catch(e) {
log("Test Failed. Error was: " + e);
}
}
function automaticTest() {
try {
if (!window.layoutTestController)
throw("This test uses the layoutTestController's eventSender to do mouse clicks. To run it manually, double click on the text inside the blue box and click the 'Run Test' button.");
window.layoutTestController.dumpAsText();
var elem = document.getElementById("test");
// x, y should be in the middle of elem.
x = elem.offsetLeft + elem.offsetWidth / 2;
y = elem.offsetTop + elem.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseUp();
eventSender.mouseDown();
eventSender.mouseUp();
runTest();
} catch(e) {
log("Test Failed. Error was: " + e);
}
}
</script>
</head>
<body>
<p>This tests the anchorNode, anchorOffset, focusNode and focusOffset properties of the Selection object. These properties are part of Mozilla's Selection object API, and so their values should be consistent in both browsers.</p>
<input type="button" onclick="manualTest();" value="Run Test">
<div style="border: 1px solid blue; padding: 1em;"><span id="test">text</span></div>
<ul id="console"></ul>
<script>automaticTest();</script>
</body>
</html>
1.1 LayoutTests/editing/selection/anchor-focus2-expected.txt
Index: anchor-focus2-expected.txt
===================================================================
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
This tests the anchorNode, anchorOffset, focusNode and focusOffset properties of the Selection object. These properties are part of Mozilla's Selection object API, and so their values should be consistent in both browsers.
text
Anchor ([object Text], 0) is correct.
Focus ([object Text], 4) is correct.
1.1 LayoutTests/editing/selection/anchor-focus2.html
Index: anchor-focus2.html
===================================================================
<html>
<head>
<script>
var x1, x2, y;
function log(str) {
var li = document.createElement("li");
li.appendChild(document.createTextNode(str));
var console = document.getElementById("console");
console.appendChild(li);
}
function runTest() {
var elem = document.getElementById("test");
var selection = window.getSelection();
var anchorNode = selection.anchorNode;
var anchorOffset = selection.anchorOffset;
var focusNode = selection.focusNode;
var focusOffset = selection.focusOffset;
var anchorString = "Anchor (" + anchorNode + ", " + anchorOffset + ")";
var anchorCorrect = (anchorNode == elem || anchorNode == elem.firstChild) && anchorOffset == 0;
if (anchorCorrect)
log(anchorString + " is correct.");
else
throw(anchorString + " is incorrect.");
var focusString = "Focus (" + focusNode + ", " + focusOffset + ")";
var focusCorrect = (focusNode == elem && focusOffset == 1 || focusNode == elem.firstChild && focusOffset == elem.firstChild.length);
if (focusCorrect)
log(focusString + " is correct.");
else
throw(focusString + " is incorrect.");
}
function manualTest() {
try {
runTest();
} catch(e) {
log("Test Failed. Error was: " + e);
}
}
function automaticTest() {
try {
if (!window.layoutTestController)
throw("This test uses the layoutTestController's eventSender to do mouse clicks. To run it manually, from left to right, select 'text' in the box below, then click the 'Run Test' button.");
window.layoutTestController.dumpAsText();
var elem = document.getElementById("test");
// (x1, y) to (x2, y) should select the element.
// selects the text from left to right.
x1 = elem.offsetLeft;
x2 = elem.offsetLeft + elem.offsetWidth;
y = elem.offsetTop + elem.offsetHeight / 2;
eventSender.mouseMoveTo(x1, y);
eventSender.mouseDown();
eventSender.mouseMoveTo(x1, y);
eventSender.mouseMoveTo(x2, y);
eventSender.mouseUp();
runTest();
} catch(e) {
log("Test Failed. Error was: " + e);
}
}
</script>
</head>
<body>
<p>This tests the anchorNode, anchorOffset, focusNode and focusOffset properties of the Selection object. These properties are part of Mozilla's Selection object API, and so their values should be consistent in both browsers.</p>
<input type="button" onclick="manualTest();" value="Run Test">
<div style="border: 1px solid blue;" id="test">text</div>
<ul id="console"></ul>
<script>automaticTest();</script>
</body>
</html>
1.1 LayoutTests/editing/selection/anchor-focus3-expected.txt
Index: anchor-focus3-expected.txt
===================================================================
EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
This tests the anchorNode, anchorOffset, focusNode and focusOffset properties of the Selection object. These properties are part of Mozilla's Selection object API, and so their values should be consistent in both browsers.
text
Anchor ([object Text], 4) is correct.
Focus ([object Text], 0) is correct.
1.1 LayoutTests/editing/selection/anchor-focus3.html
Index: anchor-focus3.html
===================================================================
<html>
<head>
<script>
function log(str) {
var li = document.createElement("li");
li.appendChild(document.createTextNode(str));
var console = document.getElementById("console");
console.appendChild(li);
}
function runTest() {
var elem = document.getElementById("test");
var selection = window.getSelection();
var anchorNode = selection.anchorNode;
var anchorOffset = selection.anchorOffset;
var focusNode = selection.focusNode;
var focusOffset = selection.focusOffset;
var anchorString = "Anchor (" + anchorNode + ", " + anchorOffset + ")";
var anchorCorrect = anchorNode == elem && anchorOffset == 1 || anchorNode == elem.firstChild && anchorOffset == elem.firstChild.length;
if (anchorCorrect)
log(anchorString + " is correct.");
else
throw(anchorString + " is incorrect.");
var focusString = "Focus (" + focusNode + ", " + focusOffset + ")";
var focusCorrect = (focusNode == elem || focusNode == elem.firstChild) && focusOffset == 0;
if (focusCorrect)
log(focusString + " is correct.");
else
throw(focusString + " is incorrect.");
}
function manualTest() {
try {
runTest();
} catch(e) {
log("Test Failed. Error was: " + e);
}
}
function automaticTest() {
try {
if (!window.layoutTestController)
throw("This test does not run interactively. It uses the layoutTestController's eventSender to do mouse clicks. To run it manually, from right to left, select 'text' in the box below, then click the 'Run Test' button.");
window.layoutTestController.dumpAsText();
var elem = document.getElementById("test");
// (x1, y) to (x2, y) should select the element.
// selects the text from right to left.
x1 = elem.offsetLeft + elem.offsetWidth;
x2 = elem.offsetLeft;
y = elem.offsetTop + elem.offsetHeight / 2;
eventSender.mouseMoveTo(x1, y);
eventSender.mouseDown();
eventSender.mouseMoveTo(x1, y);
eventSender.mouseMoveTo(x2, y);
eventSender.mouseUp();
runTest();
} catch(e) {
log("Test Failed. Error was: " + e);
}
}
</script>
</head>
<body>
<p>This tests the anchorNode, anchorOffset, focusNode and focusOffset properties of the Selection object. These properties are part of Mozilla's Selection object API, and so their values should be consistent in both browsers.</p>
<input type="button" onclick="manualTest();" value="Run Test">
<div style="border: 1px solid blue;" id="test">text</div>
<ul id="console"></ul>
<script>automaticTest();</script>
</body>
</html>
1.1 LayoutTests/editing/selection/getRangeAt-expected.txt
Index: getRangeAt-expected.txt
===================================================================
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
This tests that Selection::getRangeAt(int) returns a valid Range object.
hello
[object Range]
[object Text]
[object Text]
1.1 LayoutTests/editing/selection/getRangeAt.html
Index: getRangeAt.html
===================================================================
<html>
<head><script>
function log(str) {
if (str == null)
str = "null"
var li = document.createElement("li");
var pre = document.createElement("pre");
pre.appendChild(document.createTextNode(str));
li.appendChild(pre);
var console = document.getElementById("console");
console.appendChild(li);
}
function runTest() {
var elem = document.getElementById("test");
var sel = window.getSelection();
if (window.layoutTestController)
window.layoutTestController.dumpAsText();
try {
sel.setBaseAndExtent(elem, 0, elem, 1);
var range = sel.getRangeAt(0);
log(range);
log(range.startContainer);
log(range.endContainer);
} catch(e) {
log("Error: " + e);
}
}
</script></head>
<body onload="runTest();">
<p>This tests that Selection::getRangeAt(int) returns a valid Range object.</p>
<div id="test" style="border:1px solid black; padding:1em;">hello</div>
<ul id="console"></ul>
</body>
</html>
More information about the webkit-changes
mailing list