Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2011-01-26 00:38:02 +0000
committerspingel2011-01-26 00:38:02 +0000
commitb5b0c6328beeae7c042a9f37408c8b6b6244073e (patch)
treefca4f1f9bd5446dc9a18ef28445fcbca90b19145 /org.eclipse.mylyn.tasks.tests/src
parent1935ca4ef9de0befd4d410633eb03cc03ec433a8 (diff)
downloadorg.eclipse.mylyn.tasks-b5b0c6328beeae7c042a9f37408c8b6b6244073e.tar.gz
org.eclipse.mylyn.tasks-b5b0c6328beeae7c042a9f37408c8b6b6244073e.tar.xz
org.eclipse.mylyn.tasks-b5b0c6328beeae7c042a9f37408c8b6b6244073e.zip
NEW - bug 335394: [patch] errors with TaskAttachments without url
https://bugs.eclipse.org/bugs/show_bug.cgi?id=335394
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests/src')
-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/TaskTestUtil.java5
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/AttachmentTableLabelProviderTest.java46
3 files changed, 53 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 783c595fb..516822fa9 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
@@ -26,6 +26,7 @@ import org.eclipse.mylyn.tasks.tests.ui.TaskHyperlinkDetectorTest;
import org.eclipse.mylyn.tasks.tests.ui.TaskListSynchronizationSchedulerTest;
import org.eclipse.mylyn.tasks.tests.ui.TaskListViewTest;
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.RepositoryCompletionProcessorTest;
@@ -108,6 +109,7 @@ public class AllTasksTests {
//suite.addTestSuite(ServiceMessageManagerTest.class);
suite.addTestSuite(TaskMigratorTest.class);
suite.addTestSuite(TaskListViewTest.class);
+ suite.addTestSuite(AttachmentTableLabelProviderTest.class);
// XXX long running tests, put back?
//suite.addTestSuite(QueryExportImportTest.class);
//suite.addTestSuite(BackgroundSaveTest.class);
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskTestUtil.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskTestUtil.java
index 0103422c4..a35099888 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskTestUtil.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskTestUtil.java
@@ -20,6 +20,7 @@ import junit.framework.Assert;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
+import org.eclipse.mylyn.internal.tasks.core.TaskAttachment;
import org.eclipse.mylyn.internal.tasks.core.TaskTask;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
@@ -136,4 +137,8 @@ public class TaskTestUtil {
return createTaskData(createMockRepository(), taskId);
}
+ public static TaskAttachment createMockTaskAttachment(String taskId) {
+ return new TaskAttachment(createMockRepository(), createMockTask(taskId), createMockTaskData(taskId).getRoot());
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/AttachmentTableLabelProviderTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/AttachmentTableLabelProviderTest.java
new file mode 100644
index 000000000..5226c6e24
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/AttachmentTableLabelProviderTest.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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
+ * 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.mylyn.internal.tasks.core.TaskAttachment;
+import org.eclipse.mylyn.internal.tasks.ui.editors.AttachmentTableLabelProvider;
+import org.eclipse.mylyn.tasks.tests.TaskTestUtil;
+
+/**
+ * @author Thomas Ehrnhoefer
+ * @author Steffen Pingel
+ */
+public class AttachmentTableLabelProviderTest extends TestCase {
+
+ public void testGetAttachmentId() {
+ TaskAttachment attachment = TaskTestUtil.createMockTaskAttachment("1");
+ AttachmentTableLabelProvider labelProvider = new AttachmentTableLabelProvider(null, null);
+
+ attachment.setUrl(null);
+ assertEquals("", labelProvider.getColumnText(attachment, 5));
+
+ attachment.setUrl("");
+ assertEquals("", labelProvider.getColumnText(attachment, 5));
+
+ attachment.setUrl("http://testi.ng");
+ assertEquals("", labelProvider.getColumnText(attachment, 5));
+
+ attachment.setUrl("http://testi.ng/?some=parameter");
+ assertEquals("", labelProvider.getColumnText(attachment, 5));
+
+ attachment.setUrl("http://testi.ng/?id=myid");
+ assertEquals("myid", labelProvider.getColumnText(attachment, 5));
+ }
+
+}

Back to the top