LayoutTests:
[WebKit-https.git] / LayoutTests / editing / input / attributed-substring-from-range-lines.html-disabled
1 <html>
2 <head>
3 <style>
4 .editing { 
5     margin: 10; padding: 0; 
6 }
7 </style>
8 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
9
10 <script>
11
12 function editingTest() {
13     typeCharacterCommand('1');
14     typeCharacterCommand('2');
15     boldCommand();
16     typeCharacterCommand('3');
17     italicCommand();
18     typeCharacterCommand('4');
19     typeCharacterCommand('5');
20     typeCharacterCommand('6');
21     italicCommand();
22     boldCommand();
23     insertParagraphCommand();
24     typeCharacterCommand('l');
25     typeCharacterCommand('i');
26     typeCharacterCommand('n');
27     typeCharacterCommand('e');
28     typeCharacterCommand(' ');
29     typeCharacterCommand('t');
30     typeCharacterCommand('w');
31     typeCharacterCommand('o');
32     insertLineBreakCommand();
33     insertLineBreakCommand();
34     typeCharacterCommand('a');
35     typeCharacterCommand('n');
36     typeCharacterCommand('d');
37     typeCharacterCommand(' ');
38     fontSizeCommand("36pt");
39     underlineCommand();
40     typeCharacterCommand('t');
41     typeCharacterCommand('h');
42     typeCharacterCommand('r');
43     typeCharacterCommand('e');
44     typeCharacterCommand('e');
45     typeCharacterCommand(' ');
46     typeCharacterCommand(' ');
47     typeCharacterCommand(' ');
48     underlineCommand();
49     insertLineBreakCommand();
50 }
51
52 </script>
53
54 <title>Attributed String Test</title> 
55 </head>
56 <body contenteditable id="root">
57 <div id="wrapper">
58 <div class="editing" id="test"></div>
59 </div>
60
61 <script>
62 runEditingTest();
63 </script>
64
65 <script type="text/javascript">
66
67     var console_messages = document.createElement("ol");
68     
69     function log(message)
70     {
71         var item = document.createElement("li");
72         item.appendChild(document.createTextNode(String(message).replace(/0x[0-9a-fA-F]{8}/g, "0xXXXXXXXX")));
73         console_messages.appendChild(item);
74     }
75     
76     if (window.layoutTestController) {
77         
78         try {
79         
80             layoutTestController.dumpAsText();
81         
82             log("Actual HTML:");
83             log("<pre>" + document.getElementById("wrapper").innerHTML + "</pre>");
84             window.getSelection().setPosition(document.body, 0);
85
86             log("(0, 0): " + textInputController.attributedSubstringFromRange(0, 0));
87             log("(0, 0) length: " + textInputController.attributedSubstringFromRange(0, 0).length());
88             log("(0, 2): " + textInputController.attributedSubstringFromRange(0, 2));
89             log("(0, 2) length: " + textInputController.attributedSubstringFromRange(0, 2).length());
90             log("(1, 2): " + textInputController.attributedSubstringFromRange(1, 2));
91             log("(1, 2) length: " + textInputController.attributedSubstringFromRange(1, 2).length());
92             log("(0, 3): " + textInputController.attributedSubstringFromRange(0, 3));
93             log("(0, 3) length: " + textInputController.attributedSubstringFromRange(0, 3).length());
94             log("(0, 6): " + textInputController.attributedSubstringFromRange(0, 6));
95             log("(0, 6) length: " + textInputController.attributedSubstringFromRange(0, 6).length());
96             log("(0, 7): " + textInputController.attributedSubstringFromRange(0, 7));
97             log("(0, 7) length: " + textInputController.attributedSubstringFromRange(0, 7).length()); // should be 7 characters!
98             log("(0, 31): " + textInputController.attributedSubstringFromRange(0, 31));
99             log("(0, 31) length: " + textInputController.attributedSubstringFromRange(0, 31).length()); // actual length IS 31
100             log("(0, 100): " + textInputController.attributedSubstringFromRange(0, 100));
101             log("(0, 100) length: " + textInputController.attributedSubstringFromRange(0, 100).length()); // should be 31 characters!
102             log("(1, 100): " + textInputController.attributedSubstringFromRange(1, 100));
103             log("(1, 100) length: " + textInputController.attributedSubstringFromRange(1, 100).length()); // should be 30 characters!
104             log("(2, 3): " + textInputController.attributedSubstringFromRange(2, 3));
105             log("(2, 3) length: " + textInputController.attributedSubstringFromRange(2, 3).length());
106             log("(5, 1): " + textInputController.attributedSubstringFromRange(5, 1));
107             log("(5, 1) length: " + textInputController.attributedSubstringFromRange(5, 1).length());
108             log("(5, 2): " + textInputController.attributedSubstringFromRange(5, 2));
109             log("(5, 2) length: " + textInputController.attributedSubstringFromRange(5, 2).length());
110             log("(5, 5): " + textInputController.attributedSubstringFromRange(5, 5));
111             log("(5, 5) length: " + textInputController.attributedSubstringFromRange(5, 5).length());
112             log("(15, 14): " + textInputController.attributedSubstringFromRange(15, 14));
113             log("(15, 14) length: " + textInputController.attributedSubstringFromRange(15, 14).length()); // should be 14 characters!
114             log("(100, 0): " + textInputController.attributedSubstringFromRange(100, 0)); // should be undefined
115             log("(100, 100): " + textInputController.attributedSubstringFromRange(100, 100)); // should be undefined
116             
117         } catch (ex) {
118             log("Exception: " + ex.description);
119         }
120         
121         var console = document.createElement("p");
122         console.appendChild(console_messages);
123         document.body.appendChild(console);
124         
125     } else {
126         document.write("(cannot run interactively)");
127     }
128 </script>
129 </body>
130 </html>