1 <svg version=
"1.1" baseProfile=
"basic" id=
"svg-root"
2 width=
"100%" height=
"100%" viewBox=
"0 0 480 360"
3 xmlns=
"http://www.w3.org/2000/svg" xmlns:
xlink=
"http://www.w3.org/1999/xlink">
4 <!--======================================================================-->
5 <!--= SVG 1.1 2nd Edition Test Case =-->
6 <!--======================================================================-->
7 <!--= Copyright 2009 World Wide Web Consortium, (Massachusetts =-->
8 <!--= Institute of Technology, European Research Consortium for =-->
9 <!--= Informatics and Mathematics (ERCIM), Keio University). =-->
10 <!--= All Rights Reserved. =-->
11 <!--= See http://www.w3.org/Consortium/Legal/. =-->
12 <!--======================================================================-->
13 <d:SVGTestCase xmlns:
d=
"http://www.w3.org/2000/02/svg/testsuite/description/"
14 template-version=
"1.3" reviewer=
"CM" author=
"ED" status=
"accepted"
15 version=
"$Revision: 1.11 $" testname=
"$RCSfile: masking-path-07-b.svg,v $">
16 <d:testDescription xmlns=
"http://www.w3.org/1999/xhtml" href=
"http://www.w3.org/TR/SVG11/masking.html#ClippingPaths">
18 This tests that 'clipPath' elements can be used together and how the clipping paths are intersected.
21 There is a gray-white pattern as a background for the two subtest rectangles. This is to show that the holes that are cut out using clip-paths are transparent.
22 The first subtest verifies that when you use the 'clip-path' property on a child element inside a 'clipPath' element the child element is clipped correctly.
23 The second subtest verifies that when a 'clipPath' element has a 'clip-path' property the result is the intersection of the two clip paths.
26 <d:operatorScript xmlns=
"http://www.w3.org/1999/xhtml">
28 Run the test. No interaction required.
31 <d:passCriteria xmlns=
"http://www.w3.org/1999/xhtml">
33 The test has passed if the following conditions are met:
36 <li>There is no red visible.
</li>
37 <li>No shapes extend outside of the rects that have a thick black border.
</li>
38 <li>For the left subtest:
40 <li>There must be a large blue rect with a transparent smaller rect in it, and the intersection of two circles.
</li>
41 <li>The borders of the clipregions are shown with black stroke.
</li>
42 <li>The blue shapes must be visible only inside of these stroked regions.
</li>
45 <li>For the right subtest:
47 <li>The test on the right must show part of the large blue rect shape with a transparent rect in it, and part of a circle.
</li>
48 <li>The blue shapes must only be visible inside of the circle that has black stroke.
</li>
54 <title id=
"test-title">$RCSfile: masking-path-
07-b.svg,v $
</title>
56 <font-face font-family=
"SVGFreeSansASCII" unicode-range=
"U+0-7F">
58 <font-face-uri xlink:
href=
"../resources/SVGFreeSans.svg#ascii"/>
62 <g id=
"test-body-content" font-family=
"SVGFreeSansASCII,sans-serif" font-size=
"18">
65 <clipPath id=
"clipCircle1">
66 <circle id=
"c1" cx=
"100" cy=
"100" r=
"50"/>
69 <clipPath id=
"clipCircle2">
70 <circle id=
"c2" cx=
"150" cy=
"150" r=
"50"/>
73 <clipPath id=
"clipPath1">
74 <path id=
"p1" d=
"M10 10l100 0 0 100 -100 0ZM50 50l40 0 0 40 -40 0Z" clip-rule=
"evenodd"/>
77 <!-- "If a valid 'clip-path' reference is placed on one of the children of a 'clipPath' element,
78 then the given child element is clipped by the referenced clipping path before OR'ing the
79 silhouette of the child element with the silhouettes of the other child elements." -->
80 <clipPath id=
"clipRects1">
81 <rect x=
"50" y=
"30" width=
"25" height=
"100"/>
82 <rect x=
"25" y=
"50" width=
"10" height=
"10" clip-path=
"url(#clipTwoCircles)"/>
85 <!-- Test use in a clipPath -->
86 <clipPath id=
"clipTwoCircles">
87 <use xlink:
href=
"#c1"/>
88 <use xlink:
href=
"#c2"/>
91 <clipPath id=
"clipInClip1">
92 <use xlink:
href=
"#c2" clip-path=
"url(#clipCircle1)"/>
93 <use xlink:
href=
"#p1"/>
96 <clipPath id=
"clipOnClip1" clip-path=
"url(#clipCircle1)">
97 <use xlink:
href=
"#c2"/>
98 <use xlink:
href=
"#p1"/>
101 <pattern patternUnits=
"userSpaceOnUse" id=
"pattern" x=
"0" y=
"0" width=
"20" height=
"20">
102 <rect x=
"0" y=
"0" width=
"10" height=
"10" fill=
"gray"/>
103 <rect x=
"10" y=
"10" width=
"10" height=
"10" fill=
"gray"/>
107 <rect x=
"20" y=
"70" width=
"210" height=
"210" fill=
"url(#pattern)" stroke=
"black" stroke-width=
"4"/>
108 <rect x=
"250" y=
"70" width=
"210" height=
"210" fill=
"url(#pattern)" stroke=
"black" stroke-width=
"4"/>
110 <text x=
"240" y=
"2em" text-anchor=
"middle">Test clip unions and intersections
</text>
112 <g transform=
"translate(20, 70)">
114 <use xlink:
href=
"#p1" fill=
"red" fill-rule=
"evenodd"/>
115 <use xlink:
href=
"#c2" fill=
"red" clip-path=
"url(#clipCircle1)"/>
116 <use xlink:
href=
"#c1" fill=
"red" clip-path=
"url(#clipCircle2)"/>
118 <rect width=
"200" height=
"200" fill=
"blue" clip-path=
"url(#clipInClip1)"/>
120 <use xlink:
href=
"#c2" fill=
"none" clip-path=
"url(#clipCircle1)" stroke=
"black"/>
121 <use xlink:
href=
"#c1" fill=
"none" clip-path=
"url(#clipCircle2)" stroke=
"black"/>
122 <use xlink:
href=
"#p1" fill=
"none" stroke=
"black"/>
125 <g id=
"subtest2" transform=
"translate(230,0)">
126 <g clip-path=
"url(#clipCircle1)">
127 <use xlink:
href=
"#c2" fill=
"red"/>
128 <use xlink:
href=
"#p1" fill=
"red" fill-rule=
"evenodd"/>
131 <rect width=
"300" height=
"300" fill=
"blue" clip-path=
"url(#clipOnClip1)"/>
133 <use xlink:
href=
"#c1" fill=
"none" stroke=
"black"/>
137 <g font-family=
"SVGFreeSansASCII,sans-serif" font-size=
"32">
138 <text id=
"revision" x=
"10" y=
"340" stroke=
"none" fill=
"black">$Revision:
1.11 $
</text>
140 <rect id=
"test-frame" x=
"1" y=
"1" width=
"478" height=
"358" fill=
"none" stroke=
"#000000"/>
141 <!-- comment out this watermark once the test is approved --><!--
142 <g id="draft-watermark">
143 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
144 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
145 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>