Index: Eclipse RCP Tests/org/eclipse/ui/tests/rcp/RcpTestSuite.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.tests.rcp/Eclipse RCP Tests/org/eclipse/ui/tests/rcp/RcpTestSuite.java,v retrieving revision 1.6 diff -u -r1.6 RcpTestSuite.java --- Eclipse RCP Tests/org/eclipse/ui/tests/rcp/RcpTestSuite.java 15 Jun 2005 18:41:28 -0000 1.6 +++ Eclipse RCP Tests/org/eclipse/ui/tests/rcp/RcpTestSuite.java 26 Jul 2005 21:15:12 -0000 @@ -13,25 +13,46 @@ import junit.framework.Test; import junit.framework.TestSuite; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.tests.session.ConfigurationSessionTestSuite; +import org.osgi.framework.Bundle; + + /** - * The test suite for the RCP APIs in the generic workbench. - * To run, use a headless JUnit Plug-in Test launcher, configured - * to have [No Application] as its application. + * The test suite for the RCP APIs in the generic workbench. To run, use a + * headless JUnit Plug-in Test launcher, configured to have [No Application] as + * its application. */ public class RcpTestSuite extends TestSuite { - /** Returns the suite. This is required to use the JUnit Launcher. */ - public static Test suite() { - return new RcpTestSuite(); - } - - public RcpTestSuite() { - addTest(new TestSuite(PlatformUITest.class)); - addTest(new TestSuite(WorkbenchAdvisorTest.class)); - addTest(new TestSuite(WorkbenchConfigurerTest.class)); - addTest(new TestSuite(WorkbenchWindowConfigurerTest.class)); - addTest(new TestSuite(ActionBarConfigurerTest.class)); - addTest(new TestSuite(IWorkbenchPageTest.class)); - addTest(new TestSuite(WorkbenchSaveRestoreStateTest.class)); - } + /** Returns the suite. This is required to use the JUnit Launcher. */ + public static Test suite() { + ConfigurationSessionTestSuite suite = new ConfigurationSessionTestSuite( + "org.eclipse.ui.tests.rcp"); + String[] ids = ConfigurationSessionTestSuite.MINIMAL_BUNDLE_SET; + for (int i = 0; i < ids.length; i++) { + suite.addBundle(ids[i]); + } + suite.addBundle("org.eclipse.ui.tests.rcp"); + suite.addBundle("org.eclipse.ui"); + suite.addBundle("org.eclipse.jface"); + suite.addBundle("org.eclipse.swt"); + suite.addBundle("org.eclipse.ui.workbench"); + suite.addBundle("org.eclipse.help"); + suite.addBundle("org.eclipse.core.commands"); + suite.addBundle("org.eclipse.core.expressions"); + // Find the SWT fragment for the current platform + Bundle[] fragments = Platform.getFragments(Platform + .getBundle("org.eclipse.swt")); + for (int i = 0; i < fragments.length; i++) { + Bundle fragment = fragments[i]; + suite.addBundle(fragment.getSymbolicName()); + } + + suite.addTest(new InnerRcpTestSuite()); + suite.setSharedSession(true); + + return suite; + } + } Index: Eclipse RCP Tests/org/eclipse/ui/tests/rcp/WorkbenchWindowConfigurerTest.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.tests.rcp/Eclipse RCP Tests/org/eclipse/ui/tests/rcp/WorkbenchWindowConfigurerTest.java,v retrieving revision 1.3 diff -u -r1.3 WorkbenchWindowConfigurerTest.java --- Eclipse RCP Tests/org/eclipse/ui/tests/rcp/WorkbenchWindowConfigurerTest.java 25 Feb 2005 20:44:45 -0000 1.3 +++ Eclipse RCP Tests/org/eclipse/ui/tests/rcp/WorkbenchWindowConfigurerTest.java 26 Jul 2005 21:15:12 -0000 @@ -12,17 +12,31 @@ import junit.framework.TestCase; +import org.eclipse.swt.widgets.CoolBar; import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbenchPreferenceConstants; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.application.IActionBarConfigurer; import org.eclipse.ui.application.IWorkbenchWindowConfigurer; import org.eclipse.ui.application.WorkbenchAdvisor; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; +import org.eclipse.ui.internal.WorkbenchWindow; import org.eclipse.ui.tests.rcp.util.WorkbenchAdvisorObserver; public class WorkbenchWindowConfigurerTest extends TestCase { - public WorkbenchWindowConfigurerTest(String name) { + private static class WrappedException extends RuntimeException { + private static final long serialVersionUID = 1L; + + private final Throwable throwable; + + WrappedException(Throwable t) { + this.throwable = t; + } + } + + public WorkbenchWindowConfigurerTest(String name) { super(name); } @@ -93,4 +107,58 @@ int code = PlatformUI.createAndRunWorkbench(display, wa); assertEquals(PlatformUI.RETURN_OK, code); } + + public void test70049() throws Throwable { + PlatformUI.getPreferenceStore().putValue( + IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR, + IWorkbenchPreferenceConstants.LEFT); + WorkbenchAdvisor wa = new WorkbenchAdvisorObserver(1) { + public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor( + IWorkbenchWindowConfigurer workbenchWindowConfigurer) { + return new WorkbenchWindowAdvisor(workbenchWindowConfigurer) { + public void preWindowOpen() { + super.preWindowOpen(); + getWindowConfigurer().setShowMenuBar(false); + getWindowConfigurer().setShowCoolBar(true); + getWindowConfigurer().setShowPerspectiveBar(true); + } + }; + } + + public void eventLoopIdle(Display disp) { + IWorkbenchWindow activeWorkbenchWindow = getWorkbenchConfigurer() + .getWorkbench().getActiveWorkbenchWindow(); + CoolBar coolBar = ((WorkbenchWindow) activeWorkbenchWindow) + .getCoolBarManager().getControl(); + // make sure we are in the expected state (nobody has + // contributed anything to the coolbar) + assertEquals("this test assumes that the coolbar is empty", 0, + coolBar.getItemCount()); + // the test itself + if (!coolBar.isVisible()) { + // all is fine + } else { + assertTrue( + "height of empty coolbar should not be greater than 16, but is " + + coolBar.getBounds().height, coolBar + .getBounds().height <= 16); + } + super.eventLoopIdle(disp); + } + + public void eventLoopException(Throwable exception) { + throw new WrappedException(exception); + } + }; + + try { + int code = PlatformUI.createAndRunWorkbench(display, wa); + assertEquals(PlatformUI.RETURN_OK, code); + } catch (WrappedException wrappedException) { + if (wrappedException.throwable instanceof WrappedException) { + wrappedException = (WrappedException) wrappedException.throwable; + } + throw wrappedException.throwable; + } + } } Index: META-INF/MANIFEST.MF =================================================================== RCS file: /home/eclipse/org.eclipse.ui.tests.rcp/META-INF/MANIFEST.MF,v retrieving revision 1.2 diff -u -r1.2 MANIFEST.MF --- META-INF/MANIFEST.MF 21 Jul 2005 18:18:01 -0000 1.2 +++ META-INF/MANIFEST.MF 26 Jul 2005 21:15:12 -0000 @@ -10,5 +10,6 @@ Require-Bundle: org.eclipse.core.runtime.compatibility, org.eclipse.ui, org.junit, - org.eclipse.test.performance + org.eclipse.test.performance, + org.eclipse.core.tests.harness Eclipse-AutoStart: true Index: Eclipse RCP Tests/org/eclipse/ui/tests/rcp/InnerRcpTestSuite.java =================================================================== RCS file: Eclipse RCP Tests/org/eclipse/ui/tests/rcp/InnerRcpTestSuite.java diff -N Eclipse RCP Tests/org/eclipse/ui/tests/rcp/InnerRcpTestSuite.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Eclipse RCP Tests/org/eclipse/ui/tests/rcp/InnerRcpTestSuite.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,26 @@ +package org.eclipse.ui.tests.rcp; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/* This is the main suite - it is run as a session test with + * access only to the minimal set of RCp plug-ins. To be run + * using RcpTestSuite. + */ +public class InnerRcpTestSuite extends TestSuite { + + public InnerRcpTestSuite() { + addTestSuite(PlatformUITest.class); + addTestSuite(WorkbenchAdvisorTest.class); + addTestSuite(WorkbenchConfigurerTest.class); + addTestSuite(WorkbenchWindowConfigurerTest.class); + addTestSuite(ActionBarConfigurerTest.class); + addTestSuite(IWorkbenchPageTest.class); + addTestSuite(WorkbenchSaveRestoreStateTest.class); + } + + public static Test suite() { + return new InnerRcpTestSuite(); + } + +}