Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui.tests')
-rw-r--r--org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/wizards/RepositorySettingsPageTest.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/wizards/RepositorySettingsPageTest.java b/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/wizards/RepositorySettingsPageTest.java
index 90cf7fb74..1a595dc87 100644
--- a/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/wizards/RepositorySettingsPageTest.java
+++ b/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/tasks/ui/wizards/RepositorySettingsPageTest.java
@@ -12,7 +12,9 @@
package org.eclipse.mylyn.tasks.ui.wizards;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -28,6 +30,7 @@ import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
import org.junit.Test;
@@ -63,6 +66,10 @@ public class RepositorySettingsPageTest {
protected void createAdditionalControls(Composite parent) {
// ignore
}
+
+ Combo getServerUrlCombo() {
+ return serverUrlCombo;
+ }
}
public static class RepositorySettingsPageWithNoCredentials extends TestRepositorySettingsPage {
@@ -172,6 +179,42 @@ public class RepositorySettingsPageTest {
assertEquals("Title", page.getTitle());
}
+ @Test
+ public void setUrlReadOnlyNotCalled() throws Exception {
+ TestRepositorySettingsPage page = new TestRepositorySettingsPage(createTaskRepository());
+ page.createControl(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ Combo serverUrlCombo = page.getServerUrlCombo();
+ assertTrue(serverUrlCombo.isEnabled());
+ }
+
+ @Test
+ public void setUrlReadOnlyTrue() throws Exception {
+ TestRepositorySettingsPage page = new TestRepositorySettingsPage(createTaskRepository());
+ page.setUrlReadOnly(true);
+ page.createControl(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ Combo serverUrlCombo = page.getServerUrlCombo();
+ assertFalse(serverUrlCombo.isEnabled());
+ }
+
+ @Test
+ public void setUrlReadOnlyFalse() throws Exception {
+ TestRepositorySettingsPage page = new TestRepositorySettingsPage(createTaskRepository());
+ page.setUrlReadOnly(false);
+ page.createControl(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ Combo serverUrlCombo = page.getServerUrlCombo();
+ assertTrue(serverUrlCombo.isEnabled());
+ }
+
+ @Test
+ public void isUrlReadOnly() throws Exception {
+ TestRepositorySettingsPage page = new TestRepositorySettingsPage(createTaskRepository());
+ assertFalse(page.isUrlReadOnly());
+ page.setUrlReadOnly(true);
+ assertTrue(page.isUrlReadOnly());
+ page.setUrlReadOnly(false);
+ assertFalse(page.isUrlReadOnly());
+ }
+
private AbstractRepositorySettingsPage createPage(TaskRepository repository) {
AbstractRepositorySettingsPage page = spy(new RepositorySettingsPageWithNoCredentials(repository));
doReturn("label").when(page).getRepositoryLabel();

Back to the top