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

Unified Diff: ui/base/cocoa/controls/hyperlink_text_view_unittest.mm

Issue 2440913003: Fix issue with broken links in HyperlinkTextView. (Closed)
Patch Set: Add unit test. Created 4 years, 2 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 | « ui/base/cocoa/controls/hyperlink_text_view.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cocoa/controls/hyperlink_text_view_unittest.mm
diff --git a/ui/base/cocoa/controls/hyperlink_text_view_unittest.mm b/ui/base/cocoa/controls/hyperlink_text_view_unittest.mm
index 28014246f754f6daca765eaf9682e55bf6012636..efbf68656239ae3e72664c61b8215a9c30317225 100644
--- a/ui/base/cocoa/controls/hyperlink_text_view_unittest.mm
+++ b/ui/base/cocoa/controls/hyperlink_text_view_unittest.mm
@@ -58,6 +58,20 @@ class HyperlinkTextViewTest : public ui::CocoaTest {
TEST_VIEW(HyperlinkTextViewTest, view_);
+TEST_F(HyperlinkTextViewTest, TestSelectionRange) {
+ NSRange actualRange;
+
+ // The length of the selection range should be 0.
+ actualRange = [view_ selectionRangeForProposedRange:NSMakeRange(0, 20)
+ granularity:NSSelectByCharacter];
+ EXPECT_TRUE(NSEqualRanges(NSMakeRange(0, 0), actualRange));
+
+ // While the location should always match the location of the proposed range.
+ actualRange = [view_ selectionRangeForProposedRange:NSMakeRange(50, 100)
+ granularity:NSSelectByCharacter];
+ EXPECT_TRUE(NSEqualRanges(NSMakeRange(50, 0), actualRange));
+}
+
TEST_F(HyperlinkTextViewTest, TestViewConfiguration) {
EXPECT_FALSE([view_ isEditable]);
EXPECT_FALSE([view_ drawsBackground]);
« no previous file with comments | « ui/base/cocoa/controls/hyperlink_text_view.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698