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

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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/svg/text/select-svg-text-with-collapsed-whitespace.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8248eaf34bf2efd8438fbeb701a2bbfa7072f84a 100644
--- a/third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js
+++ b/third_party/WebKit/LayoutTests/svg/text/resources/SelectionTestCase.js
@@ -145,13 +145,23 @@ 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);
+ // TODO(shanmuga.m): It'd be preferable to have the assertions in the actual test-files.
+ assert_equals(startElementId, expected.startElementId);
+ 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;
+}
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/svg/text/select-svg-text-with-collapsed-whitespace.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698