<http://bugzilla.opendarwin.org/show_bug.cgi?id=6211>
[WebKit-https.git] / LayoutTests / editing / input / text-input-controller.html
1 <html>
2 <head>
3 <style>
4 body { margin: 0; padding: 0 }
5 </style>
6 </head>
7 <body>
8 <div contenteditable>FAILURE</div>
9 <script type="text/javascript">
10
11     if (window.layoutTestController) {
12         
13         try {
14         
15             layoutTestController.dumpAsText();
16             document.execCommand("SelectAll");
17         
18             textInputController.insertText("to be deleted");
19             textInputController.doCommand("selectAll:");
20             textInputController.doCommand("delete:");
21     
22             textInputController.setMarkedText("Failure", 0, 7);
23             if (textInputController.hasMarkedText() && textInputController.markedRange().toString() == "0,7")
24                 textInputController.setMarkedText("Success", 0, 7);
25             
26             var textAttributes = textInputController.validAttributesForMarkedText();
27             textInputController.unmarkText();
28     
29             textInputController.doCommand("selectAll:");
30             if (textInputController.hasMarkedText() || textInputController.selectedRange().toString() != "0,7") {
31                 textInputController.doCommand("delete:");
32                 textInputController.insertText("Failure");
33             }
34     
35             var charRect = textInputController.firstRectForCharacterRange(0, 1);
36             textInputController.characterIndexForPoint(0, 0); // currently unimplemented
37             textInputController.substringFromRange(1, 1); // currently unimplemented
38             textInputController.conversationIdentifier(); // just an identifier...
39             
40             textAttributes = textAttributes.toString();
41             if (-1 == textAttributes.indexOf("NSUnderline"))
42                 textInputController.insertText("Attribute NSUnderline is missing");
43
44             if (-1 == textAttributes.indexOf("NSUnderlineColor"))
45                 textInputController.insertText("Attribute NSUnderlineColor is missing");
46
47             if (-1 == textAttributes.indexOf("NSMarkedClauseSegment"))
48                 textInputController.insertText("Attribute NSMarkedClauseSegment is missing");
49
50             if (-1 == textAttributes.indexOf("NSTextInputReplacementRangeAttributeName"))
51                 textInputController.insertText("Attribute NSTextInputReplacementRangeAttributeName is missing");
52
53         } catch (ex) {
54             document.write("Exception: " + ex.description);
55         }
56     } else {
57         document.write("(cannot run interactively)");
58     }
59 </script>
60 </body>
61 </html>