| 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.4" reviewer="SVGWG" author="Chris lilley" status="accepted" |
| 15 |
version="$Revision: 1.6 $" testname="$RCSfile: styling-css-03-b.svg,v $"> |
| 16 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/styling.html#StylingWithCSS"> |
| 17 |
<p> |
| 18 |
Test ancestor, child and sibling selectors. |
| 19 |
</p> |
| 20 |
</d:testDescription> |
| 21 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 22 |
<p> |
| 23 |
Run the test. No interaction required. |
| 24 |
</p> |
| 25 |
|
| 26 |
</d:operatorScript> |
| 27 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 28 |
<p> |
| 29 |
The test is passed if all six shapes have a green fill. |
| 30 |
</p> |
| 31 |
</d:passCriteria> |
| 32 |
<!-- |
| 33 |
In the upper test, the selector 'immediate child' selects all elements of class |
| 34 |
'thischild' which are immediate children of the elements of class 'mummy'. The |
| 35 |
rectangle and the polygon are of class'thischild' but the polygon is not an immediate |
| 36 |
child so must not be selected. The rectangle must be green, the circle and polygon |
| 37 |
must be green. |
| 38 |
In the lower test, the 'adjacent sibling' selector matches elements of |
| 39 |
class 'secundus' which are adjacent to a previous sibling of class 'primus'; |
| 40 |
this makes the rectangle in the second test green. The first-child pseudoclass matches |
| 41 |
circles which are the first child of elements of class 'mummy' and if correctly |
| 42 |
selected this circle will be filled green. (The circle in the upper test is not |
| 43 |
the first child). |
| 44 |
--> |
| 45 |
</d:SVGTestCase> |
| 46 |
<title id="test-title">$RCSfile: styling-css-03-b.svg,v $</title> |
| 47 |
<defs> |
| 48 |
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> |
| 49 |
<font-face-src> |
| 50 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 51 |
</font-face-src> |
| 52 |
</font-face> |
| 53 |
</defs> |
| 54 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 55 |
|
| 56 |
<defs> |
| 57 |
<style type="text/css"> |
| 58 |
.mummy {fill: green } /* least specific */ |
| 59 |
.mummy rect { fill: red} /* more specific, make rect red */ |
| 60 |
.mummy > .thischild { fill: green } /* even more specific, rect green */ |
| 61 |
.child {fill: red} |
| 62 |
.gap > .thischild { fill: green} |
| 63 |
.daddy {fill: red } |
| 64 |
.daddy > .tertius {fill: green} /* bottom poly green */ |
| 65 |
.primus + .secundus { fill: green } /* bottom rect green */ |
| 66 |
.daddy :first-child { fill: green} /* bottom circle green */ |
| 67 |
</style> |
| 68 |
</defs> |
| 69 |
|
| 70 |
<text style="font-family:SVGFreeSansASCII;font-size:12px;" x="40" y="36"> |
| 71 |
ancestor selectors and child selectors: |
| 72 |
</text> |
| 73 |
|
| 74 |
<g class="mummy"> |
| 75 |
<rect class="thischild" x="220" y="80" width="60" height="40"/> |
| 76 |
<circle cx="160" cy="100" r="30"/> |
| 77 |
<g class="child"> |
| 78 |
<g class="generation gap"> |
| 79 |
<polygon class="thischild" points="300,100, 320,120, 340,110, 360,120, 390,90, 340,70"/> |
| 80 |
</g> |
| 81 |
</g> |
| 82 |
</g> |
| 83 |
|
| 84 |
<g transform="translate(0, 150)"> |
| 85 |
<text style="font-family:SVGFreeSansASCII;font-size:12px;" x="40" y="36"> |
| 86 |
ancestor, immediate-sibling and first-child selectors: |
| 87 |
</text> |
| 88 |
|
| 89 |
<g class="daddy"> |
| 90 |
<circle class="primus" cx="160" cy="100" r="30"/> |
| 91 |
<rect class="secundus" x="220" y="80" width="60" height="40"/> |
| 92 |
<polygon class="tertius" points="300,100, 320,120, 340,110, 360,120, 390,90, 340,70"/> |
| 93 |
</g> |
| 94 |
</g> |
| 95 |
</g> |
| 96 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 97 |
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.6 $</text> |
| 98 |
</g> |
| 99 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/> |
| 100 |
<!-- comment out this watermark once the test is approved --> |
| 101 |
<!--<g id="draft-watermark"> |
| 102 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 103 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 104 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 105 |
</g>--> |
| 106 |
</svg> |