Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-02-26 04:40:34 +0000
committerspingel2010-02-26 04:40:34 +0000
commit59d49de8540ca44963fe1ed17f32c4307eb2dd18 (patch)
tree758cb812a4fbf468b3869b150c3f9252fff23e96 /org.eclipse.mylyn.tasks.tests
parente65344ca068ede6cc5b07d31b037e5d1939b8e9c (diff)
downloadorg.eclipse.mylyn.tasks-59d49de8540ca44963fe1ed17f32c4307eb2dd18.tar.gz
org.eclipse.mylyn.tasks-59d49de8540ca44963fe1ed17f32c4307eb2dd18.tar.xz
org.eclipse.mylyn.tasks-59d49de8540ca44963fe1ed17f32c4307eb2dd18.zip
RESOLVED - bug 288427: url hyperlinks with parenthesis are not detected correctly
https://bugs.eclipse.org/bugs/show_bug.cgi?id=288427
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.java33
1 files changed, 33 insertions, 0 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 46d2a811d..4a1342244 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
@@ -8,6 +8,7 @@
* Contributors:
* Tasktop Technologies - initial API and implementation
* David Green - fix for bug 266693
+ * Abner Ballardo - fix for bug 288427
*******************************************************************************/
package org.eclipse.mylyn.tasks.tests.ui.editor;
@@ -93,6 +94,28 @@ public class TaskUrlHyperlinkDetectorTest extends TestCase {
assertEquals("http://foo", ((TaskUrlHyperlink) links[0]).getURLString());
}
+ public void testClosingParenthesis() {
+ IHyperlink[] links = detect("http://foo?(bar)", 0, 0);
+ assertNotNull(links);
+ assertEquals(1, links.length);
+ assertEquals("http://foo?(bar)", ((TaskUrlHyperlink) links[0]).getURLString());
+
+ links = detect("(http://foo?(bar))", 0, 18);
+ assertNotNull(links);
+ assertEquals(1, links.length);
+ assertEquals("http://foo?(bar)", ((TaskUrlHyperlink) links[0]).getURLString());
+
+ links = detect("http://foo?((((bar).", 0, 0);
+ assertNotNull(links);
+ assertEquals(1, links.length);
+ assertEquals("http://foo?((((bar)", ((TaskUrlHyperlink) links[0]).getURLString());
+
+ links = detect("http://foo?(bar))))))))", 0, 0);
+ assertNotNull(links);
+ assertEquals(1, links.length);
+ assertEquals("http://foo?(bar)", ((TaskUrlHyperlink) links[0]).getURLString());
+ }
+
public void testDetectionUsingExtent() {
IHyperlink[] hyperlinks = detect("aa http://www.eclipse.org test", 0, 30);
assertNotNull(hyperlinks);
@@ -118,6 +141,16 @@ public class TaskUrlHyperlinkDetectorTest extends TestCase {
assertEquals(new Region(51, 22), hyperlinks[2].getHyperlinkRegion());
}
+ public void testDetectionMultiplelinesClosingParenthesis() {
+ String text = "aa http://www.eclipse.org?foo((bar)\n\n)(http://www.eclipse.org)\nhttp://www.eclipse.org()";
+ IHyperlink[] hyperlinks = detect(text, 0, text.length());
+ assertNotNull(hyperlinks);
+ assertEquals(3, hyperlinks.length);
+ assertEquals(new Region(3, 32), hyperlinks[0].getHyperlinkRegion());
+ assertEquals(new Region(39, 22), hyperlinks[1].getHyperlinkRegion());
+ assertEquals(new Region(63, 24), hyperlinks[2].getHyperlinkRegion());
+ }
+
public void testDetectionMultiplelines() {
String text = "aa http://www.eclipse.org\n\nhttp://www.eclipse.org.\nhttp://www.eclipse.org,";
IHyperlink[] hyperlinks = detect(text, 0, text.length());

Back to the top