Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-04-10 17:14:35 +0000
committerspingel2009-04-10 17:14:35 +0000
commit39d4b00f4bd5f853eff0187f71c0afe954370e36 (patch)
tree4fffaecd90008a23150509b5e781af0b871febec /org.eclipse.mylyn.tasks.tests
parentca02e941c3b878a7ec8a164ddd1e0dc77353c866 (diff)
downloadorg.eclipse.mylyn.tasks-39d4b00f4bd5f853eff0187f71c0afe954370e36.tar.gz
org.eclipse.mylyn.tasks-39d4b00f4bd5f853eff0187f71c0afe954370e36.tar.xz
org.eclipse.mylyn.tasks-39d4b00f4bd5f853eff0187f71c0afe954370e36.zip
NEW - bug 266693: [patch] URL hyperlinks do not always show as blue in task editor
https://bugs.eclipse.org/bugs/show_bug.cgi?id=266693
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests')
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/TaskUrlHyperlinkDetectorTest.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/TaskUrlHyperlinkDetectorTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/TaskUrlHyperlinkDetectorTest.java
index d90f17b30..2bcdb3695 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/TaskUrlHyperlinkDetectorTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/TaskUrlHyperlinkDetectorTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
+ * Copyright (c) 2004, 2009 Tasktop Technologies and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -80,10 +80,37 @@ public class TaskUrlHyperlinkDetectorTest extends TestCase {
assertEquals(1, hyperlinks.length);
}
+ public void testDetectionMultipleLinks() {
+ String text = "aa http://www.eclipse.org test http://www.foo.bar/baz?one=two&three=four+five#six";
+ IHyperlink[] hyperlinks = detect(text, 0, text.length());
+ assertNotNull(hyperlinks);
+ assertEquals(2, hyperlinks.length);
+ assertEquals(new Region(3, 22), hyperlinks[0].getHyperlinkRegion());
+ assertEquals(new Region(31, 50), hyperlinks[1].getHyperlinkRegion());
+ }
+
+ public void testDetectionNegativeMatchOnTrailingPunctuation() {
+ String text = "aa http://www.eclipse.org) http://www.eclipse.org. http://www.eclipse.org,";
+ IHyperlink[] hyperlinks = detect(text, 0, text.length());
+ assertNotNull(hyperlinks);
+ assertEquals(3, hyperlinks.length);
+ assertEquals(new Region(3, 22), hyperlinks[0].getHyperlinkRegion());
+ assertEquals(new Region(27, 22), hyperlinks[1].getHyperlinkRegion());
+ assertEquals(new Region(51, 22), hyperlinks[2].getHyperlinkRegion());
+ }
+
public void testDetection() {
IHyperlink[] hyperlinks = detect("aa http://www.eclipse.org test", 20, 0);
assertNotNull(hyperlinks);
assertEquals(1, hyperlinks.length);
}
+ public void testDetection2() {
+ String text = "http://www.eclipse.org";
+ IHyperlink[] hyperlinks = detect(text, 0, text.length());
+ assertNotNull(hyperlinks);
+ assertEquals(1, hyperlinks.length);
+ assertEquals(new Region(0, 22), hyperlinks[0].getHyperlinkRegion());
+ }
+
}

Back to the top