Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: LayoutTests/svg/text/text-tselect-02-f.svg

Issue 1093373002: Rename 5 SVG text tests to reflect that they are for selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rename 5 SVG text tests to reflect that they are for selection Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/svg/text/text-tselect-01-b.svg ('k') | LayoutTests/svg/text/text-tspan-01-b.svg » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Full//EN" "http://www.w3.org/Graphics/ SVG/1.1/DTD/svg11-flat.dtd">
3 <svg version="1.1" baseProfile="full" id="svg-root" width="100%" height="100%" v iewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg"
4 xmlns:xlink="http://www.w3.org/1999/xlink" onload="doSelection(0,0);">
5 <!--========================================================================-- >
6 <!--= Copyright 2006 World Wide Web Consortium, (Massachusetts =-->
7 <!--= Institute of Technology, European Research Consortium for =-->
8 <!--= Informatics and Mathematics (ERCIM), Keio University). =-->
9 <!--= All Rights Reserved. =-->
10 <!--= See http://www.w3.org/Consortium/Legal/. =-->
11 <!--========================================================================-- >
12 <!-- NOTE: CVS will automatically update the -->
13 <!-- "$RCSfile: text-tselect-02-f.svg,v $" and "$Revision: 1.2 $" -->
14 <!-- fields in the file. -->
15 <!-- There is no need to update this information. -->
16 <!-- =====================================================================-->
17 <SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testsuite/description/" revi ewer="CL" owner="ED" desc="Tests bidirectional text selection" status="created" version="$Revision: 1.2 $" testname="$RCSfile: text-tselect-02-f.svg,v $">
18 <OperatorScript>
19 <Paragraph>
20 This test demonstrates text selection of bidirectional text.
21 The initial result should be that the first 9 characters in logi cal order
22 starting from logical position 0 are selected. Visually the sele ction is
23 discontigous and these substrings must be selected (listed in vi sual order):
24 </Paragraph>
25 <Paragraph>
26 "abc"
27 </Paragraph>
28 <Paragraph>
29 the space between "c" and "&#1493;"
30 </Paragraph>
31 <Paragraph>
32 "1"
33 </Paragraph>
34 <Paragraph>
35 the space between "3" and "&#1490;"
36 </Paragraph>
37 <Paragraph>
38 "&#1488;&#1489;&#1490;"
39 </Paragraph>
40 <Paragraph>
41 If only the substrings listed above were selected then the test has passed.
42 </Paragraph>
43 <Paragraph>
44 A user agent that allows selecting text in logical order would h ave generated the same selection
45 as in this testcase if the user started the selection on the cha racter "a" and ended it on the
46 character "1".
47
48 A user agent that allows selecting text in visual order would no t have a discontigous selection
49 if the user started the selection on the character "a" and ended it on the character "1". The copied
50 text would be discontigous instead in this case.
51
52 Note that the SVG DOM method requires logical order text selecti on, so for both types of user agents
53 this testcase must look the same.
54 </Paragraph>
55 <Paragraph>
56 The testcase also shows what happens when the selection is modif ied via DOM (click the buttons below
57 the bidi-text). Compliant viewers must throw an exception when t he first parameter handed
58 to SVGTextContentElement.selectSubString is out-of-range.
59 That means the variable 'startIndex' must always be in the range 0 &lt;= startIndex &lt;= 18.
60 It can be noted that the parameter 'numChars' is not restricted in this way.
61 </Paragraph>
62 <Paragraph>
63 Note that the color of the text selection is UA dependent and no t defined in the SVG specification.
64 </Paragraph>
65 </OperatorScript>
66 </SVGTestCase>
67 <title id="test-title">$RCSfile: text-tselect-02-f.svg,v $</title>
68 <!--======================================================================-->
69 <!--Content of Test Case follows... =====================-->
70 <!--======================================================================-->
71 <g id="test-body-content">
72 <defs>
73 <script><![CDATA[
74 var startIndex = 0;
75 var numChars = 9;
76
77 function doSelection(indexDelta, numCharsDelta)
78 {
79 try
80 {
81 document.getElementById('text').selectSubString( startIndex+indexDelta, numChars+numCharsDelta);
82 }
83 catch(e)
84 {
85 if(e.code == DOMException.INDEX_SIZE_ERR)
86 {
87 // If there was an error, re-select the last range
88 document.getElementById('text').selectSu bString(startIndex, numChars);
89 return;
90 }
91 }
92
93 startIndex += indexDelta;
94 numChars += numCharsDelta;
95
96 document.getElementById('info').firstChild.data = "Start Index: " + startIndex + ". NumChars: " + numChars;
97 }
98 ]]></script>
99 </defs>
100
101 <g transform="translate(0,60)">
102 <text id="info" font-size="16" x="10" y="70">StartIndex: 0 NumCh ars: 0</text>
103
104 <text id="text" font-size="48" y="128" x="10">
105 abc &#1488;&#1489;&#1490; 123 &#1491;&#1492;&#1493; def
106 </text>
107
108 <g id="buttons">
109 <rect x="10" y="160" width="100" height="20" fill="blue" onclick="doSelection(1,0);"/>
110 <text x="60" y="175" text-anchor="middle" font-size="16" fill="white" pointer-events="none">startIndex++</text>
111
112 <rect x="120" y="160" width="100" height="20" fill="blue " onclick="doSelection(-1,0);"/>
113 <text x="170" y="175" text-anchor="middle" font-size="16 " fill="white" pointer-events="none">startIndex--</text>
114
115 <rect x="230" y="160" width="100" height="20" fill="blue " onclick="doSelection(0,1);"/>
116 <text x="280" y="175" text-anchor="middle" font-size="16 " fill="white" pointer-events="none">numChars++</text>
117
118 <rect x="340" y="160" width="100" height="20" fill="blue " onclick="doSelection(0,-1);"/>
119 <text x="390" y="175" text-anchor="middle" font-size="16 " fill="white" pointer-events="none">numChars--</text>
120 </g>
121 </g>
122 </g>
123 <text id="revision" x="10" y="340" font-size="40" stroke="none" fill="black">$ Revision: 1.2 $</text>
124 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke= "#000"/>
125 <script>
126 if (window.testRunner)
127 window.testRunner.dumpSelectionRect();
128 document.execCommand("SelectAll");
129 </script>
130 </svg>
OLDNEW
« no previous file with comments | « LayoutTests/svg/text/text-tselect-01-b.svg ('k') | LayoutTests/svg/text/text-tspan-01-b.svg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698