Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 14272 Details for
Bug 72060
[Presentations] Improve workbench placeholders
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
org.eclipse.ui.tests
org.eclipse.ui.tests.txt (text/plain), 39.04 KB, created by
Cory Turner
on 2004-08-30 16:35:50 EDT
(
hide
)
Description:
org.eclipse.ui.tests
Filename:
MIME Type:
Creator:
Cory Turner
Created:
2004-08-30 16:35:50 EDT
Size:
39.04 KB
patch
obsolete
>Index: plugin.xml >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.tests/plugin.xml,v >retrieving revision 1.94 >diff -u -r1.94 plugin.xml >--- plugin.xml 25 Aug 2004 15:47:33 -0000 1.94 >+++ plugin.xml 30 Aug 2004 20:10:58 -0000 >@@ -22,6 +22,7 @@ > <import plugin="org.eclipse.ui.views"/> > <import plugin="org.eclipse.text"/> > <import plugin="org.eclipse.jface.text"/> >+ <import plugin="org.eclipse.test.performance"/> > </requires> > > >@@ -61,7 +62,23 @@ > icon="icons/anything.gif" > class="org.eclipse.ui.tests.api.ViewPerspective" > id="org.eclipse.ui.tests.api.ViewPerspective"> >+ </perspective> >+ <perspective >+ name="Placeholder Test Perspective" >+ icon="icons/anything.gif" >+ class="org.eclipse.ui.tests.placeholders.PlaceholderPerspectiveFactory" >+ id="org.eclipse.ui.tests.placeholders.placeholder"> >+ </perspective> >+ <perspective >+ name="Placeholder Test Sandbox Perspective" >+ icon="icons/anything.gif" >+ class="org.eclipse.ui.tests.placeholders.PlaceholderPerspectiveFactory" >+ id="org.eclipse.ui.tests.placeholders.placeholderSandbox"> > </perspective> >+ <perspective >+ class="org.eclipse.ui.tests.dnd.RecursiveStackingPerspectiveFactory" >+ name="Recursive stacking test perspective" >+ id="org.eclipse.ui.tests.recursiveStackingPerspective"/> > </extension> > <!-- Utils End --> > <extension >Index: Eclipse UI Tests/org/eclipse/ui/tests/UiTestSuite.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/UiTestSuite.java,v >retrieving revision 1.34 >diff -u -r1.34 UiTestSuite.java >--- Eclipse UI Tests/org/eclipse/ui/tests/UiTestSuite.java 24 Aug 2004 19:55:24 -0000 1.34 >+++ Eclipse UI Tests/org/eclipse/ui/tests/UiTestSuite.java 30 Aug 2004 20:10:58 -0000 >@@ -28,6 +28,7 @@ > import org.eclipse.ui.tests.menus.MenusTestSuite; > import org.eclipse.ui.tests.multipageeditor.MultiPageEditorTestSuite; > import org.eclipse.ui.tests.navigator.NavigatorTestSuite; >+import org.eclipse.ui.tests.placeholders.PlaceholderTestSuite; > import org.eclipse.ui.tests.preferences.PreferencesTestSuite; > import org.eclipse.ui.tests.presentations.PresentationsTestSuite; > import org.eclipse.ui.tests.propertysheet.PropertySheetTestSuite; >@@ -74,6 +75,7 @@ > addTest(new ThemesTestSuite()); > addTest(new IntroTestSuite()); > addTest(new MenusTestSuite()); >+ addTest(new PlaceholderTestSuite()); > addTest(new PresentationsTestSuite()); > } > } >Index: Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPageTest.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPageTest.java,v >retrieving revision 1.48 >diff -u -r1.48 IWorkbenchPageTest.java >--- Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPageTest.java 23 Aug 2004 19:13:43 -0000 1.48 >+++ Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPageTest.java 30 Aug 2004 20:10:59 -0000 >@@ -1337,29 +1337,33 @@ > > } > >- /** >- * Test opening a perspective with placeholders for multi instance views. >- * The placeholders are added at top level (not in any folder). >- * >- * @since 3.1 >- */ >- public void testOpenPerspectiveWithMultiViewPlaceholdersAtTopLevel() { >- WorkbenchPage page = (WorkbenchPage) fActivePage; >- >- try { >- fWin.getWorkbench().showPerspective( >- PerspectiveWithMultiViewPlaceholdersAtTopLevel.PERSP_ID, fWin); >- } catch (WorkbenchException e) { >- fail("Unexpected WorkbenchException: " + e); >- } >- >- PerspectiveState state = new PerspectiveState(page); >- ArrayList partIds = state.getPartIds(null); >- assertTrue(partIds.contains("*")); >- assertTrue(partIds.contains(MockViewPart.IDMULT)); >- assertTrue(partIds.contains(MockViewPart.IDMULT + ":secondaryId")); >- assertTrue(partIds.contains(MockViewPart.IDMULT + ":*")); >- } >+// Test is no longer valid with new style placeholders since there are >+// never any placeholders outside of a stack. >+// >+// /** >+// * Test opening a perspective with placeholders for multi instance views. >+// * The placeholders are added at top level (not in any folder). >+// * >+// * @since 3.1 >+// */ >+// public void testOpenPerspectiveWithMultiViewPlaceholdersAtTopLevel() { >+// WorkbenchPage page = (WorkbenchPage) fActivePage; >+// >+// try { >+// fWin.getWorkbench().showPerspective( >+// PerspectiveWithMultiViewPlaceholdersAtTopLevel.PERSP_ID, fWin); >+// } catch (WorkbenchException e) { >+// fail("Unexpected WorkbenchException: " + e); >+// } >+// >+// PerspectiveState state = new PerspectiveState(page); >+// ArrayList partIds = state.getPartIds(null); >+// >+// assertTrue(partIds.contains("*")); >+// assertTrue(partIds.contains(MockViewPart.IDMULT)); >+// assertTrue(partIds.contains(MockViewPart.IDMULT + ":secondaryId")); >+// assertTrue(partIds.contains(MockViewPart.IDMULT + ":*")); >+// } > > /** > * Test opening a perspective with placeholders for multi instance views. >Index: Eclipse UI Tests/org/eclipse/ui/tests/presentations/Bug48589Test.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/presentations/Bug48589Test.java,v >retrieving revision 1.1 >diff -u -r1.1 Bug48589Test.java >--- Eclipse UI Tests/org/eclipse/ui/tests/presentations/Bug48589Test.java 24 Aug 2004 19:55:24 -0000 1.1 >+++ Eclipse UI Tests/org/eclipse/ui/tests/presentations/Bug48589Test.java 30 Aug 2004 20:10:59 -0000 >@@ -20,7 +20,6 @@ > import org.eclipse.core.runtime.CoreException; > import org.eclipse.swt.custom.CTabFolder; > import org.eclipse.swt.custom.CTabItem; >-import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.ide.IDE; > import org.eclipse.ui.internal.EditorSashContainer; >Index: Eclipse UI Tests/org/eclipse/ui/tests/zoom/ZoomTestCase.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ZoomTestCase.java,v >retrieving revision 1.14 >diff -u -r1.14 ZoomTestCase.java >--- Eclipse UI Tests/org/eclipse/ui/tests/zoom/ZoomTestCase.java 8 Jul 2004 20:03:53 -0000 1.14 >+++ Eclipse UI Tests/org/eclipse/ui/tests/zoom/ZoomTestCase.java 30 Aug 2004 20:10:59 -0000 >@@ -120,7 +120,7 @@ > IViewPart view = page.showView(id); > IViewReference ref = (IViewReference) page.getReference(view); > if (page.isFastView(ref)) >- page.removeFastView(ref); >+ page.reattachFastView(ref); > return view; > } catch (PartInitException e) { > } >Index: Eclipse UI Tests/org/eclipse/ui/tests/dnd/RecursiveStackingPerspectiveFactory.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/dnd/RecursiveStackingPerspectiveFactory.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/dnd/RecursiveStackingPerspectiveFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/dnd/RecursiveStackingPerspectiveFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,29 @@ >+/* >+ * Created on Aug 19, 2004 >+ * >+ * TODO To change the template for this generated file go to >+ * Window - Preferences - Java - Code Style - Code Templates >+ */ >+package org.eclipse.ui.tests.dnd; >+ >+import org.eclipse.ui.IFolderLayout; >+import org.eclipse.ui.IPageLayout; >+import org.eclipse.ui.IPerspectiveFactory; >+ >+/** >+ */ >+public class RecursiveStackingPerspectiveFactory implements IPerspectiveFactory { >+ >+ public static final String FOLDER_ID = "org.eclipse.ui.test.dnd.RecursiveStackingPerspectiveFactory.mystack"; >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout) >+ */ >+ public void createInitialLayout(IPageLayout layout) { >+ >+ IFolderLayout folder = layout.createFolder(FOLDER_ID, >+ IPageLayout.BOTTOM, 0.5f, IPageLayout.ID_EDITOR_AREA); >+ folder.addView(IPageLayout.ID_OUTLINE); >+ } >+ >+} >Index: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/DetachDockTest.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/DetachDockTest.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/placeholders/DetachDockTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/placeholders/DetachDockTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,68 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.tests.placeholders; >+ >+import org.eclipse.ui.tests.dnd.AbstractTestDropTarget; >+import org.eclipse.ui.tests.dnd.DragOperations; >+ >+/** >+ * THIS TEST DOES NOTHING RIGHT NOW. >+ * >+ * When detach/dock operations have API, this can be implemented through the >+ * internalTest method. >+ * >+ * Tests a single detach view / dock view scenario. Given a view and a dropTarget. >+ * The dropTargets are to test placeholder consistancy in several different >+ * view states, such as "fast" or "detached". PlaceholderTestSuite generates >+ * several of these tests with different dropTargets. >+ * >+ * Test names indentify which view is being operated on and the dropTarget >+ * to which it has been moved (if it has been moved). >+ * >+ * IF THIS TEST FAILS: >+ * See DragTest documentation for how to interpret layout description strings. >+ **/ >+ >+public class DetachDockTest extends PlaceholderTestOperation { >+ >+ public DetachDockTest(String target) { >+ super("detching/docking view " + target); >+ this.target = target; >+ this.drop = null; >+ >+ } >+ >+ public DetachDockTest(String target, AbstractTestDropTarget drop){ >+ super("detaching/docking view " + target + " after moving to " + drop.toString()); >+ this.target = target; >+ this.drop = drop; >+ } >+ >+ >+ >+ public void internalTest(String ID) throws Exception { >+ >+ if((dragSource != null) && (drop != null)){ >+ page.showView(ID); >+ dragSource.setPage(page); >+ dragSource.drag(drop); >+ } >+ setExpectedResult(DragOperations.getLayoutDescription(page)); >+ >+ >+ //can't do this test until docking code is in place >+ //IViewPart part = page.findView(ID); >+ //ViewPane pane = (ViewPane)((PartSite)part.getSite()).getPane() >+ >+ } >+ >+ >+} >Index: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/FastUnfastTest.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/FastUnfastTest.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/placeholders/FastUnfastTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/placeholders/FastUnfastTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,99 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.tests.placeholders; >+ >+import org.eclipse.ui.IPerspectiveDescriptor; >+import org.eclipse.ui.IPerspectiveRegistry; >+import org.eclipse.ui.IViewPart; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.PartSite; >+import org.eclipse.ui.internal.ViewPane; >+import org.eclipse.ui.internal.WorkbenchPage; >+import org.eclipse.ui.tests.dnd.AbstractTestDropTarget; >+import org.eclipse.ui.tests.dnd.DragOperations; >+ >+/** >+ * Tests a single fast view / unfast view scenario. Given a view and a dropTarget. >+ * The dropTargets are to test placeholder consistancy in several different >+ * view states, such as "fast" or "detached". PlaceholderTestSuite generates >+ * several of these tests with different dropTargets. >+ * >+ * Test names indentify which view is being operated on and the dropTarget >+ * to which it has been moved (if it has been moved). >+ * >+ * IF THIS TEST FAILS: >+ * See DragTest documentation for how to interpret layout description strings. >+ **/ >+ >+public class FastUnfastTest extends PlaceholderTestOperation { >+ >+ public FastUnfastTest(String target, boolean withSaveState) { >+ super("addfast then removefast on " + target + " savestate " + withSaveState); >+ this.target = target; >+ this.drop = null; >+ this.withSaveState = withSaveState; >+ >+ } >+ >+ public FastUnfastTest(String target, AbstractTestDropTarget drop, boolean withSaveState){ >+ super("addfast then removefast on " + target + " after moving to " >+ + drop.toString() + " savestate " + withSaveState); >+ this.target = target; >+ this.drop = drop; >+ this.withSaveState = withSaveState; >+ } >+ >+ >+ >+ public void internalTest(String ID) throws Exception { >+ >+ if((dragSource != null) && (drop != null)){ >+ page.showView(ID); >+ dragSource.setPage(page); >+ dragSource.drag(drop); >+ } >+ >+ //There is a case where the view is dragged to the fast bar before the test >+ //and thus fast/unfast isn't applicable and will fail. >+ if(page.isFastView(page.findViewReference(target))){ >+ setExpectedResult(DragOperations.getLayoutDescription(page)); >+ return; >+ } >+ >+ setExpectedResult(DragOperations.getLayoutDescription(page)); >+ >+ IViewPart part = page.findView(ID); >+ ViewPane pane = (ViewPane)((PartSite)part.getSite()).getPane(); >+ >+ page.addFastView(pane.getViewReference()); >+ if(withSaveState) { >+ IPerspectiveRegistry registry = PlatformUI.getWorkbench() >+ .getPerspectiveRegistry(); >+ IPerspectiveDescriptor pd = registry.findPerspectiveWithId >+ ("org.eclipse.ui.tests.placeholders.placeholderSandbox"); >+ page.savePerspectiveAs(pd); >+ page.close(); >+ page = (WorkbenchPage) PlatformUI.getWorkbench().showPerspective( >+ "org.eclipse.ui.tests.placeholders.placeholder", window); >+ page.setPerspective(pd); >+ } >+ >+ part = page.findView(ID); >+ pane = (ViewPane)((PartSite)part.getSite()).getPane(); >+ >+ page.reattachFastView(pane.getViewReference()); >+ if(target != null) >+ page.showView(target); >+ >+ } >+ >+ >+} >Index: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PerspectiveSwitchTest.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PerspectiveSwitchTest.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PerspectiveSwitchTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PerspectiveSwitchTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,90 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.tests.placeholders; >+ >+/** >+ * Tests a single switch perspective / switch back scenario. Given a view and a dropTarget. >+ * The dropTargets are to test placeholder consistancy in several different >+ * view states, such as "fast" or "detached". PlaceholderTestSuite generates >+ * several of these tests with different dropTargets. >+ * >+ * Test names indentify which view is being operated on and the dropTarget >+ * to which it has been moved (if it has been moved). >+ * >+ * IF THIS TEST FAILS: >+ * See DragTest documentation for how to interpret layout description strings. >+ **/ >+ >+import org.eclipse.ui.IPageLayout; >+import org.eclipse.ui.IPerspectiveDescriptor; >+import org.eclipse.ui.IPerspectiveRegistry; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.WorkbenchPage; >+import org.eclipse.ui.tests.dnd.AbstractTestDropTarget; >+import org.eclipse.ui.tests.dnd.DragOperations; >+ >+ >+public class PerspectiveSwitchTest extends PlaceholderTestOperation { >+ >+ public PerspectiveSwitchTest(String target, boolean withSaveState) { >+ super("Switching perspectives and back again" + " savestate " + withSaveState); >+ this.target = target; >+ this.withSaveState = withSaveState; >+ } >+ >+ public PerspectiveSwitchTest(String target, AbstractTestDropTarget drop, boolean withSaveState) { >+ super("Switching perspectives and back again after moving " + target >+ + " to " + drop.toString() + " savestate " + withSaveState); >+ this.target = target; >+ this.drop = drop; >+ this.withSaveState = withSaveState; >+ } >+ >+ public void internalTest(String ID) throws Exception { >+ >+ if((dragSource != null) && (drop != null)){ >+ page.showView(ID); >+ dragSource.setPage(page); >+ dragSource.drag(drop); >+ } >+ setExpectedResult(DragOperations.getLayoutDescription(page)); >+ IPerspectiveRegistry registry = PlatformUI.getWorkbench() >+ .getPerspectiveRegistry(); >+ IPerspectiveDescriptor pd = registry.findPerspectiveWithId >+ ("org.eclipse.ui.tests.placeholders.placeholderSandbox"); >+ >+ if(withSaveState) { >+ page.savePerspectiveAs(pd); >+ page.close(); >+ page = (WorkbenchPage) PlatformUI.getWorkbench().showPerspective( >+ "org.eclipse.ui.tests.placeholders.placeholder", window); >+ } >+ else { >+ pd = registry.findPerspectiveWithId >+ ("org.eclipse.ui.tests.placeholders.placeholder"); >+ } >+ >+ PlatformUI.getWorkbench().showPerspective( >+ "org.eclipse.jdt.ui.JavaPerspective", window); >+ >+ page.setPerspective(pd); >+ >+// PlatformUI.getWorkbench().showPerspective( >+// "org.eclipse.ui.tests.placeholders.placeholder", window); >+ if(page.isFastView(page.findViewReference(target))){ >+ page.activate(page.findView(IPageLayout.ID_OUTLINE)); >+ } >+ else{ >+ page.activate(page.findView(target)); >+ } >+ } >+ >+} >Index: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PlaceholderPerspectiveFactory.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PlaceholderPerspectiveFactory.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PlaceholderPerspectiveFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PlaceholderPerspectiveFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,46 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.tests.placeholders; >+ >+import org.eclipse.ui.IFolderLayout; >+import org.eclipse.ui.IPageLayout; >+import org.eclipse.ui.IPerspectiveFactory; >+ >+public class PlaceholderPerspectiveFactory implements IPerspectiveFactory { >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout) >+ */ >+ public String WILD_CARD = "*"; >+ >+ public void createInitialLayout(IPageLayout layout) { >+ String folderId = "org.eclipse.ui.tests.placeholders.stack"; >+ >+ IFolderLayout folder = layout.createFolder(folderId, >+ IPageLayout.BOTTOM, 0.5f, IPageLayout.ID_EDITOR_AREA); >+ folder.addView(IPageLayout.ID_OUTLINE); >+ folder.addView(IPageLayout.ID_PROBLEM_VIEW); >+ folder.addView(IPageLayout.ID_PROP_SHEET); >+ >+ layout.addView(IPageLayout.ID_RES_NAV, IPageLayout.LEFT, 0.5f, >+ IPageLayout.ID_EDITOR_AREA); >+ layout.addPlaceholder("org.eclipse.ui.tests.api.MockViewPartMult:1", >+ IPageLayout.LEFT, 0.5f, IPageLayout.ID_EDITOR_AREA); >+ layout.addPlaceholder("org.eclipse.ui.tests.api.MockViewPartMult:*", >+ IPageLayout.RIGHT, 0.5f, IPageLayout.ID_EDITOR_AREA); >+ /*layout.addView("org.eclipse.ui.tests.api.MockViewPartMult", IPageLayout.LEFT, 0.5f, >+ IPageLayout.ID_EDITOR_AREA); >+ layout.addView("org.eclipse.ui.tests.api.MockViewPartMult", IPageLayout.RIGHT, 0.5f, >+ IPageLayout.ID_EDITOR_AREA); >+ */ >+ } >+ >+} >Index: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PlaceholderTestOperation.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PlaceholderTestOperation.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PlaceholderTestOperation.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PlaceholderTestOperation.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,106 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.tests.placeholders; >+ >+import junit.framework.Assert; >+ >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.ui.IPageLayout; >+import org.eclipse.ui.IPerspectiveDescriptor; >+import org.eclipse.ui.IPerspectiveRegistry; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.WorkbenchPage; >+import org.eclipse.ui.internal.WorkbenchWindow; >+import org.eclipse.ui.tests.dnd.AbstractTestDropTarget; >+import org.eclipse.ui.tests.dnd.DragOperations; >+import org.eclipse.ui.tests.dnd.TestDragSource; >+import org.eclipse.ui.tests.dnd.ViewDragSource; >+import org.eclipse.ui.tests.util.UITestCase; >+ >+/** >+ * Abstract test operation from which all placeholder tests are >+ * derived. >+ */ >+public abstract class PlaceholderTestOperation extends UITestCase { >+ >+ String intendedResult; >+ String target; >+ static WorkbenchWindow window; >+ static WorkbenchPage page; >+ TestDragSource dragSource; >+ AbstractTestDropTarget drop; >+ String initialLayout; >+ boolean withSaveState; >+ >+ public PlaceholderTestOperation(String testName) { >+ super(testName); >+ } >+ >+ public void doSetUp() throws Exception { >+ manageWindows(false); >+ window = (WorkbenchWindow)fWorkbench.getActiveWorkbenchWindow(); >+ if(window == null) { >+ window = (WorkbenchWindow) fWorkbench.openWorkbenchWindow( >+ "org.eclipse.ui.tests.placeholders.placeholder", ResourcesPlugin >+ .getWorkspace()); >+ } >+ >+ page = (WorkbenchPage) window.getActivePage(); >+ IPerspectiveRegistry registry = PlatformUI.getWorkbench() >+ .getPerspectiveRegistry(); >+ IPerspectiveDescriptor pd = registry.findPerspectiveWithId >+ ("org.eclipse.ui.tests.placeholders.placeholder"); >+ page.setPerspective(pd); >+ page.resetPerspective(); >+ page.closeAllEditors(false); >+ page.showView(IPageLayout.ID_OUTLINE); >+ page.hideView(page.findView("org.eclipse.ui.internal.introview")); >+ page.showView("org.eclipse.ui.tests.api.MockViewPartMult","1", >+ WorkbenchPage.VIEW_ACTIVATE); >+ page.showView("org.eclipse.ui.tests.api.MockViewPartMult","*", >+ WorkbenchPage.VIEW_ACTIVATE); >+ page.showView(IPageLayout.ID_OUTLINE); >+ if(target != null){ >+ //ensure that target is the focus part (and at the top of its stack) >+ page.showView(target); >+ } >+ >+ >+ } >+ >+ public void setExpectedResult(String intended) { >+ intendedResult = intended; >+ } >+ >+ protected void runTest() throws Throwable { >+ if(drop != null ){ >+ this.dragSource = new ViewDragSource(target, false); >+ } >+ internalTest(target); >+ String resultingLayout = DragOperations.getLayoutDescription(page); >+ if (intendedResult != null) { >+ if (!resultingLayout.equals(intendedResult)) { >+ String errorMessage = "Expecting '" + intendedResult >+ + "' and found '" + resultingLayout + "'"; >+ >+ System.out.println("Failed " + getName() + ": " + errorMessage); >+ >+ Assert.assertEquals( >+ "Placeholder test operation resulted in incorrect layout", >+ intendedResult, resultingLayout); >+ } >+ } >+ >+ page.getActivePerspective().testInvariants(); >+ } >+ >+ public abstract void internalTest(String target) throws Exception; >+} >Index: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PlaceholderTestSuite.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PlaceholderTestSuite.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PlaceholderTestSuite.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/placeholders/PlaceholderTestSuite.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,103 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.tests.placeholders; >+ >+import org.eclipse.swt.SWT; >+import org.eclipse.ui.IPageLayout; >+import org.eclipse.ui.tests.dnd.AbstractTestDropTarget; >+import org.eclipse.ui.tests.dnd.DetachedDropTarget; >+import org.eclipse.ui.tests.dnd.FastViewBarDropTarget; >+import org.eclipse.ui.tests.dnd.ViewDropTarget; >+import org.eclipse.ui.tests.dnd.WindowDropTarget; >+ >+import junit.framework.Test; >+import junit.framework.TestSuite; >+ >+ >+public class PlaceholderTestSuite extends TestSuite { >+ >+ /** >+ * Returns the suite. This is required to use the JUnit Launcher. >+ */ >+ public static Test suite() { >+ return new PlaceholderTestSuite(); >+ } >+ >+ public PlaceholderTestSuite() { >+ >+ //the test view is 3rd in a folder, and a multi instance view >+ String[] targets = {IPageLayout.ID_PROP_SHEET, >+ "org.eclipse.ui.tests.api.MockViewPartMult" >+ }; >+ >+ //the drop targets >+ AbstractTestDropTarget[] dragTargets = new AbstractTestDropTarget[] { >+ //test for proper restore when dropped onto a stack >+ new ViewDropTarget(IPageLayout.ID_RES_NAV, SWT.TOP), >+ //test for proper restore when dropped to right of stack >+ new ViewDropTarget(IPageLayout.ID_RES_NAV, SWT.RIGHT), >+ //test for proper container upon restore >+ new WindowDropTarget(SWT.RIGHT), >+ //test for proper restore upon removefastview >+ new FastViewBarDropTarget(), >+ //test for proper windowupon restore >+ new DetachedDropTarget()}; >+ >+ addCombinations(targets, dragTargets); >+ >+ } >+ >+ private void addCombinations(String[] targets, AbstractTestDropTarget[] drops){ >+ for(int i = 0; i < targets.length; i++){ >+ //add the normal case, no movement >+ PlaceholderTestOperation t; >+ t = new ReopenTest(targets[i], false); >+ addTest(t); >+ t = new FastUnfastTest(targets[i], false); >+ addTest(t); >+ t = new PerspectiveSwitchTest(targets[i], false); >+ addTest(t); >+ t = new ReopenTest(targets[i], true); >+ addTest(t); >+ t = new FastUnfastTest(targets[i], true); >+ addTest(t); >+ t = new PerspectiveSwitchTest(targets[i], true); >+ addTest(t); >+ t = new SaveStateTest(targets[i]); >+ addTest(t); >+ //t = new DetachDockTest(targets[i]); >+ //addTest(t); >+ >+ >+ //move the view to each of the drop targets and try to close/restore it >+ for(int j = 0; j < drops.length; j++){ >+ t = new ReopenTest(targets[i], drops[j], false); >+ addTest(t); >+ t = new FastUnfastTest(targets[i], drops[j], false); >+ addTest(t); >+ t = new PerspectiveSwitchTest(targets[i], drops[j], false); >+ addTest(t); >+ t = new ReopenTest(targets[i], drops[j], true); >+ addTest(t); >+ t = new FastUnfastTest(targets[i], drops[j], true); >+ addTest(t); >+ t = new PerspectiveSwitchTest(targets[i], drops[j], true); >+ addTest(t); >+ t = new SaveStateTest(targets[i], drops[j]); >+ addTest(t); >+ //t = new DetachDockTest(targets[i], drops[j]); >+ //addTest(t); >+ } >+ } >+ } >+ >+ >+} >Index: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/ReopenTest.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/ReopenTest.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/placeholders/ReopenTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/placeholders/ReopenTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,91 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.tests.placeholders; >+ >+import org.eclipse.ui.IPageLayout; >+import org.eclipse.ui.IPerspectiveDescriptor; >+import org.eclipse.ui.IPerspectiveRegistry; >+import org.eclipse.ui.IViewPart; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.PartSite; >+import org.eclipse.ui.internal.ViewPane; >+import org.eclipse.ui.internal.WorkbenchPage; >+import org.eclipse.ui.tests.dnd.AbstractTestDropTarget; >+import org.eclipse.ui.tests.dnd.DragOperations; >+ >+/** >+ * Tests a single close view / open view scenario. Given a view and a dropTarget. >+ * The dropTargets are to test placeholder consistancy in several different >+ * view states, such as "fast" or "detached". PlaceholderTestSuite generates >+ * several of these tests with different dropTargets. >+ * >+ * Test names indentify which view is being operated on and the dropTarget >+ * to which it has been moved (if it has been moved). >+ * >+ * IF THIS TEST FAILS: >+ * See DragTest documentation for how to interpret layout description strings. >+ **/ >+ >+public class ReopenTest extends PlaceholderTestOperation { >+ >+ public ReopenTest(String target, boolean withSaveState) { >+ super("Closing and opening view starting with id: " + target + " savestate " + withSaveState); >+ this.target = target; >+ this.drop = null; >+ this.withSaveState = withSaveState; >+ >+ } >+ >+ public ReopenTest(String target, AbstractTestDropTarget drop, boolean withSaveState){ >+ super("Closing and opening view starting with id: " + target >+ + " after moving to " + drop.toString() + " savestate " + withSaveState); >+ this.target = target; >+ this.drop = drop; >+ this.withSaveState = withSaveState; >+ } >+ >+ >+ >+ public void internalTest(String ID) throws Exception { >+ >+ if((dragSource != null) && (drop != null)){ >+ page.showView(ID); >+ dragSource.setPage(page); >+ dragSource.drag(drop); >+ } >+ setExpectedResult(DragOperations.getLayoutDescription(page)); >+ >+ IViewPart part = page.findView(ID); >+ ViewPane pane = (ViewPane)((PartSite)part.getSite()).getPane(); >+ page.hideView(part); >+ if(withSaveState) { >+ IPerspectiveRegistry registry = PlatformUI.getWorkbench() >+ .getPerspectiveRegistry(); >+ IPerspectiveDescriptor pd = registry.findPerspectiveWithId >+ ("org.eclipse.ui.tests.placeholders.placeholderSandbox"); >+ page.savePerspectiveAs(pd); >+ page.close(); >+ page = (WorkbenchPage) PlatformUI.getWorkbench().showPerspective( >+ "org.eclipse.ui.tests.placeholders.placeholder", window); >+ page.setPerspective(pd); >+ } >+ page.showView(ID); >+ if(page.isFastView(page.findViewReference(target))){ >+ page.activate(page.findView(IPageLayout.ID_OUTLINE)); >+ } >+ else{ >+ page.activate(page.findView(target)); >+ } >+ >+ } >+ >+ >+} >Index: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/SaveStateTest.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/placeholders/SaveStateTest.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/placeholders/SaveStateTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/placeholders/SaveStateTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,75 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.tests.placeholders; >+ >+import org.eclipse.ui.IPageLayout; >+import org.eclipse.ui.IPerspectiveDescriptor; >+import org.eclipse.ui.IPerspectiveRegistry; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.WorkbenchPage; >+import org.eclipse.ui.tests.dnd.AbstractTestDropTarget; >+import org.eclipse.ui.tests.dnd.DragOperations; >+ >+/** >+ * Tests a single close workbench / open workbench scenario. Given a view and a >+ * dropTarget. The dropTargets are to test placeholder consistancy in several >+ * different view states, such as "fast" or "detached". PlaceholderTestSuite >+ * generates several of these tests with different dropTargets. >+ * >+ * Test names indentify which view is being operated on and the dropTarget to >+ * which it has been moved (if it has been moved). >+ * >+ * IF THIS TEST FAILS: See DragTest documentation for how to interpret layout >+ * description strings. >+ */ >+ >+public class SaveStateTest extends PlaceholderTestOperation { >+ >+ public SaveStateTest(String target) { >+ super("Reopening the workbench"); >+ this.target = target; >+ } >+ >+ public SaveStateTest(String target, AbstractTestDropTarget drop) { >+ super("Reopening the workbench after moving " + target + " to " >+ + drop.toString()); >+ this.target = target; >+ this.drop = drop; >+ } >+ >+ public void internalTest(String ID) throws Exception { >+ >+ if ((dragSource != null) && (drop != null)) { >+ page.showView(ID); >+ dragSource.setPage(page); >+ dragSource.drag(drop); >+ } >+ setExpectedResult(DragOperations.getLayoutDescription(page)); >+ >+ IPerspectiveRegistry registry = PlatformUI.getWorkbench() >+ .getPerspectiveRegistry(); >+ IPerspectiveDescriptor pd = registry.findPerspectiveWithId >+ ("org.eclipse.ui.tests.placeholders.placeholderSandbox"); >+ >+ page.savePerspectiveAs(pd); >+ page.close(); >+ page = (WorkbenchPage) PlatformUI.getWorkbench().showPerspective( >+ "org.eclipse.ui.tests.placeholders.placeholder", window); >+ page.setPerspective(pd); >+ if(page.isFastView(page.findViewReference(target))){ >+ page.activate(page.findView(IPageLayout.ID_OUTLINE)); >+ } >+ else{ >+ page.activate(page.findView(target)); >+ } >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 72060
:
14271
| 14272