Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2017-10-13 11:40:50 -0400
committerLaurent Redor2017-10-19 05:36:33 -0400
commitdf4bc0f8639cbeeda231a148c8838c1518e8f500 (patch)
tree442ebbb495f7cb35341fc98f6201e299b705d4c7
parentc4038d4c0ab468701f84d7c3fdac414a5e64ab6c (diff)
downloadorg.eclipse.sirius-df4bc0f8639cbeeda231a148c8838c1518e8f500.tar.gz
org.eclipse.sirius-df4bc0f8639cbeeda231a148c8838c1518e8f500.tar.xz
org.eclipse.sirius-df4bc0f8639cbeeda231a148c8838c1518e8f500.zip
[526017] Only report test added on master branch on 4.1.x branchv4.1.7
Bug: 526017 Change-Id: Ia459cd6f4a6e0bf8391bd15b8075602a67a3f87c Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/synchronization/UnsynchronizedMappingAndDeleteFromOutsideEditorTests.java32
1 files changed, 27 insertions, 5 deletions
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/synchronization/UnsynchronizedMappingAndDeleteFromOutsideEditorTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/synchronization/UnsynchronizedMappingAndDeleteFromOutsideEditorTests.java
index c58fb8c4db..bcd2b18dc7 100644
--- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/synchronization/UnsynchronizedMappingAndDeleteFromOutsideEditorTests.java
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/synchronization/UnsynchronizedMappingAndDeleteFromOutsideEditorTests.java
@@ -37,6 +37,8 @@ import org.eclipse.sirius.diagram.DNodeContainer;
import org.eclipse.sirius.diagram.DSemanticDiagram;
import org.eclipse.sirius.diagram.description.tool.ContainerDropDescription;
import org.eclipse.sirius.diagram.ui.tools.internal.actions.delete.DeleteFromDiagramAction;
+import org.eclipse.sirius.ecore.extender.business.api.permission.PermissionAuthorityRegistry;
+import org.eclipse.sirius.ecore.extender.business.internal.permission.ReadOnlyPermissionAuthority;
import org.eclipse.sirius.ecore.extender.tool.api.ModelUtils;
import org.eclipse.sirius.tests.SiriusTestsPlugin;
import org.eclipse.sirius.tests.support.api.EclipseTestsSupportHelper;
@@ -156,11 +158,31 @@ public class UnsynchronizedMappingAndDeleteFromOutsideEditorTests extends Sirius
assertFalse("The editMode of editPart which target the package p1InSubRoot must be disabled.", testedPackageEditPart.isEditModeEnabled());
// Check edit part for a DNode is decorated with a red cross
assertTrue("No deleted decorator found on editPart which target the package p1InSubRoot", new DeletedDecoratorMatcher().matches(testedPackageEditPart));
- // Launch a manual refresh and check again the number of diagram
- // elements
- refresh(diagram);
- assertFalse("At least one error occurs during the manual refresh.", doesAnErrorOccurs());
- assertEquals("The diagram should only contain elements that are not deleted.", 2, diagram.getOwnedDiagramElements().size());
+ // The behind checks are done only if we are not in read only mode
+ if (PermissionAuthorityRegistry.getDefault().getPermissionAuthority(diagram).canEditInstance(diagram)) {
+ // Launch a manual refresh and check again the number of diagram
+ // elements
+ refresh(diagram);
+ assertFalse("At least one error occurs during the manual refresh.", doesAnErrorOccurs());
+ assertEquals("The diagram should only contain elements that are not deleted.", 2, diagram.getOwnedDiagramElements().size());
+ }
+ }
+
+ /**
+ * Checks that the behavior is OK in manual refresh for DDiagramElement with
+ * mapping unsynchronized and whose target is a semantic that was deleted
+ * outside of the diagram (in read only mode).
+ *
+ * @throws Exception
+ * In case of problem during semantic modification outside the
+ * editor.
+ */
+ public void testRefreshOfNotSynchroMapping_ManualRefresh_WithReadOnlyPermissionEnabled() throws Exception {
+ // activate the ReadOnlyPermission Authority on the representation
+ assertTrue("The current editor should be a DialectEditor.", editor instanceof DialectEditor);
+ DialectEditor dialectEditor = (DialectEditor) editor;
+ ((ReadOnlyPermissionAuthority) PermissionAuthorityRegistry.getDefault().getPermissionAuthority(dialectEditor.getRepresentation())).activate();
+ testRefreshOfNotSynchroMapping_ManualRefresh();
}
/**

Back to the top