OLD | NEW |
1 description('Testing the parsing of the -webkit-shape-outside property.'); | 1 description('Testing the parsing of the -webkit-shape-outside property.'); |
2 | 2 |
3 if (window.internals) | 3 if (window.internals) |
4 window.internals.settings.setCSSExclusionsEnabled(true); | 4 window.internals.settings.setCSSExclusionsEnabled(true); |
5 | 5 |
6 function testCSSText(declaration, expected) | 6 function testCSSText(declaration, expected) |
7 { | 7 { |
8 var element = document.createElement("div"); | 8 var element = document.createElement("div"); |
9 element.style.cssText = "-webkit-shape-outside: " + declaration; | 9 element.style.cssText = "-webkit-shape-outside: " + declaration; |
10 return element.style.webkitShapeOutside; | 10 return element.style.webkitShapeOutside; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 return "parent: " + parentActual + ", child: " + childActual; | 43 return "parent: " + parentActual + ", child: " + childActual; |
44 } | 44 } |
45 | 45 |
46 function test(value, expected) { | 46 function test(value, expected) { |
47 var unevaledString = '"' + value.replace(/\\/g, "\\\\").replace(/"/g, "\"").
replace(/\n/g, "\\n").replace(/\r/g, "\\r") + '"'; | 47 var unevaledString = '"' + value.replace(/\\/g, "\\\\").replace(/"/g, "\"").
replace(/\n/g, "\\n").replace(/\r/g, "\\r") + '"'; |
48 shouldBeEqualToString('testCSSText(' + unevaledString + ')', expected); | 48 shouldBeEqualToString('testCSSText(' + unevaledString + ')', expected); |
49 shouldBeEqualToString('testComputedStyle(' + unevaledString + ')', expected)
; | 49 shouldBeEqualToString('testComputedStyle(' + unevaledString + ')', expected)
; |
50 } | 50 } |
51 | 51 |
| 52 // Need to remove the base URL to avoid having local paths in the expected resul
ts. |
| 53 function removeBaseURL(src) { |
| 54 var urlRegexp = /url\(([^\)]*)\)/g; |
| 55 return src.replace(urlRegexp, function(match, url) { |
| 56 return "url(" + url.substr(url.lastIndexOf("/") + 1) + ")"; |
| 57 }); |
| 58 } |
| 59 |
| 60 function testLocalURL(value, expected) { |
| 61 var unevaledString = '"' + value.replace(/\\/g, "\\\\").replace(/"/g, "\"").
replace(/\n/g, "\\n").replace(/\r/g, "\\r") + '"'; |
| 62 shouldBeEqualToString('removeBaseURL(testCSSText(' + unevaledString + '))',
expected); |
| 63 shouldBeEqualToString('removeBaseURL(testComputedStyle(' + unevaledString +
'))', expected); |
| 64 } |
| 65 |
52 function negative_test(value) { | 66 function negative_test(value) { |
53 var unevaledString = '"' + value.replace(/\\/g, "\\\\").replace(/"/g, "\"").
replace(/\n/g, "\\n").replace(/\r/g, "\\r") + '"'; | 67 var unevaledString = '"' + value.replace(/\\/g, "\\\\").replace(/"/g, "\"").
replace(/\n/g, "\\n").replace(/\r/g, "\\r") + '"'; |
54 shouldBeEqualToString('testCSSText(' + unevaledString + ')', ''); | 68 shouldBeEqualToString('testCSSText(' + unevaledString + ')', ''); |
55 shouldBeEqualToString('testComputedStyle(' + unevaledString + ')', 'auto'); | 69 shouldBeEqualToString('testComputedStyle(' + unevaledString + ')', 'auto'); |
56 } | 70 } |
57 | 71 |
58 // positive tests | 72 // positive tests |
59 | 73 |
60 test("auto", "auto"); | 74 test("auto", "auto"); |
61 test("rectangle(10px, 20px, 30px, 40px)", "rectangle(10px, 20px, 30px, 40px)"); | 75 test("rectangle(10px, 20px, 30px, 40px)", "rectangle(10px, 20px, 30px, 40px)"); |
62 test("rectangle(10px, 20px, 30px, 40px, 5px)", "rectangle(10px, 20px, 30px, 40px
, 5px)"); | 76 test("rectangle(10px, 20px, 30px, 40px, 5px)", "rectangle(10px, 20px, 30px, 40px
, 5px)"); |
63 test("rectangle(10px, 20px, 30px, 40px, 5px, 10px)", "rectangle(10px, 20px, 30px
, 40px, 5px, 10px)"); | 77 test("rectangle(10px, 20px, 30px, 40px, 5px, 10px)", "rectangle(10px, 20px, 30px
, 40px, 5px, 10px)"); |
64 | 78 |
65 test("circle(10px, 20px, 30px)", "circle(10px, 20px, 30px)"); | 79 test("circle(10px, 20px, 30px)", "circle(10px, 20px, 30px)"); |
66 | 80 |
67 test("ellipse(10px, 20px, 30px, 40px)", "ellipse(10px, 20px, 30px, 40px)"); | 81 test("ellipse(10px, 20px, 30px, 40px)", "ellipse(10px, 20px, 30px, 40px)"); |
68 | 82 |
69 test("polygon(10px 20px, 30px 40px, 40px 50px)", "polygon(nonzero, 10px 20px, 30
px 40px, 40px 50px)"); | 83 test("polygon(10px 20px, 30px 40px, 40px 50px)", "polygon(nonzero, 10px 20px, 30
px 40px, 40px 50px)"); |
70 test("polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)", "polygon(evenodd, 10px
20px, 30px 40px, 40px 50px)"); | 84 test("polygon(evenodd, 10px 20px, 30px 40px, 40px 50px)", "polygon(evenodd, 10px
20px, 30px 40px, 40px 50px)"); |
71 test("polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)", "polygon(nonzero, 10px
20px, 30px 40px, 40px 50px)"); | 85 test("polygon(nonzero, 10px 20px, 30px 40px, 40px 50px)", "polygon(nonzero, 10px
20px, 30px 40px, 40px 50px)"); |
72 | 86 |
| 87 testLocalURL("url(\'image\')", "url(image)"); |
| 88 |
73 shouldBeEqualToString('testNotInherited("auto", "rectangle(10px, 20px, 30px, 40p
x)")', "parent: auto, child: rectangle(10px, 20px, 30px, 40px)"); | 89 shouldBeEqualToString('testNotInherited("auto", "rectangle(10px, 20px, 30px, 40p
x)")', "parent: auto, child: rectangle(10px, 20px, 30px, 40px)"); |
74 shouldBeEqualToString('testNotInherited("rectangle(10px, 20px, 30px, 40px)", "in
itial")', "parent: rectangle(10px, 20px, 30px, 40px), child: auto"); | 90 shouldBeEqualToString('testNotInherited("rectangle(10px, 20px, 30px, 40px)", "in
itial")', "parent: rectangle(10px, 20px, 30px, 40px), child: auto"); |
75 shouldBeEqualToString('testNotInherited("rectangle(10px, 20px, 30px, 40px)", "")
', "parent: rectangle(10px, 20px, 30px, 40px), child: auto"); | 91 shouldBeEqualToString('testNotInherited("rectangle(10px, 20px, 30px, 40px)", "")
', "parent: rectangle(10px, 20px, 30px, 40px), child: auto"); |
76 shouldBeEqualToString('testNotInherited("rectangle(10px, 20px, 30px, 40px)", "in
herit")', "parent: rectangle(10px, 20px, 30px, 40px), child: rectangle(10px, 20p
x, 30px, 40px)"); | 92 shouldBeEqualToString('testNotInherited("rectangle(10px, 20px, 30px, 40px)", "in
herit")', "parent: rectangle(10px, 20px, 30px, 40px), child: rectangle(10px, 20p
x, 30px, 40px)"); |
77 shouldBeEqualToString('testNotInherited("", "inherit")', "parent: auto, child: a
uto"); | 93 shouldBeEqualToString('testNotInherited("", "inherit")', "parent: auto, child: a
uto"); |
78 shouldBeEqualToString('testNotInherited("auto", "inherit")', "parent: auto, chil
d: auto"); | 94 shouldBeEqualToString('testNotInherited("auto", "inherit")', "parent: auto, chil
d: auto"); |
79 | 95 |
80 // negative tests | 96 // negative tests |
81 | 97 |
82 negative_test("calc()"); | 98 negative_test("calc()"); |
(...skipping 21 matching lines...) Expand all Loading... |
104 | 120 |
105 negative_test("polygon()"); | 121 negative_test("polygon()"); |
106 negative_test("polygon(evenodd 10px 20px, 30px 40px, 40px 50px)"); | 122 negative_test("polygon(evenodd 10px 20px, 30px 40px, 40px 50px)"); |
107 negative_test("polygon(nonzero 10px 20px, 30px 40px, 40px 50px)"); | 123 negative_test("polygon(nonzero 10px 20px, 30px 40px, 40px 50px)"); |
108 negative_test("polygon(nonzero)"); | 124 negative_test("polygon(nonzero)"); |
109 negative_test("polygon(evenodd)"); | 125 negative_test("polygon(evenodd)"); |
110 negative_test("polygon(10px)"); | 126 negative_test("polygon(10px)"); |
111 negative_test("polygon(nonzero,10px)"); | 127 negative_test("polygon(nonzero,10px)"); |
112 negative_test("polygon(evenodd,12px)"); | 128 negative_test("polygon(evenodd,12px)"); |
113 negative_test("polygon(10px, 20px, 30px, 40px, 40px, 50px)"); | 129 negative_test("polygon(10px, 20px, 30px, 40px, 40px, 50px)"); |
OLD | NEW |