Bug 327933 Unrendering container with invalid selectedElement can cause target element to be unrendered
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java
partStack.setSelectedElement(partB);
		assertNotNull(partA.getWidget());
		assertNotNull(partB.getWidget());
		application.getContext().get(IPresentationEngine.class)
				.removeGui(sashContainer);
		assertEquals(partB, partStack.getSelectedElement());
	}
	public void testBug322701() {
		MApplication application = ApplicationFactoryImpl.eINSTANCE
				.createApplication();
		MWindow window = BasicFactoryImpl.eINSTANCE.createWindow();
		application.getChildren().add(window);
		application.setSelectedElement(window);
		MPartStack partStack = BasicFactoryImpl.eINSTANCE.createPartStack();
		window.getSharedElements().add(partStack);
		MPart part1 = BasicFactoryImpl.eINSTANCE.createPart();
		partStack.getChildren().add(part1);
		MPart part2 = BasicFactoryImpl.eINSTANCE.createPart();
		partStack.getChildren().add(part2);
		partStack.setSelectedElement(part2);
		MPerspectiveStack perspectiveStack = AdvancedFactoryImpl.eINSTANCE
				.createPerspectiveStack();
		window.getChildren().add(perspectiveStack);
		window.setSelectedElement(perspectiveStack);
		MPerspective perspectiveA = AdvancedFactoryImpl.eINSTANCE
				.createPerspective();
		perspectiveStack.getChildren().add(perspectiveA);
		perspectiveStack.setSelectedElement(perspectiveA);
		MPlaceholder placeholderA = AdvancedFactoryImpl.eINSTANCE
				.createPlaceholder();