Reviewed by justin
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Dec 2005 02:06:18 +0000 (02:06 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Dec 2005 02:06:18 +0000 (02:06 +0000)
        New layout tests for:
        <http://bugzilla.opendarwin.org/show_bug.cgi?id=4682>
        -[WebHTMLView firstRectForCharacterRange:] is using _selectedRange instead of the given range if no marked text

        * editing/input/firstrectforcharacterrange-plain-expected.txt: Added.
        * editing/input/firstrectforcharacterrange-plain.html: Added.
        * editing/input/firstrectforcharacterrange-styled-expected.txt: Added.
        * editing/input/firstrectforcharacterrange-styled.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@11708 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/editing/input/firstrectforcharacterrange-plain-expected.txt [new file with mode: 0644]
LayoutTests/editing/input/firstrectforcharacterrange-plain.html [new file with mode: 0644]
LayoutTests/editing/input/firstrectforcharacterrange-styled-expected.txt [new file with mode: 0644]
LayoutTests/editing/input/firstrectforcharacterrange-styled.html [new file with mode: 0644]

index 5a20a809340f7de8f8e70f9bdcec9b30d6929cc3..84397dfeaf9a201fa5c4b5a8de01c37d69855a01 100644 (file)
@@ -1,3 +1,16 @@
+2005-12-20  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by justin
+        
+        New layout tests for:
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=4682>
+        -[WebHTMLView firstRectForCharacterRange:] is using _selectedRange instead of the given range if no marked text
+
+        * editing/input/firstrectforcharacterrange-plain-expected.txt: Added.
+        * editing/input/firstrectforcharacterrange-plain.html: Added.
+        * editing/input/firstrectforcharacterrange-styled-expected.txt: Added.
+        * editing/input/firstrectforcharacterrange-styled.html: Added.
+
 2005-12-20  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by darin
diff --git a/LayoutTests/editing/input/firstrectforcharacterrange-plain-expected.txt b/LayoutTests/editing/input/firstrectforcharacterrange-plain-expected.txt
new file mode 100644 (file)
index 0000000..1836a79
--- /dev/null
@@ -0,0 +1,20 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+123456
+10,572,0,18
+18,572,0,18
+58,572,0,18
+58,572,0,18
+10,572,8,18
+50,572,8,18
+50,572,8,18
+50,572,8,18
+10,572,48,18
+10,572,48,18
+10,572,48,18
+18,572,40,18
+0,0,0,0
+0,0,0,0
+0,0,0,0
+0,0,0,0
+
+
diff --git a/LayoutTests/editing/input/firstrectforcharacterrange-plain.html b/LayoutTests/editing/input/firstrectforcharacterrange-plain.html
new file mode 100644 (file)
index 0000000..664d605
--- /dev/null
@@ -0,0 +1,58 @@
+<html>
+<head>
+<style>
+body { margin: 10; padding: 0 }
+</style>
+</head>
+<body contenteditable>
+123456
+<script type="text/javascript">
+
+       var console_messages = document.createElement("ol");
+       
+       function log(message)
+       {
+               var item = document.createElement("li");
+               item.appendChild(document.createTextNode(message));
+               console_messages.appendChild(item);
+       }
+       
+       if (window.layoutTestController) {
+               
+               try {
+               
+                       layoutTestController.dumpAsText();
+               
+                       window.getSelection().setPosition(document.body, 0);
+
+                       log(textInputController.firstRectForCharacterRange(0, 0)); // caret at the beginning 
+                       log(textInputController.firstRectForCharacterRange(1, 0)); // caret after the first character 
+                       log(textInputController.firstRectForCharacterRange(6, 0)); // caret at the end of line
+                       log(textInputController.firstRectForCharacterRange(6, 100)); // -"-
+                       log(textInputController.firstRectForCharacterRange(0, 1)); // first character
+                       log(textInputController.firstRectForCharacterRange(5, 1)); // last character
+                       log(textInputController.firstRectForCharacterRange(5, 2)); // -"-
+                       log(textInputController.firstRectForCharacterRange(5, 100)); // -"-
+                       log(textInputController.firstRectForCharacterRange(0, 6)); // first line
+                       log(textInputController.firstRectForCharacterRange(0, 7)); // -"-
+                       log(textInputController.firstRectForCharacterRange(0, 4294967295)); // -"-
+                       log(textInputController.firstRectForCharacterRange(1, 4294967295)); // first line without the first character
+                       log(textInputController.firstRectForCharacterRange(7, 0)); // out of bounds, should be zero rect
+                       log(textInputController.firstRectForCharacterRange(1000, 0)); // -"-
+                       log(textInputController.firstRectForCharacterRange(7, 1)); // -"-
+                       log(textInputController.firstRectForCharacterRange(7, 4294967295)); // -"-
+
+               } catch (ex) {
+                       log("Exception: " + ex.description);
+               }
+               
+               var console = document.createElement("p");
+               console.appendChild(console_messages);
+               document.body.appendChild(console);
+               
+       } else {
+               document.write("(cannot run interactively)");
+       }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/editing/input/firstrectforcharacterrange-styled-expected.txt b/LayoutTests/editing/input/firstrectforcharacterrange-styled-expected.txt
new file mode 100644 (file)
index 0000000..09e2abf
--- /dev/null
@@ -0,0 +1,24 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > I > B > BODY > HTML > #document to 1 of #text > I > B > BODY > HTML > #document toDOMRange:range from 1 of #text > I > B > BODY > HTML > #document to 3 of #text > I > B > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+123456
+10,572,0,18
+18,572,0,18
+58,572,0,18
+58,572,0,18
+10,572,8,18
+50,572,8,18
+50,572,8,18
+50,572,8,18
+10,572,48,18
+10,572,48,18
+10,572,48,18
+18,572,40,18
+0,0,0,0
+0,0,0,0
+0,0,0,0
+0,0,0,0
+
+
diff --git a/LayoutTests/editing/input/firstrectforcharacterrange-styled.html b/LayoutTests/editing/input/firstrectforcharacterrange-styled.html
new file mode 100644 (file)
index 0000000..2dbb61f
--- /dev/null
@@ -0,0 +1,59 @@
+<html>
+<head>
+<style>
+body { margin: 10; padding: 0 }
+</style>
+</head>
+<body contenteditable>
+12<b>3<i>4</i></b>
+<script type="text/javascript">
+
+       var console_messages = document.createElement("ol");
+       
+       function log(message)
+       {
+               var item = document.createElement("li");
+               item.appendChild(document.createTextNode(message));
+               console_messages.appendChild(item);
+       }
+       
+       if (window.layoutTestController) {
+               
+               try {
+               
+                       layoutTestController.dumpAsText();
+               
+                       window.getSelection().setPosition(document.body, 4);
+            textInputController.setMarkedText("56", 0, 1);
+
+                       log(textInputController.firstRectForCharacterRange(0, 0)); // caret at the beginning 
+                       log(textInputController.firstRectForCharacterRange(1, 0)); // caret after the first character 
+                       log(textInputController.firstRectForCharacterRange(6, 0)); // caret at the end of line
+                       log(textInputController.firstRectForCharacterRange(6, 100)); // -"-
+                       log(textInputController.firstRectForCharacterRange(0, 1)); // first character
+                       log(textInputController.firstRectForCharacterRange(5, 1)); // last character
+                       log(textInputController.firstRectForCharacterRange(5, 2)); // -"-
+                       log(textInputController.firstRectForCharacterRange(5, 100)); // -"-
+                       log(textInputController.firstRectForCharacterRange(0, 6)); // first line
+                       log(textInputController.firstRectForCharacterRange(0, 7)); // -"-
+                       log(textInputController.firstRectForCharacterRange(0, 4294967295)); // -"-
+                       log(textInputController.firstRectForCharacterRange(1, 4294967295)); // first line without the first character
+                       log(textInputController.firstRectForCharacterRange(7, 0)); // out of bounds, should be zero rect
+                       log(textInputController.firstRectForCharacterRange(1000, 0)); // -"-
+                       log(textInputController.firstRectForCharacterRange(7, 1)); // -"-
+                       log(textInputController.firstRectForCharacterRange(7, 4294967295)); // -"-
+
+               } catch (ex) {
+                       log("Exception: " + ex.description);
+               }
+               
+               var console = document.createElement("p");
+               console.appendChild(console_messages);
+               document.body.appendChild(console);
+               
+       } else {
+               document.write("(cannot run interactively)");
+       }
+</script>
+</body>
+</html>