Debian Codegraph @

test_non_regression/fail/na/script/text-dom-02-f.svg

raw
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.3" reviewer="CL" author="CM" status="accepted"
15 version="$Revision: 1.10 $" testname="$RCSfile: text-dom-02-f.svg,v $">
16 <d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/text.html#InterfaceSVGTextContentElement">
17 <p>
18 This tests that methods on the SVGTextContentElement interface
19 that take an index to a character or a number of characters
20 actually interpret these as indexes to or numbers of UTF-16 code
21 units. To test this, a character from outside the Basic Multilingual Plane
22 (U+10000; LINEAR B SYLLABLE B008) is used in a text string.
23 This character is stored in UTF-16 as a surrogate pair.
24 </p>
25 <p>
26 The test consists of two sub-tests, which test those methods
27 on the SVGTextContentElement interface which do not rely on rendering. The result
28 of each sub-test is shown as a small rectangle: black
29 indicates that the sub-test did not run, red indicates that
30 the sub-test failed and green indicates that the sub-test
31 succeeded.
32 </p>
33 </d:testDescription>
34 <d:operatorScript xmlns="http://www.w3.org/1999/xhtml">
35 <p>
36 Run the test. No interaction required.
37 </p>
38 </d:operatorScript>
39 <d:passCriteria xmlns="http://www.w3.org/1999/xhtml">
40 <p>
41 The test is passed if both rectangles are green.
42 </p>
43 </d:passCriteria>
44 </d:SVGTestCase>
45 <title id="test-title">$RCSfile: text-dom-02-f.svg,v $</title>
46 <defs>
47 <font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F">
48 <font-face-src>
49 <font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/>
50 </font-face-src>
51 </font-face>
52 </defs>
53 <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
54 <text x='10' y='30' font-size='13'>Test that SVGTextContentElement methods work on UTF-16 code units</text>
55 <text x='10' y='60' font-size='11'>Methods independent of layout</text>
56 <font-face font-family='SPlaneOne'>
57 <font-face-src>
58 <font-face-uri xlink:href="../resources/Plane1/PlaneOne.svg#SPlaneOne"/>
59 </font-face-src>
60 </font-face>
61 <style type="text/css">
62 @font-face {
63 font-family: PlaneOne;
64 src: url(woffs/PlaneOne.woff) format("woff");
65 }
66 </style>
67
68 <text id='t' x='50' y='50' visibility='hidden' font-family='PlaneOne, SPlaneOne, serif' font-size='10' rotate='10 20 30'>a&#x10000;b</text>
69
70 <rect id='r1' x='10' y='140' width='30' height='30'/>
71 <text x='50' y='160'>getNumberOfChars</text>
72
73 <rect id='r2' x='10' y='180' width='30' height='30'/>
74 <text x='50' y='200'>getSubStringLength</text>
75
76 <script><![CDATA[
77 function $(x) { return document.getElementById(x) }
78 function eq(a, b) {
79 if (a.length != b.length) return false;
80 for (var i = 0; i < a.length; i++) if (a[i] != b[i]) return false;
81 return true;
82 }
83 function p(x, y) {
84 var p = document.documentElement.createSVGPoint();
85 p.x = x;
86 p.y = y;
87 return p;
88 }
89
90 var t = $('t');
91 var x, b;
92
93 b = false;
94 try {
95 b = t.getNumberOfChars() == 4;
96 } catch (e) {
97 }
98 $('r1').setAttribute('fill', b ? 'green' : 'red');
99
100 b = false;
101 try {
102 x = [
103 t.getSubStringLength(0, 1),
104 t.getSubStringLength(0, 2),
105 t.getSubStringLength(0, 3),
106 t.getSubStringLength(0, 4),
107 t.getSubStringLength(1, 1),
108 t.getSubStringLength(1, 2),
109 t.getSubStringLength(1, 3),
110 t.getSubStringLength(2, 1),
111 t.getSubStringLength(2, 2),
112 t.getSubStringLength(3, 1),
113 ];
114 b = eq(x, [1, 3, 3, 7, 2, 2, 6, 2, 6, 4]);
115 } catch (e) {
116 }
117 $('r2').setAttribute('fill', b ? 'green' : 'red');
118
119 ]]></script>
120 </g>
121 <g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
122 <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.10 $</text>
123 </g>
124 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
125 <!-- comment out this watermark once the test is approved --><!--
126 <g id="draft-watermark">
127 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
128 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
129 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
130 </g>-->
131 </svg>