Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRolf Theunissen2019-04-14 15:20:06 -0400
committerLars Vogel2019-04-15 05:32:50 -0400
commitd63fece7b3bcd528c9eaa9efb54abdd3300b6ee5 (patch)
tree3d3402777dbe50da2231a828de9d8de1583211e2
parenta2f5b69e10bd59d681a208f0aca3052952155958 (diff)
downloadeclipse.platform.ui-d63fece7b3bcd528c9eaa9efb54abdd3300b6ee5.tar.gz
eclipse.platform.ui-d63fece7b3bcd528c9eaa9efb54abdd3300b6ee5.tar.xz
eclipse.platform.ui-d63fece7b3bcd528c9eaa9efb54abdd3300b6ee5.zip
Bug 377228 - Validate that View menu is hidden when closing part
As part of Bug 417960, the handling of the top-right area of the View stacks is majorly re-written. Adding test that this bug is no longer present. Change-Id: I5ca8697d08937e2599143f6990d9a7dc78c20534 Signed-off-by: Rolf Theunissen <rolf.theunissen@gmail.com>
-rw-r--r--tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java
index 682e2e1ace..01ca93be34 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java
@@ -44,6 +44,8 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar;
import org.eclipse.e4.ui.model.application.ui.basic.MTrimmedWindow;
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
+import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
import org.eclipse.e4.ui.model.application.ui.menu.MToolBar;
import org.eclipse.e4.ui.model.application.ui.menu.MToolControl;
import org.eclipse.e4.ui.workbench.IPresentationEngine;
@@ -52,13 +54,16 @@ import org.eclipse.e4.ui.workbench.addons.cleanupaddon.CleanupAddon;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer;
import org.eclipse.jface.databinding.swt.DisplayRealm;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.test.Screenshots;
import org.junit.After;
@@ -453,6 +458,51 @@ public class PartRenderingEngineTests {
}
@Test
+ public void testPartStack_ViewMenuHidenWhenPartsClosed_Bug377228() throws Exception {
+ MApplication application = ems.createModelElement(MApplication.class);
+ application.setContext(appContext);
+ appContext.set(MApplication.class, application);
+
+ MWindow window = ems.createModelElement(MWindow.class);
+ application.getChildren().add(window);
+
+ MPartStack stack = ems.createModelElement(MPartStack.class);
+ window.getChildren().add(stack);
+
+ MPart part = ems.createModelElement(MPart.class);
+ part.setContributionURI("bundleclass://org.eclipse.e4.ui.tests/org.eclipse.e4.ui.tests.workbench.SampleView");
+ stack.getChildren().add(part);
+
+ MMenu menu = ems.createModelElement(MMenu.class);
+ menu.getTags().add(StackRenderer.TAG_VIEW_MENU);
+ part.getMenus().add(menu);
+
+ MDirectMenuItem item = ems.createModelElement(MDirectMenuItem.class);
+ menu.getChildren().add(item);
+
+ wb = new E4Workbench(application, appContext);
+ wb.createAndRunUI(window);
+
+ CTabFolder folder = (CTabFolder) stack.getWidget();
+ Composite compA = (Composite) folder.getTopRight();
+ ToolBar toolbar = null;
+ for (Control child : compA.getChildren()) {
+ if (child.getData().equals(StackRenderer.TAG_VIEW_MENU)) {
+ toolbar = (ToolBar) child;
+ }
+ }
+ assertTrue(toolbar != null);
+
+ assertTrue(toolbar.getVisible());
+
+ EPartService partService = window.getContext().get(EPartService.class);
+ partService.hidePart(part, true);
+ spinEventLoop();
+
+ assertFalse(toolbar.getVisible());
+ }
+
+ @Test
public void testCreateGuiBug301021() throws Exception {
MApplication application = ems.createModelElement(MApplication.class);
application.setContext(appContext);

Back to the top