Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-01-25 11:51:54 +0000
committerSteffen Pingel2012-01-25 11:51:54 +0000
commit1bf05488095c5e08f24693df9795f17ff529d19c (patch)
treeb1262ba2cc439831a0cc102b916e892a9ea4aa90 /org.eclipse.mylyn.tasks.tests
parent77b27ed8d525c7f83677544a349bea967f5286bf (diff)
downloadorg.eclipse.mylyn.tasks-1bf05488095c5e08f24693df9795f17ff529d19c.tar.gz
org.eclipse.mylyn.tasks-1bf05488095c5e08f24693df9795f17ff529d19c.tar.xz
org.eclipse.mylyn.tasks-1bf05488095c5e08f24693df9795f17ff529d19c.zip
NEW - bug 369598: NPE when expanding comments in the task editor
https://bugs.eclipse.org/bugs/show_bug.cgi?id=369598 Change-Id: I97af196aef52b58b4c0aae77e934fcf6913ecfb2
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests')
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java2
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/RegionComparatorTest.java67
2 files changed, 69 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java
index 5586fe667..76564626d 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java
@@ -30,6 +30,7 @@ import org.eclipse.mylyn.tasks.tests.ui.TaskRelationHyperlinkDetectorTest;
import org.eclipse.mylyn.tasks.tests.ui.editor.AttachmentTableLabelProviderTest;
import org.eclipse.mylyn.tasks.tests.ui.editor.EditorUtilTest;
import org.eclipse.mylyn.tasks.tests.ui.editor.PlanningPartTest;
+import org.eclipse.mylyn.tasks.tests.ui.editor.RegionComparatorTest;
import org.eclipse.mylyn.tasks.tests.ui.editor.RepositoryCompletionProcessorTest;
import org.eclipse.mylyn.tasks.tests.ui.editor.TaskEditorPartDescriptorTest;
import org.eclipse.mylyn.tasks.tests.ui.editor.TaskMigratorTest;
@@ -115,6 +116,7 @@ public class AllTasksTests {
//suite.addTestSuite(QueryExportImportTest.class);
//suite.addTestSuite(BackgroundSaveTest.class);
suite.addTestSuite(MultipleTaskHyperlinkDetectorTest.class);
+ suite.addTestSuite(RegionComparatorTest.class);
return suite;
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/RegionComparatorTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/RegionComparatorTest.java
new file mode 100644
index 000000000..970de1b49
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/RegionComparatorTest.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tasktop Technologies.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.tests.ui.editor;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jface.text.Region;
+import org.eclipse.mylyn.internal.tasks.ui.editors.AbstractHyperlinkTextPresentationManager.RegionComparator;
+
+/**
+ * @author Steffen Pingel
+ */
+public class RegionComparatorTest extends TestCase {
+
+ RegionComparator comparator = new RegionComparator();
+
+ public void testCompareToEquals() {
+ Region r1 = new Region(0, 10);
+ Region r2 = new Region(0, 10);
+ assertEquals(r1, r2);
+ assertEquals(0, comparator.compare(r1, r2));
+ }
+
+ public void testCompareToSameLength() {
+ Region r1 = new Region(0, 10);
+ Region r2 = new Region(1, 10);
+ assertFalse(r1.equals(r2));
+ assertEquals(-1, comparator.compare(r1, r2));
+ assertEquals(1, comparator.compare(r2, r1));
+ }
+
+ public void testCompareToNested() {
+ Region r1 = new Region(0, 10);
+ Region r2 = new Region(1, 8);
+ assertEquals(-1, comparator.compare(r1, r2));
+ assertEquals(1, comparator.compare(r2, r1));
+ }
+
+ public void testCompareToOverlapping() {
+ Region r1 = new Region(0, 10);
+ Region r2 = new Region(1, 12);
+ assertEquals(-1, comparator.compare(r1, r2));
+ assertEquals(1, comparator.compare(r2, r1));
+
+ r2 = new Region(1, 9);
+ assertEquals(-1, comparator.compare(r1, r2));
+ assertEquals(1, comparator.compare(r2, r1));
+ }
+
+ public void testCompareToSameOffset() {
+ Region r1 = new Region(5, 8);
+ Region r2 = new Region(5, 10);
+ assertFalse(r1.equals(r2));
+ assertEquals(-1, comparator.compare(r1, r2));
+ assertEquals(1, comparator.compare(r2, r1));
+ }
+
+}

Back to the top