tizen beta release
[framework/web/webkit-efl.git] / LayoutTests / fast / css / invalid-hex-color.html
1 <!doctype html>
2 <html>
3 <head>
4 <title>Test for Bug 24742 - CSS tokenizer allows color in 6 hex digit notation to be followed by the next token without separation</title>
5 <style>
6 div {
7     margin-bottom:11px;
8 }
9 </style>
10 <script>
11 if (window.layoutTestController)
12     layoutTestController.dumpAsText();
13
14 function test()
15 {
16     var test_defs = [
17         /* description, expected style, test style */
18         ["Invalid: 0 hexadecimal digits", "", "border-bottom: solid #"],
19         ["Invalid: 1 hexadecimal digits", "", "border-bottom: solid #1"],
20         ["Invalid: 2 hexadecimal digits", "", "border-bottom: solid #11"],
21         ["Valid: 3 hexadecimal digits", "border-bottom: solid rgb(17,17,17)", "border-bottom: solid #111"],
22         ["Invalid: 4 hexadecimal digits", "", "border-bottom: solid #1111"],
23         ["Invalid: 5 hexadecimal digits", "", "border-bottom: solid #11111"],
24         ["Valid: 6 hexadecimal digits", "border-bottom: solid rgb(17,17,17)", "border-bottom: solid #111111"],
25         ["Invalid: 7 hexadecimal digits", "", "border-bottom: solid #1111111"],
26         ["Invalid: 0 hexadecimal digits concatenated with 'px'", "", "border-bottom: solid #px"],
27         ["Invalid: 1 hexadecimal digits concatenated with 'px'", "", "border-bottom: solid #1px"],
28         ["Invalid: 2 hexadecimal digits concatenated with 'px'", "", "border-bottom: solid #11px"],
29         ["Invalid: 3 hexadecimal digits concatenated with 'px'", "", "border-bottom: solid #111px"],
30         ["Invalid: 4 hexadecimal digits concatenated with 'px'", "", "border-bottom: solid #1111px"],
31         ["Invalid: 5 hexadecimal digits concatenated with 'px'", "", "border-bottom: solid #11111px"],
32         ["Invalid: 6 hexadecimal digits concatenated with 'px'", "", "border-bottom: solid #111111px"],
33         ["Invalid: 7 hexadecimal digits concatenated with 'px'", "", "border-bottom: solid #1111111px"],
34     ];
35
36     var testHtml = "";
37     for (var i = 0; i < test_defs.length; i++) {
38         var test_def = test_defs[i];
39         testHtml += "<div>Test " + i + " (" + test_def[0] + ")" +
40                     "<span id='expected_" + i + "' style='" + test_def[1] + "'> [EXPECTED] </span>" +
41                     "<span id='actual_" + i + "' style='" + test_def[2] + "'> [ACTUAL] </span>" +
42                     "<span id='result_" + i + "'></span></div>";
43     }
44     document.getElementById('tests').innerHTML = testHtml;
45
46     for (var i = 0; i < test_defs.length; i++) {
47         var expected = document.getElementById("expected_" + i).style.borderBottomColor;
48         var actual = document.getElementById("actual_" + i).style.borderBottomColor;
49         var message;
50         var color;
51         if (actual == expected) {
52             message = "PASS";
53             color = "green";
54         } else {
55             message = "FAIL: expected:'" + expected + "' actual:'" + actual + "'";
56             color = "red";
57         }
58         var result = document.getElementById("result_" + i);
59         result.innerHTML = message;
60         result.style.color = color;
61     }
62 }
63 </script>
64 </head>
65 <body onload="test()">
66 <div id='tests'>Test didn't run</div>
67 </html>
68