| 1 |
<svg version="1.1" baseProfile="full" 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.4" reviewer="DOH" author="ED" status="accepted" |
| 15 |
version="$Revision: 1.6 $" testname="$RCSfile: struct-use-10-f.svg,v $"> |
| 16 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/struct.html#UseElement"> |
| 17 |
<p> |
| 18 |
Properties are inherited according to the 'use' element rules, CSS selectors only apply to the original elements |
| 19 |
and not the (conceptually) cloned DOM tree. |
| 20 |
</p> |
| 21 |
</d:testDescription> |
| 22 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 23 |
<p> |
| 24 |
Run the test. No interaction required. |
| 25 |
</p> |
| 26 |
</d:operatorScript> |
| 27 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 28 |
<p> |
| 29 |
The test has passed if the three rectangles have green fill and a thick darkgreen stroke. If any red shows the test has failed. |
| 30 |
</p> |
| 31 |
</d:passCriteria> |
| 32 |
</d:SVGTestCase> |
| 33 |
<title id="test-title">$RCSfile: struct-use-10-f.svg,v $</title> |
| 34 |
<defs> |
| 35 |
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> |
| 36 |
<font-face-src> |
| 37 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 38 |
</font-face-src> |
| 39 |
</font-face> |
| 40 |
</defs> |
| 41 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 42 |
<style type="text/css"> |
| 43 |
|
| 44 |
/* low specificity */ |
| 45 |
defs > rect { |
| 46 |
fill:red; |
| 47 |
} |
| 48 |
|
| 49 |
/* applies because of higher specificity */ |
| 50 |
.testclass1 { |
| 51 |
fill:green; |
| 52 |
} |
| 53 |
|
| 54 |
/* does not apply because selectors don't apply to the (conceptually) cloned subtree */ |
| 55 |
#testid1 .testclass1 { |
| 56 |
fill: red; |
| 57 |
} |
| 58 |
|
| 59 |
/* does not apply because of case sensitivity of class value */ |
| 60 |
g .testClass1 { |
| 61 |
fill:red; |
| 62 |
} |
| 63 |
|
| 64 |
/* does not apply because of lower specificity */ |
| 65 |
#g1 .testclass2 |
| 66 |
{ |
| 67 |
fill: red |
| 68 |
} |
| 69 |
|
| 70 |
/* does not apply to the used rect, because there is no inheritance from the original tree into the used subtree */ |
| 71 |
g#g1 { |
| 72 |
visibility: hidden |
| 73 |
} |
| 74 |
|
| 75 |
/* applies because of higher specificity */ |
| 76 |
#testid2 { |
| 77 |
stroke:darkgreen; |
| 78 |
} |
| 79 |
|
| 80 |
/* no effect for the used rect, can be referenced anyway into the used subtree */ |
| 81 |
g#g2 { |
| 82 |
display: none; |
| 83 |
} |
| 84 |
|
| 85 |
/* applies directly to the original (referenced) rect element */ |
| 86 |
.testclass3 > rect { |
| 87 |
fill: green; |
| 88 |
stroke:darkgreen; |
| 89 |
} |
| 90 |
|
| 91 |
/* does not apply to the used rect, because there is no direct access with selectors into the used subtree */ |
| 92 |
#testid3 rect { |
| 93 |
stroke:red; |
| 94 |
} |
| 95 |
#testid3 rect#testrect3 { |
| 96 |
fill:red; |
| 97 |
} |
| 98 |
</style> |
| 99 |
|
| 100 |
<defs> |
| 101 |
<rect id="testrect1" class="testclass1" width="100" height="100"/> |
| 102 |
<g id="g1" style="fill:red"> |
| 103 |
<rect id="testrect2" class="testclass2" width="100" height="100" style="fill:green"/> |
| 104 |
</g> |
| 105 |
<g id="g2" class="class testclass3 g"> |
| 106 |
<rect id="testrect3" width="100" height="100" stroke="red"/> |
| 107 |
</g> |
| 108 |
</defs> |
| 109 |
|
| 110 |
<text x="50%" y="3em" style="text-anchor:middle; fill:black">CSS selectors and use element</text> |
| 111 |
|
| 112 |
<circle class="indicator" cx="240" cy="150" r="25" fill="red"/> |
| 113 |
<circle class="indicator" cx="390" cy="150" r="25" fill="red"/> |
| 114 |
|
| 115 |
<use id="testid1" xlink:href="#testrect1" x="40" y="100" style="stroke:darkgreen" stroke-width="10"/> |
| 116 |
<use id="testid2" xlink:href="#testrect2" x="190" y="100" stroke="red" stroke-width="10"/> |
| 117 |
<use id="testid3" xlink:href="#testrect3" x="340" y="100" style="stroke:red" stroke-width="10"/> |
| 118 |
|
| 119 |
</g> |
| 120 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 121 |
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.6 $</text> |
| 122 |
</g> |
| 123 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/> |
| 124 |
<!-- comment out this watermark once the test is approved --> |
| 125 |
<!--<g id="draft-watermark"> |
| 126 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 127 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 128 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 129 |
</g>--> |
| 130 |
</svg> |