Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.egit.mylyn.ui.test')
-rw-r--r--org.eclipse.egit.mylyn.ui.test/src/org/eclipse/egit/internal/mylyn/CommitHyperlinkDetectorTest.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/org.eclipse.egit.mylyn.ui.test/src/org/eclipse/egit/internal/mylyn/CommitHyperlinkDetectorTest.java b/org.eclipse.egit.mylyn.ui.test/src/org/eclipse/egit/internal/mylyn/CommitHyperlinkDetectorTest.java
index b8b97c155e..1f16511747 100644
--- a/org.eclipse.egit.mylyn.ui.test/src/org/eclipse/egit/internal/mylyn/CommitHyperlinkDetectorTest.java
+++ b/org.eclipse.egit.mylyn.ui.test/src/org/eclipse/egit/internal/mylyn/CommitHyperlinkDetectorTest.java
@@ -118,6 +118,30 @@ public class CommitHyperlinkDetectorTest {
assertNull(hyperlinks);
}
+ @Test
+ public void testMultiLine() {
+ setText("Test multi-line text\n" + EXAMPLE_ID);
+ IHyperlink[] hyperlinks = detectHyperlinks(0,textViewer.getDocument().getLength());
+ assertEquals(1, hyperlinks.length);
+ assertEquals(EXAMPLE_ID, hyperlinks[0].getHyperlinkText());
+ assertEquals(new Region(21, EXAMPLE_ID.length()), hyperlinks[0].getHyperlinkRegion());
+ }
+
+ @Test
+ public void testGerritId() {
+ setText("I" + EXAMPLE_ID);
+ IHyperlink[] hyperlinks = detectHyperlinks(0,textViewer.getDocument().getLength());
+ assertNull(hyperlinks);
+ }
+
+ @Test
+ public void testGerritIdWithinText() {
+ setText("abc I" + EXAMPLE_ID);
+ IHyperlink[] hyperlinks = detectHyperlinks(5,textViewer.getDocument().getLength());
+ assertNull(hyperlinks);
+ }
+
+
private IHyperlink[] detectHyperlinks() {
return detectHyperlinks(0, textViewer.getDocument().getLength());
}

Back to the top