Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Bullen2017-11-29 19:12:21 +0000
committerAlexander Kurtakov2017-12-01 05:35:25 +0000
commit4ea150c1052dd3505ee52065f12b61f4aac6bc6a (patch)
treebe0473b2bf8b2a889c3dc38364bd99dd67b839d5
parent94067d657c90e7ccad60c5490a151632c9e88a40 (diff)
downloadeclipse.platform.ui-4ea150c1052dd3505ee52065f12b61f4aac6bc6a.tar.gz
eclipse.platform.ui-4ea150c1052dd3505ee52065f12b61f4aac6bc6a.tar.xz
eclipse.platform.ui-4ea150c1052dd3505ee52065f12b61f4aac6bc6a.zip
Bug 506709 - 3 BindingPersistenceTest/s failI20171201-0345
*Have not been able to cause fail so can not confirm fix* Waits for the workbench to be opened and command/binding services received in the doSetUp. Change-Id: Idfa80238f393c2befeae769f3a1e4dc7a5ed5fd3 Signed-off-by: Lucas Bullen <lbullen@redhat.com>
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/BindingPersistenceTest.java63
1 files changed, 22 insertions, 41 deletions
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/BindingPersistenceTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/BindingPersistenceTest.java
index 64be89ad867..8ad89264502 100644
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/BindingPersistenceTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/BindingPersistenceTest.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Lucas Bullen (Red Hat Inc.) - Bug 506709
*******************************************************************************/
package org.eclipse.ui.tests.keys;
@@ -23,6 +24,7 @@ import org.eclipse.jface.bindings.keys.ParseException;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.Util;
import org.eclipse.swt.SWT;
+import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchCommandConstants;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.contexts.IContextService;
@@ -40,6 +42,8 @@ import org.eclipse.ui.tests.harness.util.UITestCase;
public final class BindingPersistenceTest extends UITestCase {
private final String EMACS_SCHEME_ID = "org.eclipse.ui.emacsAcceleratorConfiguration";
+ private ICommandService commandService;
+ private IBindingService bindingService;
/**
* Constructor for <code>BindingPersistenceTest</code>.
@@ -52,18 +56,27 @@ public final class BindingPersistenceTest extends UITestCase {
}
/**
+ * Creates a new workbench and retrieves its context manager and a binding
+ * manager for use in the test cases.
+ */
+ @Override
+ protected void doSetUp() throws Exception {
+ super.doSetUp();
+ IWorkbench workbench = openTestWindow().getWorkbench();
+ commandService = workbench.getAdapter(ICommandService.class);
+ bindingService = workbench.getAdapter(IBindingService.class);
+ }
+
+ /**
* <p>
- * Tests whether the preference store will be read automatically when a
- * change to the preference store is made.
+ * Tests whether the preference store will be read automatically when a change
+ * to the preference store is made.
* </p>
*
* @throws ParseException
* If "ALT+SHIFT+Q A" cannot be parsed by KeySequence.
*/
public final void testAutoLoad() throws ParseException {
- // Get the services.
- ICommandService commandService = fWorkbench.getAdapter(ICommandService.class);
- IBindingService bindingService = fWorkbench.getAdapter(IBindingService.class);
bindingService.readRegistryAndPreferences(commandService);
// Check the pre-conditions.
@@ -127,10 +140,6 @@ public final class BindingPersistenceTest extends UITestCase {
}
public final void testSinglePlatform() throws Exception {
- // Get the services.
- ICommandService commandService = fWorkbench.getAdapter(ICommandService.class);
- IBindingService bindingService = fWorkbench.getAdapter(IBindingService.class);
-
ParameterizedCommand about = new ParameterizedCommand(commandService
.getCommand("org.eclipse.ui.help.aboutAction"), null);
KeySequence m18A = KeySequence.getInstance("M1+8 A");
@@ -168,9 +177,6 @@ public final class BindingPersistenceTest extends UITestCase {
}
public final void TODOtestBindingTransform() throws Exception {
- ICommandService commandService = fWorkbench.getAdapter(ICommandService.class);
- IBindingService bindingService = fWorkbench.getAdapter(IBindingService.class);
-
ParameterizedCommand addWS = new ParameterizedCommand(commandService
.getCommand("org.eclipse.ui.navigate.addToWorkingSet"), null);
KeySequence m18w = KeySequence.getInstance("M1+8 W");
@@ -220,9 +226,6 @@ public final class BindingPersistenceTest extends UITestCase {
}
public void testModifierWithPlatform() throws Exception {
-
- ICommandService commandService = fWorkbench.getAdapter(ICommandService.class);
- IBindingService bindingService = fWorkbench.getAdapter(IBindingService.class);
ParameterizedCommand importCmd = new ParameterizedCommand(
commandService.getCommand("org.eclipse.ui.file.import"), null);
Binding[] bindings = bindingService.getBindings();
@@ -245,9 +248,6 @@ public final class BindingPersistenceTest extends UITestCase {
}
public void testModifierNotApplied() throws Exception {
-
- ICommandService commandService = fWorkbench.getAdapter(ICommandService.class);
- IBindingService bindingService = fWorkbench.getAdapter(IBindingService.class);
ParameterizedCommand exportCmd = new ParameterizedCommand(
commandService.getCommand("org.eclipse.ui.file.export"), null);
Binding[] bindings = bindingService.getBindings();
@@ -266,9 +266,6 @@ public final class BindingPersistenceTest extends UITestCase {
}
public void testDifferentPlatform() throws Exception {
-
- ICommandService commandService = fWorkbench.getAdapter(ICommandService.class);
- IBindingService bindingService = fWorkbench.getAdapter(IBindingService.class);
ParameterizedCommand backCmd = new ParameterizedCommand(
commandService.getCommand("org.eclipse.ui.navigate.back"), null);
Binding[] bindings = bindingService.getBindings();
@@ -293,9 +290,6 @@ public final class BindingPersistenceTest extends UITestCase {
if (Util.isMac()) {
return;
}
- ICommandService commandService = fWorkbench.getAdapter(ICommandService.class);
- IBindingService bindingService = fWorkbench.getAdapter(IBindingService.class);
-
final Scheme activeScheme = bindingService.getActiveScheme();
final Binding[] originalBindings = bindingService.getBindings();
@@ -369,8 +363,6 @@ public final class BindingPersistenceTest extends UITestCase {
// TODO investigate on Mac
return;
}
- ICommandService commandService = fWorkbench.getAdapter(ICommandService.class);
- IBindingService bindingService = fWorkbench.getAdapter(IBindingService.class);
final Scheme activeScheme = bindingService.getActiveScheme();
@@ -413,9 +405,6 @@ public final class BindingPersistenceTest extends UITestCase {
return;
}
- ICommandService commandService = fWorkbench.getAdapter(ICommandService.class);
- IBindingService bindingService = fWorkbench.getAdapter(IBindingService.class);
-
final Scheme emacsScheme = bindingService.getScheme(EMACS_SCHEME_ID);
assertNotNull(emacsScheme);
final Binding[] originalBindings = bindingService.getBindings();
@@ -500,8 +489,6 @@ public final class BindingPersistenceTest extends UITestCase {
// TODO investigate on Mac
return;
}
- ICommandService commandService = fWorkbench.getAdapter(ICommandService.class);
- IBindingService bindingService = fWorkbench.getAdapter(IBindingService.class);
final Scheme emacsScheme = bindingService.getScheme(EMACS_SCHEME_ID);
assertNotNull(emacsScheme);
@@ -548,8 +535,6 @@ public final class BindingPersistenceTest extends UITestCase {
// the 'paste' key binding overrides the 'redo' key binding and can be
// put back
public void testPasteBindingEmacs() throws Exception {
- ICommandService commandService = fWorkbench.getAdapter(ICommandService.class);
- IBindingService bindingService = fWorkbench.getAdapter(IBindingService.class);
final Scheme emacsScheme = bindingService.getScheme(EMACS_SCHEME_ID);
assertNotNull(emacsScheme);
@@ -571,22 +556,18 @@ public final class BindingPersistenceTest extends UITestCase {
@Override
protected void doTearDown() throws Exception {
- final IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
- store
- .setValue(
+ WorkbenchPlugin.getDefault().getPreferenceStore().setValue(
"org.eclipse.ui.commands",
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><org.eclipse.ui.commands><activeKeyConfiguration keyConfigurationId=\""
+ IBindingService.DEFAULT_DEFAULT_ACTIVE_SCHEME_ID
+ "\"/></org.eclipse.ui.commands>");
- IBindingService bindingService = fWorkbench.getAdapter(IBindingService.class);
-
+ commandService = null;
// reset keybindings
bindingService.readRegistryAndPreferences(null);
- final Scheme activeScheme = bindingService
- .getScheme(IBindingService.DEFAULT_DEFAULT_ACTIVE_SCHEME_ID);
+ final Scheme activeScheme = bindingService.getScheme(IBindingService.DEFAULT_DEFAULT_ACTIVE_SCHEME_ID);
final Binding[] originalBindings = bindingService.getBindings();
bindingService.savePreferences(activeScheme, originalBindings);
+ bindingService = null;
super.doTearDown();
}
}

Back to the top