Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 <!--
2 Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/
4 -->
5 <svg xmlns="http://www.w3.org/2000/svg">
7 <title>Test 'stroke-linecap: square' with zero length path segments</title>
9 <!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=589648 -->
11 <style>
13 path {
14 stroke-width: 20px;
15 stroke-linecap: square;
16 }
18 rect {
19 fill: red;
20 }
22 /* expect lime squares to cover red rects */
23 path.squares-expected {
24 stroke: lime;
25 }
27 path.squares-not-expected {
28 stroke: red;
29 }
31 /* thicker stroke to cover squares-not-expected paths */
32 path.coverer {
33 stroke: lime;
34 stroke-width: 24px;
35 }
37 /* to show edges of shapes to help in debugging:
38 g > rect {
39 stroke: red;
40 stroke-width: 5px;
41 }
42 path.coverer {
43 stroke: lime;
44 stroke-width: 18px;
45 }
46 */
48 </style>
50 <rect width="100%" height="100%" style="fill:lime"/>
52 <!-- Column 1: test single segment zero-length subpaths: -->
54 <g transform="translate(25,25)">
55 <rect x="-9" y="-9" width="18" height="18"/>
56 <rect x="41" y="41" width="18" height="18"/>
57 <rect x="91" y="91" width="18" height="18"/>
58 <path class="squares-expected" d="M0,0 L0,0 M20,20 L30,30 M50,50 L50,50 M70,70 L80,80 M100,100 L100,100"/>
59 </g>
61 <g transform="translate(25,75)">
62 <rect x="-9" y="-9" width="18" height="18"/>
63 <rect x="41" y="41" width="18" height="18"/>
64 <rect x="91" y="91" width="18" height="18"/>
65 <path class="squares-expected" d="M0,0 C0,0 0,0 0,0 M20,20 L30,30 M50,50 C50,50 50,50 50,50 M70,70 L80,80 M100,100 C100,100 100,100 100,100"/>
66 </g>
68 <g transform="translate(25,125)">
69 <path class="squares-not-expected" d="M0,0 A0,10 0 0 0 0,0 M20,20 L30,30 M50,50 A0,10 0 0 0 50,50 M70,70 L80,80 M100,100 A0,10 0 0 0 100,100"/>
70 <path class="coverer" d="M20,20 L30,30 M70,70 L80,80"/>
71 </g>
73 <g transform="translate(25,175)">
74 <rect x="-9" y="-9" width="18" height="18"/>
75 <rect x="41" y="41" width="18" height="18"/>
76 <rect x="91" y="91" width="18" height="18"/>
77 <path class="squares-expected" d="M0,0 Z M20,20 L30,30 M50,50 Z M70,70 L80,80 M100,100 Z"/>
78 </g>
81 <!-- Column 2: test multi-segment zero-length subpaths: -->
83 <g transform="translate(175,25)">
84 <rect x="-9" y="-9" width="18" height="18"/>
85 <rect x="41" y="41" width="18" height="18"/>
86 <rect x="91" y="91" width="18" height="18"/>
87 <path class="squares-expected" d="M0,0 L0,0 M0,0 L0,0 M20,20 L30,30 M50,50 L50,50 L50,50 M70,70 L80,80 M100,100 L100,100 L100,100"/>
88 </g>
90 <g transform="translate(177,75)">
91 <rect x="-9" y="-9" width="18" height="18"/>
92 <rect x="41" y="41" width="18" height="18"/>
93 <rect x="91" y="91" width="18" height="18"/>
94 <path class="squares-expected" d="M0,0 C0,0 0,0 0,0 C0,0 0,0 0,0 M20,20 L30,30 M50,50 C50,50 50,50 50,50 C50,50 50,50 50,50 M70,70 L80,80 M100,100 C100,100 100,100 100,100 C100,100 100,100 100,100"/>
95 </g>
97 <g transform="translate(175,125)">
98 <path class="squares-not-expected" d="M0,0 A0,10 0 0 0 0,0 A0,10 0 0 0 0,0 M20,20 L30,30 M50,50 A0,10 0 0 0 50,50 A0,10 0 0 0 50,50 M70,70 L80,80 M100,100 A0,10 0 0 0 100,100 A0,10 0 0 0 100,100"/>
99 <path class="coverer" d="M20,20 L30,30 M70,70 L80,80"/>
100 </g>
102 <g transform="translate(175,175)">
103 <rect x="-9" y="-9" width="18" height="18"/>
104 <rect x="41" y="41" width="18" height="18"/>
105 <rect x="91" y="91" width="18" height="18"/>
106 <path class="squares-expected" d="M0,0 Z Z M20,20 L30,30 M50,50 Z Z M70,70 L80,80 M100,100 Z Z"/>
107 </g>
110 <!-- Column 3: test non-zero-length subpaths that begin, end and contain
111 zero length segments: -->
113 <g transform="translate(325,25)">
114 <path class="squares-not-expected" d="M20,20 L20,20 L30,30 L30,30 L40,40 L40,40"/>
115 <path class="coverer" d="M20,20 L40,40"/>
116 </g>
118 <g transform="translate(325,75)">
119 <path class="squares-not-expected" d="M20,20 C20,20 20,20 20,20 C20,20 30,30 30,30 C30,30 30,30 30,30 C30,30 40,40 40,40 C40,40 40,40 40,40"/>
120 <path class="coverer" d="M20,20 L40,40"/>
121 </g>
123 <g transform="translate(325,125)">
124 <path class="squares-not-expected" d="M20,20 A0,10 0 0 0 20,20 A0,10 0 0 0 30,30 A0,10 0 0 0 30,30 A0,10 0 0 0 40,40 A0,10 0 0 0 40,40"/>
125 <path class="coverer" d="M20,20 L40,40"/>
126 </g>
128 <!-- this one is shorter because the Z's mean we only have path end points
129 at 20,20 -->
130 <g transform="translate(325,175)">
131 <rect x="11" y="11" width="18" height="18"/>
132 <path class="squares-expected" d="M20,20 Z L30,30 Z L40,40 Z"/>
133 </g>
136 <!-- Column 4: test loan movetos -->
138 <g transform="translate(425,25)">
139 <path class="squares-not-expected" d="M0,0 M0,0 M20,20 L30,30 M50,50 M50,50 M70,70 L80,80 M100,100 M100,100"/>
140 <path class="coverer" d="M20,20 L30,30 M70,70 L80,80"/>
141 </g>
143 </svg>