Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBelqassim Djafer2015-03-25 16:12:10 +0000
committerMaxime Porhel2015-04-28 13:29:14 +0000
commit18beb8f54ecdd846e2705c679b8186972ec31bcb (patch)
treec2f2cf848a35cb87b9070e6db4f6cc313cf55983
parent794bdc15f32d663940894dcb56a85c92562a72ad (diff)
downloadorg.eclipse.sirius-18beb8f54ecdd846e2705c679b8186972ec31bcb.tar.gz
org.eclipse.sirius-18beb8f54ecdd846e2705c679b8186972ec31bcb.tar.xz
org.eclipse.sirius-18beb8f54ecdd846e2705c679b8186972ec31bcb.zip
[462927] Add test for container children representation change
In a diagram representation, ensure that when we change container children presentation (from List to FreeForm or from FreeForm to List), the representation is correctly refreshed and that there is no error massage in the Error Log. Bug: 462927 Change-Id: Ic7b4dec84cc961b98a19127b72834c45ec6067bc Signed-off-by: Belqassim Djafer <belqassim.djafer@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/containerChildrenPresentationChange/462927.ecore9
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/containerChildrenPresentationChange/462927.odesign24
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/containerChildrenPresentationChange/representations.aird147
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ContainerChildrenPresentationChangeTest.java260
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java1
5 files changed, 441 insertions, 0 deletions
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/containerChildrenPresentationChange/462927.ecore b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/containerChildrenPresentationChange/462927.ecore
new file mode 100644
index 0000000000..994810de66
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/containerChildrenPresentationChange/462927.ecore
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="p">
+ <eClassifiers xsi:type="ecore:EClass" name="c">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="a" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EChar"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="b" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="d" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/containerChildrenPresentationChange/462927.odesign b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/containerChildrenPresentationChange/462927.odesign
new file mode 100644
index 0000000000..28f9b742a7
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/containerChildrenPresentationChange/462927.odesign
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<description:Group xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" name="462927" version="10.0.0.201411061000">
+ <ownedViewpoints name="462927" modelFileExtension="ecore">
+ <ownedRepresentations xsi:type="description_1:DiagramDescription" name="462927" domainClass="EPackage">
+ <defaultLayer name="Default">
+ <containerMappings name="462927" domainClass="EClass" childrenPresentation="List">
+ <subNodeMappings name="462927" semanticCandidatesExpression="feature:eAllContents" domainClass="EAttribute">
+ <style xsi:type="style:BundledImageDescription" resizeKind="NSEW">
+ <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='dark_blue']"/>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='blue']"/>
+ </style>
+ </subNodeMappings>
+ <style xsi:type="style:FlatContainerStyleDescription">
+ <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/>
+ <foregroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='light_gray']"/>
+ </style>
+ </containerMappings>
+ </defaultLayer>
+ </ownedRepresentations>
+ </ownedViewpoints>
+</description:Group>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/containerChildrenPresentationChange/representations.aird b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/containerChildrenPresentationChange/representations.aird
new file mode 100644
index 0000000000..96d4f778e7
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/containerChildrenPresentationChange/representations.aird
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<viewpoint:DAnalysis xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:diagram="http://www.eclipse.org/sirius/diagram/1.1.0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/style" xmi:id="_jOA_kNIKEeSfLcMM58f84w" selectedViews="_OOfC4NIQEeSo7eL3mRhkBg" version="10.0.10.201502231700">
+ <models xmi:type="ecore:EPackage" href="462927.ecore#/"/>
+ <ownedViews xmi:type="viewpoint:DRepresentationContainer" xmi:id="_OOfC4NIQEeSo7eL3mRhkBg" initialized="true">
+ <ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_fEQeANdyEeSDIdtqWD6YFA" name="new 462927 unsynchronized" synchronized="false">
+ <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_fERFENdyEeSDIdtqWD6YFA" source="DANNOTATION_CUSTOMIZATION_KEY">
+ <data xmi:type="diagram:ComputedStyleDescriptionRegistry" xmi:id="_fERFEddyEeSDIdtqWD6YFA"/>
+ </ownedAnnotationEntries>
+ <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_fERFG9dyEeSDIdtqWD6YFA" source="GMF_DIAGRAMS">
+ <data xmi:type="notation:Diagram" xmi:id="_fERFHNdyEeSDIdtqWD6YFA" type="Sirius" element="_fEQeANdyEeSDIdtqWD6YFA" measurementUnit="Pixel">
+ <children xmi:type="notation:Node" xmi:id="_fERsINdyEeSDIdtqWD6YFA" type="2003" element="_fERFEtdyEeSDIdtqWD6YFA">
+ <children xmi:type="notation:Node" xmi:id="_fESTMNdyEeSDIdtqWD6YFA" type="5007"/>
+ <children xmi:type="notation:Node" xmi:id="_fESTMddyEeSDIdtqWD6YFA" type="7004">
+ <children xmi:type="notation:Node" xmi:id="_fEThUNdyEeSDIdtqWD6YFA" type="3010" element="_fERFFNdyEeSDIdtqWD6YFA">
+ <styles xmi:type="notation:FontStyle" xmi:id="_fEThUddyEeSDIdtqWD6YFA" fontName="Segoe UI" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_fEThUtdyEeSDIdtqWD6YFA"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_fEThU9dyEeSDIdtqWD6YFA" type="3010" element="_fERFFtdyEeSDIdtqWD6YFA">
+ <styles xmi:type="notation:FontStyle" xmi:id="_fEThVNdyEeSDIdtqWD6YFA" fontName="Segoe UI" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_fEThVddyEeSDIdtqWD6YFA"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_fEUIYNdyEeSDIdtqWD6YFA" type="3010" element="_fERFGNdyEeSDIdtqWD6YFA">
+ <styles xmi:type="notation:FontStyle" xmi:id="_fEUIYddyEeSDIdtqWD6YFA" fontName="Segoe UI" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_fEUIYtdyEeSDIdtqWD6YFA"/>
+ </children>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_fES6QNdyEeSDIdtqWD6YFA"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_fES6QddyEeSDIdtqWD6YFA"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_fERsIddyEeSDIdtqWD6YFA" fontName="Segoe UI" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fERsItdyEeSDIdtqWD6YFA" x="180" y="60"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_fERFHddyEeSDIdtqWD6YFA"/>
+ </data>
+ </ownedAnnotationEntries>
+ <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_fERFEtdyEeSDIdtqWD6YFA" name="c">
+ <target xmi:type="ecore:EClass" href="462927.ecore#//c"/>
+ <semanticElements xmi:type="ecore:EClass" href="462927.ecore#//c"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_fERFE9dyEeSDIdtqWD6YFA">
+ <description xmi:type="style:FlatContainerStyleDescription" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:ContainerMapping" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']"/>
+ <ownedElements xmi:type="diagram:DNodeListElement" xmi:id="_fERFFNdyEeSDIdtqWD6YFA" name="a">
+ <target xmi:type="ecore:EAttribute" href="462927.ecore#//c/a"/>
+ <semanticElements xmi:type="ecore:EAttribute" href="462927.ecore#//c/a"/>
+ <ownedStyle xmi:type="diagram:BundledImage" xmi:id="_fERFFddyEeSDIdtqWD6YFA" borderColor="39,76,114" color="114,159,207">
+ <description xmi:type="style:BundledImageDescription" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']/@subNodeMappings[name='462927']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:NodeMapping" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']/@subNodeMappings[name='462927']"/>
+ </ownedElements>
+ <ownedElements xmi:type="diagram:DNodeListElement" xmi:id="_fERFFtdyEeSDIdtqWD6YFA" name="b">
+ <target xmi:type="ecore:EAttribute" href="462927.ecore#//c/b"/>
+ <semanticElements xmi:type="ecore:EAttribute" href="462927.ecore#//c/b"/>
+ <ownedStyle xmi:type="diagram:BundledImage" xmi:id="_fERFF9dyEeSDIdtqWD6YFA" borderColor="39,76,114" color="114,159,207">
+ <description xmi:type="style:BundledImageDescription" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']/@subNodeMappings[name='462927']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:NodeMapping" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']/@subNodeMappings[name='462927']"/>
+ </ownedElements>
+ <ownedElements xmi:type="diagram:DNodeListElement" xmi:id="_fERFGNdyEeSDIdtqWD6YFA" name="d">
+ <target xmi:type="ecore:EAttribute" href="462927.ecore#//c/d"/>
+ <semanticElements xmi:type="ecore:EAttribute" href="462927.ecore#//c/d"/>
+ <ownedStyle xmi:type="diagram:BundledImage" xmi:id="_fERFGddyEeSDIdtqWD6YFA" borderColor="39,76,114" color="114,159,207">
+ <description xmi:type="style:BundledImageDescription" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']/@subNodeMappings[name='462927']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:NodeMapping" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']/@subNodeMappings[name='462927']"/>
+ </ownedElements>
+ </ownedDiagramElements>
+ <description xmi:type="description_1:DiagramDescription" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']"/>
+ <filterVariableHistory xmi:type="diagram:FilterVariableHistory" xmi:id="_fERFGtdyEeSDIdtqWD6YFA"/>
+ <activatedLayers xmi:type="description_1:Layer" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer"/>
+ <target xmi:type="ecore:EPackage" href="462927.ecore#/"/>
+ </ownedRepresentations>
+ <ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_gVg3AN0DEeSoO4q3MsUg9A" name="new 462927 synchronized">
+ <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_gVg3Ad0DEeSoO4q3MsUg9A" source="DANNOTATION_CUSTOMIZATION_KEY">
+ <data xmi:type="diagram:ComputedStyleDescriptionRegistry" xmi:id="_gVg3At0DEeSoO4q3MsUg9A"/>
+ </ownedAnnotationEntries>
+ <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_gV1nIN0DEeSoO4q3MsUg9A" source="GMF_DIAGRAMS">
+ <data xmi:type="notation:Diagram" xmi:id="_gV1nId0DEeSoO4q3MsUg9A" type="Sirius" element="_gVg3AN0DEeSoO4q3MsUg9A" measurementUnit="Pixel">
+ <children xmi:type="notation:Node" xmi:id="_gWSTEN0DEeSoO4q3MsUg9A" type="2003" element="_gVg3A90DEeSoO4q3MsUg9A">
+ <children xmi:type="notation:Node" xmi:id="_gWoRUN0DEeSoO4q3MsUg9A" type="5007"/>
+ <children xmi:type="notation:Node" xmi:id="_gWtw4N0DEeSoO4q3MsUg9A" type="7004">
+ <children xmi:type="notation:Node" xmi:id="_gWzQcN0DEeSoO4q3MsUg9A" type="3010" element="_gVg3Bd0DEeSoO4q3MsUg9A">
+ <styles xmi:type="notation:FontStyle" xmi:id="_gWzQcd0DEeSoO4q3MsUg9A" fontName="Segoe UI" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_gWzQct0DEeSoO4q3MsUg9A"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_gWz3gN0DEeSoO4q3MsUg9A" type="3010" element="_gVg3B90DEeSoO4q3MsUg9A">
+ <styles xmi:type="notation:FontStyle" xmi:id="_gWz3gd0DEeSoO4q3MsUg9A" fontName="Segoe UI" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_gWz3gt0DEeSoO4q3MsUg9A"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_gW0ekN0DEeSoO4q3MsUg9A" type="3010" element="_gVg3Cd0DEeSoO4q3MsUg9A">
+ <styles xmi:type="notation:FontStyle" xmi:id="_gW0ekd0DEeSoO4q3MsUg9A" fontName="Segoe UI" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_gW0ekt0DEeSoO4q3MsUg9A"/>
+ </children>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_gWtw4d0DEeSoO4q3MsUg9A"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_gWtw4t0DEeSoO4q3MsUg9A"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_gWSTEd0DEeSoO4q3MsUg9A" fontName="Segoe UI" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_gWSTEt0DEeSoO4q3MsUg9A" x="180" y="70"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_gV1nIt0DEeSoO4q3MsUg9A"/>
+ </data>
+ </ownedAnnotationEntries>
+ <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_gVg3A90DEeSoO4q3MsUg9A" name="c">
+ <target xmi:type="ecore:EClass" href="462927.ecore#//c"/>
+ <semanticElements xmi:type="ecore:EClass" href="462927.ecore#//c"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_gVg3BN0DEeSoO4q3MsUg9A">
+ <description xmi:type="style:FlatContainerStyleDescription" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:ContainerMapping" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']"/>
+ <ownedElements xmi:type="diagram:DNodeListElement" xmi:id="_gVg3Bd0DEeSoO4q3MsUg9A" name="a">
+ <target xmi:type="ecore:EAttribute" href="462927.ecore#//c/a"/>
+ <semanticElements xmi:type="ecore:EAttribute" href="462927.ecore#//c/a"/>
+ <ownedStyle xmi:type="diagram:BundledImage" xmi:id="_gVg3Bt0DEeSoO4q3MsUg9A" borderColor="39,76,114" color="114,159,207">
+ <description xmi:type="style:BundledImageDescription" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']/@subNodeMappings[name='462927']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:NodeMapping" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']/@subNodeMappings[name='462927']"/>
+ </ownedElements>
+ <ownedElements xmi:type="diagram:DNodeListElement" xmi:id="_gVg3B90DEeSoO4q3MsUg9A" name="b">
+ <target xmi:type="ecore:EAttribute" href="462927.ecore#//c/b"/>
+ <semanticElements xmi:type="ecore:EAttribute" href="462927.ecore#//c/b"/>
+ <ownedStyle xmi:type="diagram:BundledImage" xmi:id="_gVg3CN0DEeSoO4q3MsUg9A" borderColor="39,76,114" color="114,159,207">
+ <description xmi:type="style:BundledImageDescription" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']/@subNodeMappings[name='462927']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:NodeMapping" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']/@subNodeMappings[name='462927']"/>
+ </ownedElements>
+ <ownedElements xmi:type="diagram:DNodeListElement" xmi:id="_gVg3Cd0DEeSoO4q3MsUg9A" name="d">
+ <target xmi:type="ecore:EAttribute" href="462927.ecore#//c/d"/>
+ <semanticElements xmi:type="ecore:EAttribute" href="462927.ecore#//c/d"/>
+ <ownedStyle xmi:type="diagram:BundledImage" xmi:id="_gVg3Ct0DEeSoO4q3MsUg9A" borderColor="39,76,114" color="114,159,207">
+ <description xmi:type="style:BundledImageDescription" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']/@subNodeMappings[name='462927']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:NodeMapping" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer/@containerMappings[name='462927']/@subNodeMappings[name='462927']"/>
+ </ownedElements>
+ </ownedDiagramElements>
+ <description xmi:type="description_1:DiagramDescription" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']"/>
+ <filterVariableHistory xmi:type="diagram:FilterVariableHistory" xmi:id="_gVg3C90DEeSoO4q3MsUg9A"/>
+ <activatedLayers xmi:type="description_1:Layer" href="462927.odesign#//@ownedViewpoints[name='462927']/@ownedRepresentations[name='462927']/@defaultLayer"/>
+ <target xmi:type="ecore:EPackage" href="462927.ecore#/"/>
+ </ownedRepresentations>
+ <viewpoint xmi:type="description:Viewpoint" href="462927.odesign#//@ownedViewpoints[name='462927']"/>
+ </ownedViews>
+</viewpoint:DAnalysis>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ContainerChildrenPresentationChangeTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ContainerChildrenPresentationChangeTest.java
new file mode 100644
index 0000000000..f6f468c57b
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ContainerChildrenPresentationChangeTest.java
@@ -0,0 +1,260 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.tests.swtbot;
+
+import org.eclipse.sirius.business.api.preferences.SiriusPreferencesKeys;
+import org.eclipse.sirius.diagram.ContainerLayout;
+import org.eclipse.sirius.diagram.DDiagram;
+import org.eclipse.sirius.diagram.business.api.query.DiagramElementMappingQuery;
+import org.eclipse.sirius.diagram.description.ContainerMapping;
+import org.eclipse.sirius.diagram.ui.internal.edit.parts.DNodeContainerEditPart;
+import org.eclipse.sirius.diagram.ui.internal.edit.parts.DNodeListEditPart;
+import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase;
+import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource;
+import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor;
+import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusHelper;
+import org.eclipse.sirius.tests.swtbot.support.utils.SWTBotUtils;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio;
+
+/**
+ * In a diagram representation, ensure that when we change container children
+ * presentation (from List to FreeForm or from FreeForm to List), the
+ * representation is correctly refreshed and that there is no error message in
+ * the Error Log.
+ *
+ * @author <a href="mailto:belqassim.djafer@obeo.fr">Belqassim Djafer</a>
+ */
+public class ContainerChildrenPresentationChangeTest extends AbstractSiriusSwtBotGefTestCase {
+
+ private static final String MODEL = "462927.ecore";
+
+ private static final String SESSION_FILE = "representations.aird";
+
+ private static final String VSM_FILE = "462927.odesign";
+
+ private static final String FILE_DIR = "/";
+
+ private static final String UNSYNCHRONIZED_REPRESENTATION_INSTANCE_NAME = "new 462927 unsynchronized";
+
+ private static final String SYNCHRONIZED_REPRESENTATION_INSTANCE_NAME = "new 462927 synchronized";
+
+ private static final String REPRESENTATION_NAME = "462927";
+
+ private static final String DATA_UNIT_DIR = "data/unit/containerChildrenPresentationChange/";
+
+ private static final String CONTAINER_NAME = "c";
+
+ private static final String DEFAULT = "Default";
+
+ private static final String CONTAINER = "462927";
+
+ private static final String PROPERTIES = "Properties";
+
+ private static final String GENERAL = "General";
+
+ private DDiagram dDiagram;
+
+ /**
+ * Sirius Diagram Editor.
+ */
+ protected SWTBotSiriusDiagramEditor editor;
+
+ /**
+ * {@inheritDoc}
+ *
+ */
+ @Override
+ protected void onSetUpBeforeClosingWelcomePage() throws Exception {
+ copyFileToTestProject(Activator.PLUGIN_ID, DATA_UNIT_DIR, MODEL, SESSION_FILE, VSM_FILE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onSetUpAfterOpeningDesignerPerspective() throws Exception {
+ sessionAirdResource = new UIResource(designerProject, FILE_DIR, SESSION_FILE);
+ localSession = designerPerspective.openSessionFromFile(sessionAirdResource);
+ changeSiriusPreference(SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), true);
+ }
+
+ /**
+ * Test container children presentation change when vsm and diagram are
+ * synchronized.
+ */
+ public void testSychronizedContainerChildrenPresentation() {
+ // Check that the VSM and representation are synchronized
+ checkSynchronizationLevel(true);
+ openDiagramRepresentation(SYNCHRONIZED_REPRESENTATION_INSTANCE_NAME);
+
+ // Test container children presentation change with opened and
+ // synchronized diagram editor.
+ testContainerChildrenPresentation(true, true);
+
+ // Test container children presentation change with closed and
+ // synchronized diagram editor.
+ testContainerChildrenPresentation(false, true);
+ }
+
+ /**
+ * Test container children presentation change when vsm and diagram are
+ * unsynchronized.
+ */
+ public void testUnsychronizedContainerChildrenPresentation() {
+ // Check that the VSM and representation are unsynchronized
+ checkSynchronizationLevel(false);
+ openDiagramRepresentation(UNSYNCHRONIZED_REPRESENTATION_INSTANCE_NAME);
+
+ // Test container children presentation change with opened and
+ // unsynchronized diagram editor.
+ testContainerChildrenPresentation(true, false);
+
+ // Test container children presentation change with closed and
+ // unsynchronized diagram editor.
+ testContainerChildrenPresentation(false, false);
+ }
+
+ /**
+ * Test container children presentation change with opened/closed diagram.
+ */
+ private void testContainerChildrenPresentation(boolean openedDiagram, boolean isSynchronized) {
+ // Change children presentation change from list to freeform
+ changeChildrenPresentation(ContainerLayout.FREE_FORM);
+ String representationName;
+ if (isSynchronized) {
+ representationName = SYNCHRONIZED_REPRESENTATION_INSTANCE_NAME;
+ } else {
+ representationName = UNSYNCHRONIZED_REPRESENTATION_INSTANCE_NAME;
+ }
+ if (openedDiagram) {
+ bot.editorByTitle(representationName).show();
+ } else {
+ openDiagramRepresentation(representationName);
+ }
+ checkContainerPresentationInDiagram(ContainerLayout.FREE_FORM);
+
+ // Change children presentation change from freeform to list
+ changeChildrenPresentation(ContainerLayout.LIST);
+ if (openedDiagram) {
+ bot.editorByTitle(representationName).show();
+ } else {
+ openDiagramRepresentation(representationName);
+ }
+ checkContainerPresentationInDiagram(ContainerLayout.LIST);
+ closeDiagramRepresentation();
+ }
+
+ /**
+ * Check diagram and VSM synchronizations.
+ *
+ * @param isSynchronized
+ * synchronization level
+ */
+ private void checkSynchronizationLevel(boolean isSynchronized) {
+ if (isSynchronized) {
+ dDiagram = (DDiagram) getRepresentationWithName(localSession.getOpenedSession(), REPRESENTATION_NAME, SYNCHRONIZED_REPRESENTATION_INSTANCE_NAME);
+ } else if (!isSynchronized) {
+ dDiagram = (DDiagram) getRepresentationWithName(localSession.getOpenedSession(), REPRESENTATION_NAME, UNSYNCHRONIZED_REPRESENTATION_INSTANCE_NAME);
+ }
+ String containerName = dDiagram.getContainers().get(0).getName();
+ ContainerMapping containerMapping = dDiagram.getContainers().get(0).getActualMapping();
+ DiagramElementMappingQuery mappingQuery = new DiagramElementMappingQuery(containerMapping);
+ assertTrue("The mapping of '" + containerName + " element should be a ContainerMapping'", containerMapping instanceof ContainerMapping);
+ if (isSynchronized) {
+ assertTrue("Both 'DDiagram' and 'DiagramElementMapping' attributes of '" + containerName + "' container should be synchronized", mappingQuery.isSynchronizedAndCreateElement(dDiagram));
+ } else {
+ assertFalse("Both 'DDiagram' and 'DiagramElementMapping' attributes of '" + containerName + "' container should be unsynchronized", mappingQuery.isSynchronizedAndCreateElement(dDiagram));
+ }
+ }
+
+ /**
+ * Change container children presentation from FreeForm to List or from List
+ * to FreeForm.
+ */
+ private void changeChildrenPresentation(ContainerLayout childrenPresentation) {
+ openVSM();
+ SWTBotEditor vsmEditor = selectContainerNodeMapping();
+ modifyVSM(childrenPresentation);
+ // save the VSM
+ vsmEditor.setFocus();
+ vsmEditor.save();
+ }
+
+ /**
+ * Select the container node mapping.
+ *
+ * @return the VSM editor
+ */
+ private SWTBotEditor selectContainerNodeMapping() {
+ SWTBotEditor activeEditor = bot.activeEditor();
+ activeEditor.setFocus();
+ activeEditor.bot().tree().expandNode("platform:/resource/" + getProjectName() + "/" + VSM_FILE).expandNode(REPRESENTATION_NAME).expandNode(REPRESENTATION_NAME).expandNode(REPRESENTATION_NAME)
+ .expandNode(DEFAULT).select(CONTAINER);
+ return activeEditor;
+ }
+
+ /**
+ * Modify children presentation in the VSM.
+ */
+ private void modifyVSM(ContainerLayout childrenPresentation) {
+ SWTBotView propertiesBot = bot.viewByTitle(PROPERTIES);
+ propertiesBot.setFocus();
+ SWTBotSiriusHelper.selectPropertyTabItem(GENERAL);
+ SWTBotUtils.waitAllUiEvents();
+ SWTBotRadio radioBox = propertiesBot.bot().radio(childrenPresentation.getName());
+ radioBox.click().setFocus();
+ }
+
+ /**
+ * Check that the container displays correctly it's children, as list
+ * elements or as shapes.
+ */
+ private void checkContainerPresentationInDiagram(ContainerLayout childrePresentation) {
+ if (childrePresentation == ContainerLayout.LIST) {
+ assertTrue("The container should display it's children as list elements", editor.getEditPart(CONTAINER_NAME).part().getParent() instanceof DNodeListEditPart);
+ } else if (childrePresentation == ContainerLayout.FREE_FORM) {
+ assertTrue("The container should display it's children as shapes", editor.getEditPart(CONTAINER_NAME).part().getParent() instanceof DNodeContainerEditPart);
+ }
+ }
+
+ /**
+ * Open the VSM.
+ */
+ private void openVSM() {
+ SWTBotView projectExplorer = bot.viewByTitle("Model Explorer");
+ projectExplorer.setFocus();
+ SWTBot projectExplorerBot = projectExplorer.bot();
+ projectExplorerBot.tree().expandNode(getProjectName()).expandNode(VSM_FILE).doubleClick();
+ }
+
+ /**
+ * Open diagram representation.
+ *
+ * @param representationInstanceName
+ * the representation instance name
+ */
+ private void openDiagramRepresentation(String representationInstanceName) {
+ this.editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), REPRESENTATION_NAME, representationInstanceName, DDiagram.class);
+ }
+
+ /**
+ * Save changes and close the diagram representation.
+ */
+ private void closeDiagramRepresentation() {
+ editor.setFocus();
+ editor.save();
+ editor.close();
+ }
+
+}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
index df4fa977ed..cb60f87214 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
@@ -277,6 +277,7 @@ public class AllTestSuite extends TestCase {
suite.addTestSuite(GoToMarkerTraceabilityWithUserInteractionTest.class);
suite.addTestSuite(NoteCreationWithSnapToGridTest.class);
suite.addTestSuite(ContainerCreationTest.class);
+ suite.addTestSuite(ContainerChildrenPresentationChangeTest.class);
suite.addTestSuite(ContainerCreationWithSnapToGridTest.class);
suite.addTestSuite(DNodeListCreationTest.class);
suite.addTestSuite(DNodeListCreationWithSnapToGridTest.class);

Back to the top