| 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="Vincent Hardy" status="accepted" |
| 15 |
version="$Revision: 1.8 $" testname="$RCSfile: coords-units-02-b.svg,v $"> |
| 16 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/coords.html#Units"> |
| 17 |
<p> |
| 18 |
Verify the conversion processing of CSS units and percentage values for both |
| 19 |
coordinates and length values. Note that the test uses the CSS px unit to be usable |
| 20 |
in all pixel resolutions. Hence, the conversion from other CSS units to CSS px is |
| 21 |
left out of the test. |
| 22 |
</p> |
| 23 |
<p> |
| 24 |
There are six atomic tests in this test. For each, the approach is to draw two similar |
| 25 |
elements (circles or rects) with coordinates specified in user space for one and in |
| 26 |
CSS units or percentage for the other. Each test is such that these two values (or |
| 27 |
value pairs) should match. |
| 28 |
</p> |
| 29 |
</d:testDescription> |
| 30 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 31 |
<p> |
| 32 |
Run the test. No interaction required. |
| 33 |
</p> |
| 34 |
</d:operatorScript> |
| 35 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 36 |
<p> |
| 37 |
In the first two tests, that validate coordinate processing, the circles |
| 38 |
should have the same center. In the following two tests, the rectangles should have |
| 39 |
the same height and width. And finally, in the last test, the 3 skewed circles should have the |
| 40 |
same radius. |
| 41 |
</p> |
| 42 |
<p> |
| 43 |
The rendered image should match the reference image except for the text which may |
| 44 |
show minor differences, per CSS2 rules for font selection and matching. |
| 45 |
</p> |
| 46 |
</d:passCriteria> |
| 47 |
</d:SVGTestCase> |
| 48 |
<title id="test-title">$RCSfile: coords-units-02-b.svg,v $</title> |
| 49 |
<defs> |
| 50 |
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> |
| 51 |
<font-face-src> |
| 52 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 53 |
</font-face-src> |
| 54 |
</font-face> |
| 55 |
</defs> |
| 56 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 57 |
<g font-size="13pt"> |
| 58 |
<!-- ==================================================================== --> |
| 59 |
<!-- First test, converting CSS coordinates to user space. --> |
| 60 |
<!-- If implemented properly, the pink marker should appear on top of --> |
| 61 |
<!-- the black marker. --> |
| 62 |
<!-- ==================================================================== --> |
| 63 |
<!-- Draw Text Comment --> |
| 64 |
<text x="60" y="35">CSS pixel coordinate to user space conversion</text> |
| 65 |
<g transform="translate(5, 0) scale(4)"> |
| 66 |
<!-- Draw marker using user space units --> |
| 67 |
<circle cx="7.5" cy="7.5" r="2.5" fill="black"/> |
| 68 |
<!-- Draw CSS marker using px units --> |
| 69 |
<circle cx="7.5px" cy="7.5px" r="1.5px" fill="fuchsia"/> |
| 70 |
</g> |
| 71 |
<!-- ==================================================================== --> |
| 72 |
<!-- Same test, using percentage values for the coordinates --> |
| 73 |
<!-- ==================================================================== --> |
| 74 |
<!-- Draw Text Comment --> |
| 75 |
<text x="60" y="85">Percentage coordinates to user space conversion</text> |
| 76 |
<g transform="translate(5, 50) scale(4)"> |
| 77 |
<!-- Draw marker using user space units --> |
| 78 |
<circle cx="7.5" cy="7.5" r="2.5" fill="black"/> |
| 79 |
<!-- Draw marker using percentages: 7.5 = 1.563% of 480 (cx) --> |
| 80 |
<!-- Draw marker using percentages: 7.5 = 2.083% of 360 (cy) --> |
| 81 |
<circle cx="1.563%" cy="2.083%" r=".3535%" fill="fuchsia"/> |
| 82 |
</g> |
| 83 |
<!-- ==================================================================== --> |
| 84 |
<!-- Second test, converting CSS width and height to user space. --> |
| 85 |
<!-- If implemented properly, the link marker should appear bellow the --> |
| 86 |
<!-- black one and have the same size --> |
| 87 |
<!-- ==================================================================== --> |
| 88 |
<!-- Draw Text Comment --> |
| 89 |
<text x="60" y="140">CSS width/height to user space conversion</text> |
| 90 |
<g transform="translate(30, 115) scale(4)"> |
| 91 |
<!-- Draw marker using user space units --> |
| 92 |
<rect x="-5" y="0" width="10" height="5" fill="black"/> |
| 93 |
<!-- Draw CSS marker using px units --> |
| 94 |
<rect x="-5" y="5" width="10px" height="5px" fill="fuchsia"/> |
| 95 |
</g> |
| 96 |
<!-- ==================================================================== --> |
| 97 |
<!-- Same test, using percentage values for the length --> |
| 98 |
<!-- ==================================================================== --> |
| 99 |
<!-- Draw Text Comment --> |
| 100 |
<text x="60" y="200">Percentage width/height to user space conversion</text> |
| 101 |
<g transform="translate(30, 175) scale(4)"> |
| 102 |
<!-- Draw marker using user space units --> |
| 103 |
<rect x="-5" y="0" width="10" height="5" fill="black"/> |
| 104 |
<!-- Draw CSS marker using percentages: 5*2 = 10 = 2.083% of 480 --> |
| 105 |
<!-- 2.5*2 = 5 = 1.389% of 360 --> |
| 106 |
<rect x="-5" y="5" width="2.083%" height="1.389%" fill="fuchsia"/> |
| 107 |
</g> |
| 108 |
<!-- ==================================================================== --> |
| 109 |
<!-- Third test, converting CSS arbitrary length to user space . --> |
| 110 |
<!-- If implemented properly, the three circles which are side by side --> |
| 111 |
<!-- should have the same radius --> |
| 112 |
<!-- ==================================================================== --> |
| 113 |
<!-- Draw Text Comment --> |
| 114 |
<text x="140" y="265">CSS and percentage length conversion</text> |
| 115 |
<g transform="translate(30, 260) skewX(45) scale(4)"> |
| 116 |
<!-- Draw marker using user space units --> |
| 117 |
<circle cx="0" cy="0" r="3.536" fill="black"/> |
| 118 |
<!-- Draw CSS marker using px units. --> |
| 119 |
<circle cx="10" cy="0" r="3.536px" fill="fuchsia"/> |
| 120 |
<!-- Draw marker using percentages. This should yield a value of 3.536 --> |
| 121 |
<!-- in user space. 3.536 = .8334% of 424.268px --> |
| 122 |
<circle cx="20" cy="0" r=".8334%" fill="green"/> |
| 123 |
<!-- Draw control lines at the top and bottom of the circles --> |
| 124 |
<line x1="-3.536" y1="-3.536" x2="25" y2="-3.536" fill="none" stroke="#cccccc" stroke-width=".5"/> |
| 125 |
<line x1="-3.536" y1="3.536" x2="25" y2="3.536" fill="none" stroke="#cccccc" stroke-width=".5"/> |
| 126 |
</g> |
| 127 |
</g> |
| 128 |
</g> |
| 129 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 130 |
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.8 $</text> |
| 131 |
</g> |
| 132 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/> |
| 133 |
<!-- comment out this watermark once the test is approved --> |
| 134 |
<!--<g id="draft-watermark"> |
| 135 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 136 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 137 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 138 |
</g>--> |
| 139 |
</svg> |