Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Ritchie2015-11-13 18:54:07 -0500
committerGerrit Code Review @ Eclipse.org2015-11-16 20:47:06 -0500
commitcaeb07755d6648012df20b98664dc11a3101d7e5 (patch)
tree94f80cf9d13859e8067baa5f26b03e5f329fa693 /org.eclipse.mylyn.tasks.ui.tests
parentf3dc0e76e5e8c3bf88211b175b6a67b01e267ffa (diff)
downloadorg.eclipse.mylyn.tasks-caeb07755d6648012df20b98664dc11a3101d7e5.tar.gz
org.eclipse.mylyn.tasks-caeb07755d6648012df20b98664dc11a3101d7e5.tar.xz
org.eclipse.mylyn.tasks-caeb07755d6648012df20b98664dc11a3101d7e5.zip
BUG 482186: AbstractRepositorySettingsPage server URL disabled
* Add API to the AbstractRepositorySettingsPage to disable the serverUrlCombo. Change-Id: I7b1024759122e0542eb8bd6cf65f4927664e384d Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=482186 Signed-off-by: Colin Ritchie <colin.ritchie@tasktop.com>
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