OLD | NEW |
1 if (!window.eventSender || !window.testRunner) { | 1 if (!window.eventSender || !window.testRunner) { |
2 alert('This test needs to be run in DRT, to get results!'); | 2 alert('This test needs to be run in DRT, to get results!'); |
3 } | 3 } |
4 | 4 |
5 var svgRoot = 0; | 5 var svgRoot = 0; |
6 | 6 |
7 // Map 'point' into absolute coordinates, usable for eventSender | 7 // Map 'point' into absolute coordinates, usable for eventSender |
8 function transformPoint(point, matrix) { | 8 function transformPoint(point, matrix) { |
9 return point.matrixTransform(matrix); | 9 return point.matrixTransform(matrix); |
10 } | 10 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 var textElement = document.createElementNS("http://www.w3.org/2000/svg",
"svg:text"); | 123 var textElement = document.createElementNS("http://www.w3.org/2000/svg",
"svg:text"); |
124 textElement.setAttribute("x", "0"); | 124 textElement.setAttribute("x", "0"); |
125 textElement.setAttribute("y", "35"); | 125 textElement.setAttribute("y", "35"); |
126 textElement.setAttribute("fill", "red"); | 126 textElement.setAttribute("fill", "red"); |
127 textElement.setAttribute("transform", "scale(0.5)"); | 127 textElement.setAttribute("transform", "scale(0.5)"); |
128 textElement.setAttribute("font-size", "8"); | 128 textElement.setAttribute("font-size", "8"); |
129 textElement.textContent = "Expected '" + expectedText + "' to be selecte
d, got: '" + actualText + "'"; | 129 textElement.textContent = "Expected '" + expectedText + "' to be selecte
d, got: '" + actualText + "'"; |
130 document.getElementById("container").appendChild(textElement); | 130 document.getElementById("container").appendChild(textElement); |
131 } | 131 } |
132 } | 132 } |
| 133 |
| 134 function selectTextFromCharToPoint(selectionInfo, mouse, expectedRange) { |
| 135 var element = document.getElementById(selectionInfo.id); |
| 136 var startPos = element.getStartPositionOfChar(selectionInfo.offset); |
| 137 var absStartPos = toAbsoluteCoordinates(startPos, element); |
| 138 if (window.eventSender) { |
| 139 eventSender.mouseMoveTo(absStartPos.x, absStartPos.y); |
| 140 eventSender.mouseDown(); |
| 141 eventSender.mouseMoveTo(mouse.x, mouse.y); |
| 142 eventSender.mouseUp(); |
| 143 } |
| 144 |
| 145 range = window.getSelection().getRangeAt(0); |
| 146 shouldBe("range.startOffset", expectedRange.start); |
| 147 shouldBe("range.endOffset", expectedRange.end); |
| 148 if (window.eventSender) { |
| 149 eventSender.mouseMoveTo(0,0); |
| 150 eventSender.mouseDown(); |
| 151 eventSender.mouseUp(); |
| 152 } |
| 153 } |
OLD | NEW |