From 43e6123882e908156ced6daa2edbc52197c56f73 Mon Sep 17 00:00:00 2001 From: Remy Suen Date: Tue, 4 Oct 2011 16:16:05 -0400 Subject: Bug 359079 BindingPersistenceTest's testBindingTransform win32 x86 test failed on N20110926-2000 It seems that the list of bindings in the binding manager is not always populated properly when the test suite gets to testBindingTransform. The fix is to activate the needed contexts that has the required keybinding defined for the assertion check.--- .../org/eclipse/ui/tests/keys/BindingPersistenceTest.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 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 5a0a57dd462..805c9265fe5 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2009 IBM Corporation and others. + * Copyright (c) 2005, 2011 IBM Corporation 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 @@ -19,6 +19,7 @@ import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.util.Util; import org.eclipse.swt.SWT; import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.contexts.IContextService; import org.eclipse.ui.internal.WorkbenchPlugin; import org.eclipse.ui.keys.IBindingService; import org.eclipse.ui.tests.harness.util.UITestCase; @@ -206,7 +207,15 @@ public final class BindingPersistenceTest extends UITestCase { } assertEquals(3, numOfMarkers); assertTrue("Unable to find delete marker", foundDeleteMarker); - TriggerSequence[] activeBindingsFor = bindingService.getActiveBindingsFor(addWS); + + // make sure that the proper contexts are currently active + IContextService contextService = (IContextService) fWorkbench + .getService(IContextService.class); + contextService + .activateContext(IContextService.CONTEXT_ID_DIALOG_AND_WINDOW); + contextService.activateContext(IContextService.CONTEXT_ID_WINDOW); + TriggerSequence[] activeBindingsFor = bindingService + .getActiveBindingsFor(addWS); assertEquals(1, activeBindingsFor.length); } -- cgit v1.2.3