Index: third_party/WebKit/LayoutTests/svg/text/select-svg-text-with-collapsed-whitespace.html |
diff --git a/third_party/WebKit/LayoutTests/svg/text/select-svg-text-with-collapsed-whitespace.html b/third_party/WebKit/LayoutTests/svg/text/select-svg-text-with-collapsed-whitespace.html |
index 83618330a1dfb0e9e30f6a2e4b912763f5410038..33747e8aa42244d7827d4565ec4c2365231c1200 100644 |
--- a/third_party/WebKit/LayoutTests/svg/text/select-svg-text-with-collapsed-whitespace.html |
+++ b/third_party/WebKit/LayoutTests/svg/text/select-svg-text-with-collapsed-whitespace.html |
@@ -8,64 +8,59 @@ This test checks that characters can be selected correctly with collapsed whites |
<text id="text3" x="20" y="80"> <tspan id="tspan2" style="font-size: 25px;">happy</tspan> debugging !!</text> |
<text id="text4" x="20" y="230" fill="black" transform="scale(0.5)" font-size="40"> happy debugging !!</text> |
</svg> |
-<script src="../../resources/js-test.js"></script> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
<script src="resources/SelectionTestCase.js"></script> |
-<script type="text/javascript"> |
-var range; |
-function runTest() { |
+<script> |
+test(function() { |
+ selectText('text1', 0, 3); |
+ verify(5, 9); |
- if (!window.testRunner) |
- return; |
+ selectText('text1', 0, 8); |
+ verify(5, 24); |
- selectText('text1', 0, 3); |
- verify("5", "9"); |
+ selectText('text1', 4, 9); |
+ verify(9, 25); |
- selectText('text1', 0, 8); |
- verify("5", "24"); |
+ selectText('text2', 0, 3); |
+ verify(0, 4); |
- selectText('text1', 4, 9); |
- verify("9", "25"); |
+ selectText('text2', 0, 8); |
+ verify(0, 14); |
- selectText('text2', 0, 3); |
- verify("0", "4"); |
+ selectText('text2', 3, 9); |
+ verify(3, 15); |
- selectText('text2', 0, 8); |
- verify("0", "14"); |
+ selectText('text3', 0, 3); |
+ verify(0, 4); |
- selectText('text2', 3, 9); |
- verify("3", "15"); |
+ selectText('text3', 0, 10); |
+ verify(0, 15); |
- selectText('text3', 0, 3); |
- verify("0", "4"); |
+ selectText('text3', 2, 14); |
+ verify(2, 19); |
- selectText('text3', 0, 10); |
- verify("0", "15"); |
+ selectText('text4', 0, 3); |
+ verify(5, 9); |
- selectText('text3', 2, 14); |
- verify("2", "19"); |
+ selectText('text4', 0, 8); |
+ verify(5, 24); |
- selectText('text4', 0, 3); |
- verify("5", "9"); |
+ selectText('text4', 6, 11); |
+ verify(21, 27) |
- selectText('text4', 0, 8); |
- verify("5", "24"); |
- |
- selectText('text4', 6, 11); |
- verify("21", "27") |
-} |
- |
-function verify(start, end) { |
- range = window.getSelection().getRangeAt(0); |
- shouldBe("range.startOffset", start); |
- shouldBe("range.endOffset", end); |
+ function verify(start, end) { |
+ var range = window.getSelection().getRangeAt(0); |
+ assert_equals(range.startOffset, start); |
+ assert_equals(range.endOffset, end); |
if (window.eventSender) { |
eventSender.mouseMoveTo(0,0); |
eventSender.mouseDown(); |
eventSender.mouseUp(); |
} |
-} |
+ } |
-function selectText(id, start, end) { |
+ function selectText(id, start, end) { |
var element = document.getElementById(id); |
var startPos = element.getStartPositionOfChar(start); |
var endPos = element.getEndPositionOfChar(end); |
@@ -77,7 +72,6 @@ function selectText(id, start, end) { |
eventSender.mouseMoveTo(absEndPos.x, absEndPos.y); |
eventSender.mouseUp(); |
} |
-} |
- |
-runTest(); |
+ } |
+}); |
</script> |