Skip media source tests since the feature is not enabled on Windows.
[WebKit-https.git] / LayoutTests / fast / forms / attributed-strings.html
1 <html>
2 <head>
3 <style>
4 body { margin: 0; padding: 0 }
5 </style>
6 </head>
7 <body>
8 <div id="test" contenteditable>FAILURE</div>
9 <p id="console"></p>
10 <script type="text/javascript">
11     
12     var console_messages = document.createElement("ol");
13     
14     function log(message)
15     {
16         var item = document.createElement("li");
17         item.appendChild(document.createTextNode(message));
18         console_messages.appendChild(item);
19     }
20     
21     if (window.testRunner) {
22         
23         try {
24
25             testRunner.dumpAsText();
26                         document.getElementById("test").focus();
27
28             var substr = textInputController.attributedSubstringFromRange(0, 2);
29 //            log(substr); -- attributedSubstringFromRange is not implemented in WebKit yet
30     
31             var attrString = textInputController.makeAttributedString("test");
32             log(attrString.getAttributeNamesAtIndex(0));
33             log(attrString.length());
34             log(attrString.string());
35
36             attrString.addAttribute("NSToolTip", "Tool Tip");
37             attrString.addFontAttribute("NSFont", "Monaco", 14);
38             attrString.addColorAttribute("NSForegroundColor", 1, 1, 1, 0.5);
39
40             attrString.addFontAttributeForRange("NSFont", "Monaco", 12, 0, 2);
41             attrString.addColorAttributeForRange("NSForegroundColor", 1, 0.5, 1, 0.5, 0, 2);
42             attrString.addAttributeForRange("NSObliqueness", 0.5, 0, 2);
43
44             log(attrString.length());
45             log(attrString.string());
46             
47             log(attrString.getAttributeNamesAtIndex(0));
48             log(attrString.getAttributeNamesAtIndex(3));
49
50             log(attrString.getAttributeValueAtIndex("NSObliqueness", 0));
51             log(attrString.getAttributeValueAtIndex("NSObliqueness", 3));
52
53             log(attrString.getAttributeValueAtIndex("NSForegroundColor", 1));
54             
55             document.execCommand("SelectAll");
56             
57             textInputController.insertText(attrString);
58             
59         } catch (ex) {
60             document.write("Exception: " + ex.description);
61         }
62         
63         document.getElementById("console").appendChild(console_messages);
64         
65     } else {
66         document.write("(cannot run interactively)");
67     }
68 </script>
69 </body>
70 </html>