OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <style> | 2 <style> |
3 text { | 3 text { |
4 font: 10px Arial; | 4 font: 10px Arial; |
5 } | 5 } |
6 </style> | 6 </style> |
7 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlin k" width="400" height="400" style="border: 1px solid black;"> | 7 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlin k" width="400" height="400" style="border: 1px solid black;"> |
8 <g> | 8 <g> |
9 <text id="firsttext" x="130" y="30">Happy, Web</text> | 9 <text id="firsttext" x="130" y="30">Happy, Web</text> |
10 <text id="middletext" x="130" y="50">Happy, SVG</text> | 10 <text id="middletext" x="130" y="50">Happy, SVG</text> |
11 <text id="endtext" x="130" y="70">Happy, ;)link</text> | 11 <text id="endtext" x="130" y="70">Happy, ;)link</text> |
12 </g> | 12 </g> |
13 <text id="line" x="130" y="150">Hello World. Hello, SVG.</text> | 13 <text id="line" x="130" y="150">Hello World. Hello, SVG.</text> |
14 </svg> | 14 </svg> |
15 <script src="../../resources/js-test.js"></script> | 15 <script src="../../resources/testharness.js"></script> |
16 <script src="../../resources/testharnessreport.js"></script> | |
16 <script src="resources/SelectionTestCase.js"></script> | 17 <script src="resources/SelectionTestCase.js"></script> |
17 <script type="text/javascript"> | 18 <script type="text/javascript"> |
19 test(function() { | |
18 function getEndPosition(id, offset, gap) { | 20 function getEndPosition(id, offset, gap) { |
Srirama
2016/08/19 11:42:14
give indentation for all the code inside test func
Srirama
2016/08/19 11:42:14
looks like this is common in most of the tests. So
Shanmuga Pandi
2016/08/22 06:40:34
Done.
Shanmuga Pandi
2016/08/22 06:40:34
Done.
| |
19 var element = document.getElementById(id); | 21 var element = document.getElementById(id); |
20 var endPos = element.getEndPositionOfChar(offset); | 22 var endPos = element.getEndPositionOfChar(offset); |
21 endPos.x += gap.x; | 23 endPos.x += gap.x; |
22 endPos.y += gap.y; | 24 endPos.y += gap.y; |
23 var absEndPos = toAbsoluteCoordinates(endPos, element); | 25 var absEndPos = toAbsoluteCoordinates(endPos, element); |
24 return absEndPos; | 26 return absEndPos; |
25 } | 27 } |
26 | 28 |
27 selectTextFromCharToPoint({ id: 'line', offset: 0 }, { x: 400, y: 400 }, { start ElementId: 'line', start: "0", endElementId: "line", end: "24" }); | 29 selectTextFromCharToPoint({ id: 'line', offset: 0 }, { x: 400, y: 400 }, { start ElementId: 'line', start: 0, endElementId: "line", end: 24 }); |
28 selectTextFromCharToPoint({ id: 'line', offset: 7 }, { x: 400, y: 400 }, { start ElementId: "line", start: "7", endElementId: "line", end: "24" }); | 30 selectTextFromCharToPoint({ id: 'line', offset: 7 }, { x: 400, y: 400 }, { start ElementId: "line", start: 7, endElementId: "line", end: 24 }); |
29 | 31 |
30 var absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 0}); | 32 var absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 0}); |
31 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: "0", endElementId: "firsttext", end: "4"}); | 33 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: 0, endElementId: "firsttext", end: 4}); |
32 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 10}); | 34 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 10}); |
33 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: "0", endElementId: "middletext", end: "4"}); | 35 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: 0, endElementId: "middletext", end: 4}); |
34 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 20}); | 36 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 20}); |
35 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: "0", endElementId: "middletext", end: "4"}); | 37 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: 0, endElementId: "middletext", end: 4}); |
36 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 30}); | 38 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 30}); |
37 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: "0", endElementId: "endtext", end: "4"}); | 39 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: 0, endElementId: "endtext", end: 4}); |
38 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 40}); | 40 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 40}); |
39 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: "0", endElementId: "endtext", end: "4"}); | 41 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: 0, endElementId: "endtext", end: 4}); |
40 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 50}); | 42 absEndPos = getEndPosition('firsttext', 3, { x : 0, y : 50}); |
41 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: "0", endElementId: "endtext", end: "4"}); | 43 selectTextFromCharToPoint({ id: 'firsttext', offset: 0 }, absEndPos, { startElem entId: 'firsttext', start: 0, endElementId: "endtext", end: 4}); |
42 | 44 }); |
43 </script> | 45 </script> |
OLD | NEW |