blob: 6d755788dd38260d8cb87f230c634a6834009b6d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/*******************************************************************************
* 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Tasktop Technologies - initial API and implementation
*******************************************************************************/
package org.eclipse.mylyn.tasks.tests;
import java.util.Collection;
import junit.framework.TestCase;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListDropAdapter;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.tasks.core.ITask;
/**
* @author Rob Elves
* @author Mik Kersten
*/
public class TaskListDropAdapterTest extends TestCase {
private TaskListDropAdapter dropAdapter;
private TaskList taskList;
@Override
protected void setUp() throws Exception {
TaskTestUtil.resetTaskListAndRepositories();
TreeViewer viewer = TaskListView.getFromActivePerspective().getViewer();
assertNotNull(viewer);
dropAdapter = new TaskListDropAdapter(viewer);
taskList = TasksUiPlugin.getTaskList();
}
@Override
protected void tearDown() throws Exception {
TaskTestUtil.resetTaskList();
}
public void testUrlDrop() {
assertEquals(0, taskList.getDefaultCategory().getChildren().size());
String url = "http://eclipse.org/mylyn";
String title = "Mylyn Project";
String urlData = url + "\n" + title;
dropAdapter.performDrop(urlData);
Collection<ITask> tasks = taskList.getDefaultCategory().getChildren();
assertNotNull(tasks);
assertEquals(1, tasks.size());
assertEquals(url, tasks.iterator().next().getUrl());
// TODO: Failing due to asynchronous retrieval of title from url
// assertEquals(title, tasks.get(0).getDescription(false));
}
}
|