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

Unified Diff: third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js

Issue 2260763002: Convert LayoutTests/svg/text/* js-tests.js tests to testharness.js based tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Align with review comments Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js
diff --git a/third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js b/third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js
index fd9be1ebd4f2447a97e66a8f65fcbfa2d7f7ab99..b1e548ce7be93060f84255b28930e588983f12d2 100644
--- a/third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js
+++ b/third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js
@@ -145,13 +145,22 @@ function selectTextFromCharToPoint(selectionInfo, mouse, expected) {
selection = window.getSelection();
startElementId = selection.anchorNode.parentElement.id;
endElementId = selection.focusNode.parentElement.id;
- shouldBeEqualToString("startElementId", expected.startElementId);
- shouldBe("selection.anchorOffset", expected.start);
- shouldBeEqualToString("endElementId", expected.endElementId);
- shouldBe("selection.focusOffset", expected.end);
+ assert_equals(startElementId, expected.startElementId);
fs 2016/08/22 14:10:05 In general I think it'd be preferable to have the
Shanmuga Pandi 2016/08/23 07:11:37 Acknowledged.
+ assert_equals(selection.anchorOffset, expected.start);
+ assert_equals(endElementId, expected.endElementId);
+ assert_equals(selection.focusOffset, expected.end);
if (window.eventSender) {
eventSender.mouseMoveTo(0,0);
eventSender.mouseDown();
eventSender.mouseUp();
}
}
+
+function getEndPosition(id, offset, gap) {
+ var element = document.getElementById(id);
+ var endPos = element.getEndPositionOfChar(offset);
+ endPos.x += gap.x;
+ endPos.y += gap.y;
+ var absEndPos = toAbsoluteCoordinates(endPos, element);
+ return absEndPos;
+}

Powered by Google App Engine
This is Rietveld 408576698