OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <style> | 3 <style> |
4 * { font-size: 16px; } | 4 * { font-size: 16px; } |
5 div { font-size: 8px; } | 5 div { font-size: 8px; } |
6 </style> | 6 </style> |
7 <body> | 7 <body> |
8 <script src="../../resources/js-test.js"></script> | 8 <script src="../../resources/js-test.js"></script> |
9 <script> | 9 <script> |
10 description('Test that clip-path shapes accept different length units'); | 10 description('Test that clip-path shapes accept different length units'); |
(...skipping 23 matching lines...) Expand all Loading... |
34 else | 34 else |
35 shouldBeEqualToString('innerStyle("' + property + '", "' + value + '")',
expected); | 35 shouldBeEqualToString('innerStyle("' + property + '", "' + value + '")',
expected); |
36 } | 36 } |
37 | 37 |
38 function negativeTest(property, value) { | 38 function negativeTest(property, value) { |
39 testInner(property, value, null); | 39 testInner(property, value, null); |
40 testComputed(property, value, 'none'); | 40 testComputed(property, value, 'none'); |
41 } | 41 } |
42 | 42 |
43 // absolute lengths - number serialization, units | 43 // absolute lengths - number serialization, units |
44 testInner("-webkit-clip-path", "circle(0, 0, 0)", "circle(0px, 0px, 0px)"); | |
45 testInner("-webkit-clip-path", "circle(-1px, +1px, 1px)", "circle(-1px, 1px, 1px
)"); | |
46 testInner("-webkit-clip-path", "circle(-1.5px, +1.5px, 1.5px)", "circle(-1.5px,
1.5px, 1.5px)"); | |
47 testInner("-webkit-clip-path", "circle(-.5px, +.5px, .5px)", "circle(-0.5px, 0.5
px, 0.5px)"); | |
48 | |
49 testInner("-webkit-clip-path", "circle(0 at 0 0)", "circle(0px at 0% 0%)"); | 44 testInner("-webkit-clip-path", "circle(0 at 0 0)", "circle(0px at 0% 0%)"); |
50 testInner("-webkit-clip-path", "circle(1px at -1px +1px)", "circle(1px at -1px 1
px)"); | 45 testInner("-webkit-clip-path", "circle(1px at -1px +1px)", "circle(1px at -1px 1
px)"); |
51 testInner("-webkit-clip-path", "circle(1.5px at -1.5px +1.5px)", "circle(1.5px a
t -1.5px 1.5px)"); | 46 testInner("-webkit-clip-path", "circle(1.5px at -1.5px +1.5px)", "circle(1.5px a
t -1.5px 1.5px)"); |
52 testInner("-webkit-clip-path", "circle(.5px at -.5px +.5px)", "circle(0.5px at -
0.5px 0.5px)"); | 47 testInner("-webkit-clip-path", "circle(.5px at -.5px +.5px)", "circle(0.5px at -
0.5px 0.5px)"); |
53 | 48 |
54 testInner("-webkit-clip-path", "rectangle(1cm, 1mm, 1in, 1px, 1pt, 1pc)", "recta
ngle(1cm, 1mm, 1in, 1px, 1pt, 1pc)"); | |
55 | |
56 // font-relative lengths - number serialization, units, resolution | 49 // font-relative lengths - number serialization, units, resolution |
57 testInner("-webkit-clip-path", "circle(-1em, +1em, 1em)", "circle(-1em, 1em, 1em
)"); | |
58 testInner("-webkit-clip-path", "circle(-1.5em, +1.5em, 1.5em)", "circle(-1.5em,
1.5em, 1.5em)"); | |
59 testInner("-webkit-clip-path", "circle(-.5em, +.5em, .5em)", "circle(-0.5em, 0.5
em, 0.5em)"); | |
60 | |
61 testInner("-webkit-clip-path", "circle(1ex, 1ex, 1ex)", "circle(1ex, 1ex, 1ex)")
; | |
62 // FIXME: Add ch test when it is supported | |
63 testInner("-webkit-clip-path", "circle(1rem, 1rem, 1rem)", "circle(1rem, 1rem, 1
rem)"); | |
64 | |
65 testComputed("-webkit-clip-path", "circle(.5em, 1em, 1.5em)", "circle(4px, 8px,
12px)"); | |
66 testComputed("-webkit-clip-path", "circle(.5rem, 1rem, 1.5rem)", "circle(8px, 16
px, 24px)"); | |
67 | |
68 testInner("-webkit-clip-path", "circle(1em at -1em +1em)", "circle(1em at -1em 1
em)"); | 50 testInner("-webkit-clip-path", "circle(1em at -1em +1em)", "circle(1em at -1em 1
em)"); |
69 testInner("-webkit-clip-path", "circle(1.5em at -1.5em +1.5em)", "circle(1.5em a
t -1.5em 1.5em)"); | 51 testInner("-webkit-clip-path", "circle(1.5em at -1.5em +1.5em)", "circle(1.5em a
t -1.5em 1.5em)"); |
70 testInner("-webkit-clip-path", "circle(.5em at -.5em +.5em)", "circle(0.5em at -
0.5em 0.5em)"); | 52 testInner("-webkit-clip-path", "circle(.5em at -.5em +.5em)", "circle(0.5em at -
0.5em 0.5em)"); |
71 | 53 |
72 testInner("-webkit-clip-path", "circle(1ex at 1ex 1ex)", "circle(1ex at 1ex 1ex)
"); | 54 testInner("-webkit-clip-path", "circle(1ex at 1ex 1ex)", "circle(1ex at 1ex 1ex)
"); |
73 // FIXME: Add ch test when it is supported | 55 // FIXME: Add ch test when it is supported |
74 testInner("-webkit-clip-path", "circle(1rem at 1rem 1rem)", "circle(1rem at 1rem
1rem)"); | 56 testInner("-webkit-clip-path", "circle(1rem at 1rem 1rem)", "circle(1rem at 1rem
1rem)"); |
75 | 57 |
76 testComputed("-webkit-clip-path", "circle(1.5em at .5em 1em)", "circle(12px at 4
px 8px)"); | 58 testComputed("-webkit-clip-path", "circle(1.5em at .5em 1em)", "circle(12px at 4
px 8px)"); |
77 testComputed("-webkit-clip-path", "circle(1.5rem at .5rem 1rem)", "circle(24px a
t 8px 16px)"); | 59 testComputed("-webkit-clip-path", "circle(1.5rem at .5rem 1rem)", "circle(24px a
t 8px 16px)"); |
78 | 60 |
79 // viewport-percentage lengths - units, resolution | 61 // viewport-percentage lengths - units, resolution |
80 testInner("-webkit-clip-path", "circle(1vw, 1vw, 1vw)", "circle(1vw, 1vw, 1vw)")
; | |
81 testInner("-webkit-clip-path", "circle(1vh, 1vh, 1vh)", "circle(1vh, 1vh, 1vh)")
; | |
82 testInner("-webkit-clip-path", "circle(1vmin, 1vmin, 1vmin)", "circle(1vmin, 1vm
in, 1vmin)"); | |
83 | |
84 testComputed("-webkit-clip-path", "circle(.5vw, 1vw, 1.5vw)", "circle(4px, 8px,
12px)"); | |
85 testComputed("-webkit-clip-path", "circle(.5vh, 1vh, 1.5vh)", "circle(3px, 6px,
9px)"); | |
86 testComputed("-webkit-clip-path", "circle(.5vmin, 1vmin, 1.5vmin)", "circle(3px,
6px, 9px)"); | |
87 | |
88 testInner("-webkit-clip-path", "circle(1vw at 1vw 1vw)", "circle(1vw at 1vw 1vw)
"); | 62 testInner("-webkit-clip-path", "circle(1vw at 1vw 1vw)", "circle(1vw at 1vw 1vw)
"); |
89 testInner("-webkit-clip-path", "circle(1vh at 1vh 1vh)", "circle(1vh at 1vh 1vh)
"); | 63 testInner("-webkit-clip-path", "circle(1vh at 1vh 1vh)", "circle(1vh at 1vh 1vh)
"); |
90 testInner("-webkit-clip-path", "circle(1vmin at 1vmin 1vmin)", "circle(1vmin at
1vmin 1vmin)"); | 64 testInner("-webkit-clip-path", "circle(1vmin at 1vmin 1vmin)", "circle(1vmin at
1vmin 1vmin)"); |
91 | 65 |
92 testComputed("-webkit-clip-path", "circle(1.5vw at .5vw 1vw)", "circle(12px at 4
px 8px)"); | 66 testComputed("-webkit-clip-path", "circle(1.5vw at .5vw 1vw)", "circle(12px at 4
px 8px)"); |
93 testComputed("-webkit-clip-path", "circle(1.5vh at .5vh 1vh)", "circle(9px at 3p
x 6px)"); | 67 testComputed("-webkit-clip-path", "circle(1.5vh at .5vh 1vh)", "circle(9px at 3p
x 6px)"); |
94 testComputed("-webkit-clip-path", "circle(1.5vmin at .5vmin 1vmin)", "circle(9px
at 3px 6px)"); | 68 testComputed("-webkit-clip-path", "circle(1.5vmin at .5vmin 1vmin)", "circle(9px
at 3px 6px)"); |
95 | 69 |
96 // percentage lengths - units | 70 // percentage lengths - units |
97 testInner("-webkit-clip-path", "circle(100%, 100%, 100%)", "circle(100%, 100%, 1
00%)"); | |
98 testInner("-webkit-clip-path", "circle(100% at 100% 100%)", "circle(100% at 100%
100%)"); | |
99 testInner("-webkit-clip-path", "rectangle(45%, 45%, 90%, 60%, 25%, 10%)", "recta
ngle(45%, 45%, 90%, 60%, 25%, 10%)"); | |
100 testInner("-webkit-clip-path", "ellipse(100%, 100%, 100%, 100%)", "ellipse(100%,
100%, 100%, 100%)"); | |
101 testInner("-webkit-clip-path", "polygon(10% 20%, 30% 40%, 40% 50%)", "polygon(10
% 20%, 30% 40%, 40% 50%)"); | |
102 | |
103 testComputed("-webkit-clip-path", "circle(50%, 100%, 150%)", "circle(50%, 100%,
150%)"); | |
104 testComputed("-webkit-clip-path", "circle(150% at 50% 100%)", "circle(150% at 50
% 100%)"); | 71 testComputed("-webkit-clip-path", "circle(150% at 50% 100%)", "circle(150% at 50
% 100%)"); |
105 testComputed("-webkit-clip-path", "rectangle(45%, 45%, 90%, 60%, 25%, 10%)", "re
ctangle(45%, 45%, 90%, 60%, 25%, 10%)"); | 72 testComputed("-webkit-clip-path", "inset(45% 45% 90% 60% round 25% 10%)", "inset
(45% 45% 90% 60% round 25% 10% 25% 10% / 25% 10% 25% 10%)"); |
106 testComputed("-webkit-clip-path", "ellipse(100%, 100%, 100%, 100%)", "ellipse(10
0%, 100%, 100%, 100%)"); | 73 testComputed("-webkit-clip-path", "ellipse(100% 100% at 100% 100%)", "ellipse(10
0% 100% at 100% 100%)"); |
107 testComputed("-webkit-clip-path", "polygon(10% 20%, 30% 40%, 40% 50%)", "polygon
(10% 20%, 30% 40%, 40% 50%)"); | 74 testComputed("-webkit-clip-path", "polygon(10% 20%, 30% 40%, 40% 50%)", "polygon
(10% 20%, 30% 40%, 40% 50%)"); |
108 | 75 |
109 // reject non-lengths | 76 // reject non-lengths |
110 negativeTest("-webkit-clip-path", "circle(1px, 1px, 1)"); | |
111 negativeTest("-webkit-clip-path", "circle(1px, 1px, px)"); | |
112 negativeTest("-webkit-clip-path", "circle(1px, 1px, 1p)"); | |
113 negativeTest("-webkit-clip-path", "circle(1px, 1px, calc())"); | |
114 | |
115 negativeTest("-webkit-clip-path", "circle(1 at 1px 1px)"); | 77 negativeTest("-webkit-clip-path", "circle(1 at 1px 1px)"); |
116 negativeTest("-webkit-clip-path", "circle(px at 1px 1px)"); | 78 negativeTest("-webkit-clip-path", "circle(px at 1px 1px)"); |
117 negativeTest("-webkit-clip-path", "circle(1p at 1px 1px)"); | 79 negativeTest("-webkit-clip-path", "circle(1p at 1px 1px)"); |
118 negativeTest("-webkit-clip-path", "circle(calc() at 1px 1px)"); | 80 negativeTest("-webkit-clip-path", "circle(calc() at 1px 1px)"); |
119 | 81 |
120 // reject negative radiuses | 82 // reject negative radiuses |
121 negativeTest("-webkit-clip-path", "circle(-1.5px, +1.5px, -1.5px)"); | |
122 negativeTest("-webkit-clip-path", "circle(-1.5px at -1.5px +1.5px)"); | 83 negativeTest("-webkit-clip-path", "circle(-1.5px at -1.5px +1.5px)"); |
123 negativeTest("-webkit-clip-path", "rectangle(1cm, 1mm, 1in, 1px, -1pt, 1pc)"); | 84 negativeTest("-webkit-clip-path", "inset(1cm 1mm 1in 1px round -1pt, 1pc)"); |
124 negativeTest("-webkit-clip-path", "rectangle(1cm, 1mm, 1in, 1px, 1pt, -1pc)"); | 85 negativeTest("-webkit-clip-path", "inset(1cm 1mm 1in 1px round 1pt -1pc)"); |
125 negativeTest("-webkit-clip-path", "ellipse(1em, 1em, -1em, 1em)"); | 86 negativeTest("-webkit-clip-path", "ellipse(-1em 1em at 1em 1em)"); |
126 negativeTest("-webkit-clip-path", "ellipse(1em, 1em, 1em, -1em)"); | 87 negativeTest("-webkit-clip-path", "ellipse(1em -1em at 1em 1em)"); |
127 | |
128 // reject negative height and width | |
129 negativeTest("-webkit-clip-path", "rectangle(1cm, 1mm, -1in, 1px, 1pt, 1pc)"); | |
130 negativeTest("-webkit-clip-path", "rectangle(1cm, 1mm, 1in, -1px, 1pt, 1pc)"); | |
131 | 88 |
132 // general negative tests | 89 // general negative tests |
133 negativeTest("-webkit-clip-path", "circle(0, 0)"); | |
134 negativeTest("-webkit-clip-path", "polygon(0, 0)"); | 90 negativeTest("-webkit-clip-path", "polygon(0, 0)"); |
135 negativeTest("-webkit-clip-path", "polygon(0 0, 0)"); | 91 negativeTest("-webkit-clip-path", "polygon(0 0, 0)"); |
136 negativeTest("-webkit-clip-path", "polygon(0)"); | 92 negativeTest("-webkit-clip-path", "polygon(0)"); |
137 negativeTest("-webkit-clip-path", "polygon()"); | 93 negativeTest("-webkit-clip-path", "polygon()"); |
138 negativeTest("-webkit-clip-path", "polygon(evenodd)"); | 94 negativeTest("-webkit-clip-path", "polygon(evenodd)"); |
139 negativeTest("-webkit-clip-path", "polygon(nonzero)"); | 95 negativeTest("-webkit-clip-path", "polygon(nonzero)"); |
140 | 96 |
141 </script> | 97 </script> |
142 </body> | 98 </body> |
143 </html> | 99 </html> |
OLD | NEW |