diff options
author | Camille Letavernier | 2018-05-17 07:19:51 +0000 |
---|---|---|
committer | Nicolas FAUVERGUE | 2018-05-22 15:58:01 +0000 |
commit | 89be951db129192f9c49a82b6f05495ba1f05a79 (patch) | |
tree | 9f9212bc5af85ec480539e225aeab4da741087c9 /tests | |
parent | e43ff03026633edf446b02582a2f0f1dccd9cc0f (diff) | |
download | org.eclipse.papyrus-89be951db129192f9c49a82b6f05495ba1f05a79.tar.gz org.eclipse.papyrus-89be951db129192f9c49a82b6f05495ba1f05a79.tar.xz org.eclipse.papyrus-89be951db129192f9c49a82b6f05495ba1f05a79.zip |
Bug 533692: [Sequence Diagram] Resizing an InteractionOperand should not
move or resize elements inside it
https://bugs.eclipse.org/bugs/show_bug.cgi?id=533692
Bug 533698: [Sequence Diagram] Moving a CombinedFragment should not move
elements on the lifeline
https://bugs.eclipse.org/bugs/show_bug.cgi?id=533698
- Add tests
Change-Id: Ie645d3fec7fd64e5f8fe567c13a5738ee464f622
Signed-off-by: Camille Letavernier <cletavernier@eclipsesource.com>
Diffstat (limited to 'tests')
5 files changed, 463 insertions, 0 deletions
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/Bug533692-533698.di b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/Bug533692-533698.di new file mode 100644 index 00000000000..8c549eecdc6 --- /dev/null +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/Bug533692-533698.di @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<architecture:ArchitectureDescription xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:architecture="http://www.eclipse.org/papyrus/infra/core/architecture" contextId="org.eclipse.papyrus.infra.services.edit.TypeContext"/> diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/Bug533692-533698.notation b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/Bug533692-533698.notation new file mode 100644 index 00000000000..d095b5917c6 --- /dev/null +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/Bug533692-533698.notation @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:css="http://www.eclipse.org/papyrus/infra/gmfdiag/css" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> + <notation:Diagram xmi:id="_bbusMFmiEeiBDLXM-rqKVw" type="PapyrusUMLSequenceDiagram" name="CFTest" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_bbusMVmiEeiBDLXM-rqKVw" type="Interaction_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_bbusMlmiEeiBDLXM-rqKVw" type="Interaction_NameLabel"/> + <children xmi:type="notation:BasicCompartment" xmi:id="_bbusM1miEeiBDLXM-rqKVw" type="Interaction_SubfragmentCompartment"> + <children xmi:type="notation:Shape" xmi:id="_e55cMFmiEeiBDLXM-rqKVw" type="CombinedFragment_Shape"> + <children xmi:type="notation:BasicCompartment" xmi:id="_e56DQFmiEeiBDLXM-rqKVw" type="CombinedFragment_SubfragmentCompartment"> + <children xmi:type="notation:Shape" xmi:id="_e56DRFmiEeiBDLXM-rqKVw" type="InteractionOperand_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_e56qUFmiEeiBDLXM-rqKVw" type="InteractionOperand_Guard"> + <element xmi:type="uml:InteractionConstraint" href="Bug533692-533698.uml#_e5udEVmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_e56qUVmiEeiBDLXM-rqKVw" x="5" y="5"/> + </children> + <element xmi:type="uml:InteractionOperand" href="Bug533692-533698.uml#_e5udEFmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_e56DRVmiEeiBDLXM-rqKVw" height="141"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_iDaK0FmiEeiBDLXM-rqKVw" type="InteractionOperand_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_iDax4FmiEeiBDLXM-rqKVw" type="InteractionOperand_Guard"> + <element xmi:type="uml:InteractionConstraint" href="Bug533692-533698.uml#_iDGBwFmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_iDax4VmiEeiBDLXM-rqKVw" x="5" y="5"/> + </children> + <element xmi:type="uml:InteractionOperand" href="Bug533692-533698.uml#_iDC-cFmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_iDaK0VmiEeiBDLXM-rqKVw" height="161"/> + </children> + <styles xmi:type="notation:SortingStyle" xmi:id="_e56DQVmiEeiBDLXM-rqKVw"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_e56DQlmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_e56DQ1miEeiBDLXM-rqKVw"/> + </children> + <element xmi:type="uml:CombinedFragment" href="Bug533692-533698.uml#_e5nIUFmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_e55cMVmiEeiBDLXM-rqKVw" x="74" y="76" width="441" height="321"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_eFlqYFmiEeiBDLXM-rqKVw" type="Lifeline_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_eFnfkFmiEeiBDLXM-rqKVw" type="Lifeline_NameLabel"/> + <children xmi:type="notation:BasicCompartment" xmi:id="_eGFZoFmiEeiBDLXM-rqKVw" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_eGFZoVmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_eGFZolmiEeiBDLXM-rqKVw"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_fgaCkFmiEeiBDLXM-rqKVw" type="ActionExecutionSpecification_Shape"> + <element xmi:type="uml:ActionExecutionSpecification" href="Bug533692-533698.uml#_ff_y4FmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fgaCkVmiEeiBDLXM-rqKVw" x="40" y="106" width="20" height="100"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_hmBrQFmiEeiBDLXM-rqKVw" type="ActionExecutionSpecification_Shape"> + <element xmi:type="uml:ActionExecutionSpecification" href="Bug533692-533698.uml#_hlv-cFmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hmBrQVmiEeiBDLXM-rqKVw" x="40" y="246" width="20" height="100"/> + </children> + <element xmi:type="uml:Lifeline" href="Bug533692-533698.uml#_eFVLsFmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_eFlqYVmiEeiBDLXM-rqKVw" x="114" y="10"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_eMim8FmiEeiBDLXM-rqKVw" type="Lifeline_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_eMjOAFmiEeiBDLXM-rqKVw" type="Lifeline_NameLabel"/> + <children xmi:type="notation:BasicCompartment" xmi:id="_eMqiwFmiEeiBDLXM-rqKVw" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_eMqiwVmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_eMqiwlmiEeiBDLXM-rqKVw"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_gryQkFmiEeiBDLXM-rqKVw" type="ActionExecutionSpecification_Shape"> + <element xmi:type="uml:ActionExecutionSpecification" href="Bug533692-533698.uml#_grdgcFmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_gryQkVmiEeiBDLXM-rqKVw" x="40" y="186" width="20" height="80"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_Fp6TwFmkEeiBDLXM-rqKVw" type="BehaviorExecutionSpecification_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_Fp7h4FmkEeiBDLXM-rqKVw" type="BehaviorExecutionSpecification_Behavior"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_Fp7h4VmkEeiBDLXM-rqKVw" x="18" y="18"/> + </children> + <element xmi:type="uml:BehaviorExecutionSpecification" href="Bug533692-533698.uml#_Fpn_4FmkEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Fp6TwVmkEeiBDLXM-rqKVw" x="40" y="346" width="20" height="100"/> + </children> + <element xmi:type="uml:Lifeline" href="Bug533692-533698.uml#_eMcgUFmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_eMim8VmiEeiBDLXM-rqKVw" x="314" y="10"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_eYW1YFmiEeiBDLXM-rqKVw" type="Lifeline_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_eYXccFmiEeiBDLXM-rqKVw" type="Lifeline_NameLabel"/> + <element xmi:type="uml:Lifeline" href="Bug533692-533698.uml#_eYG9wFmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_eYW1YVmiEeiBDLXM-rqKVw" x="634" y="10"/> + </children> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bbusNFmiEeiBDLXM-rqKVw"/> + </children> + <element xmi:type="uml:Interaction" href="Bug533692-533698.uml#_bbjGAFmiEeiBDLXM-rqKVw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_bbusNVmiEeiBDLXM-rqKVw"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_bbusNlmiEeiBDLXM-rqKVw" name="diagram_compatibility_version" stringValue="1.4.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_bbusN1miEeiBDLXM-rqKVw"/> + <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_bbusOFmiEeiBDLXM-rqKVw" diagramKindId="org.eclipse.papyrus.uml.diagram.sequence"> + <owner xmi:type="uml:Model" href="Bug533692-533698.uml#_bWhcEFmiEeiBDLXM-rqKVw"/> + </styles> + <element xmi:type="uml:Interaction" href="Bug533692-533698.uml#_bbjGAFmiEeiBDLXM-rqKVw"/> + <edges xmi:type="notation:Connector" xmi:id="_3KVEwFmjEeiBDLXM-rqKVw" type="Message_AsynchEdge" source="_eFlqYFmiEeiBDLXM-rqKVw" target="_eMim8FmiEeiBDLXM-rqKVw"> + <children xmi:type="notation:DecorationNode" xmi:id="_3KVEw1mjEeiBDLXM-rqKVw" type="Message_AsynchNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_3KVExFmjEeiBDLXM-rqKVw" x="1" y="-13"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_3KVExVmjEeiBDLXM-rqKVw" type="Message_AsynchStereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_3KVExlmjEeiBDLXM-rqKVw" x="1" y="-33"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="_3KVEwVmjEeiBDLXM-rqKVw"/> + <styles xmi:type="notation:LineStyle" xmi:id="_3KVEx1mjEeiBDLXM-rqKVw"/> + <element xmi:type="uml:Message" href="Bug533692-533698.uml#_3KJekFmjEeiBDLXM-rqKVw"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_3KVEwlmjEeiBDLXM-rqKVw" points="[-10, 2, -210, 0]$[200, 2, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_3KvUcFmjEeiBDLXM-rqKVw" id="(0.5,0.18)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_3KvUcVmjEeiBDLXM-rqKVw" id="(0.5,0.18)"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_7nLDgFmjEeiBDLXM-rqKVw" type="Message_AsynchEdge" source="_eMim8FmiEeiBDLXM-rqKVw" target="_eFlqYFmiEeiBDLXM-rqKVw"> + <children xmi:type="notation:DecorationNode" xmi:id="_7nLDg1mjEeiBDLXM-rqKVw" type="Message_AsynchNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_7nLDhFmjEeiBDLXM-rqKVw" x="1" y="-13"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_7nLDhVmjEeiBDLXM-rqKVw" type="Message_AsynchStereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_7nLDhlmjEeiBDLXM-rqKVw" x="1" y="-33"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="_7nLDgVmjEeiBDLXM-rqKVw"/> + <styles xmi:type="notation:LineStyle" xmi:id="_7nLDh1mjEeiBDLXM-rqKVw"/> + <element xmi:type="uml:Message" href="Bug533692-533698.uml#_7m_dUFmjEeiBDLXM-rqKVw"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_7nLDglmjEeiBDLXM-rqKVw" points="[-10, -8, 190, -40]$[-210, 32, -10, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_7nl6QFmjEeiBDLXM-rqKVw" id="(0.5,0.3514285714285714)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_7nl6QVmjEeiBDLXM-rqKVw" id="(0.5,0.3514285714285714)"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_-qse4FmjEeiBDLXM-rqKVw" type="Message_AsynchEdge" source="_eFlqYFmiEeiBDLXM-rqKVw" target="_eMim8FmiEeiBDLXM-rqKVw"> + <children xmi:type="notation:DecorationNode" xmi:id="_-qse41mjEeiBDLXM-rqKVw" type="Message_AsynchNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_-qse5FmjEeiBDLXM-rqKVw" x="1" y="-13"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_-qse5VmjEeiBDLXM-rqKVw" type="Message_AsynchStereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_-qse5lmjEeiBDLXM-rqKVw" x="1" y="-33"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="_-qse4VmjEeiBDLXM-rqKVw"/> + <styles xmi:type="notation:LineStyle" xmi:id="_-qse51mjEeiBDLXM-rqKVw"/> + <element xmi:type="uml:Message" href="Bug533692-533698.uml#_-qd1YFmjEeiBDLXM-rqKVw"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_-qse4lmjEeiBDLXM-rqKVw" points="[-10, 0, -210, 0]$[200, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_-rGHgFmjEeiBDLXM-rqKVw" id="(0.5,0.4085714285714286)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_-rGukFmjEeiBDLXM-rqKVw" id="(0.5,0.4085714285714286)"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="__TPFkFmjEeiBDLXM-rqKVw" type="Message_AsynchEdge" source="_eFlqYFmiEeiBDLXM-rqKVw" target="_eMim8FmiEeiBDLXM-rqKVw"> + <children xmi:type="notation:DecorationNode" xmi:id="__TPFk1mjEeiBDLXM-rqKVw" type="Message_AsynchNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="__TPFlFmjEeiBDLXM-rqKVw" x="1" y="-13"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="__TPFlVmjEeiBDLXM-rqKVw" type="Message_AsynchStereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="__TPFllmjEeiBDLXM-rqKVw" x="1" y="-33"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="__TPFkVmjEeiBDLXM-rqKVw"/> + <styles xmi:type="notation:LineStyle" xmi:id="__TPsoFmjEeiBDLXM-rqKVw"/> + <element xmi:type="uml:Message" href="Bug533692-533698.uml#__S_1AFmjEeiBDLXM-rqKVw"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="__TPFklmjEeiBDLXM-rqKVw" points="[-10, -6, -210, -40]$[190, 34, -10, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="__TiAgFmjEeiBDLXM-rqKVw" id="(0.5,0.4657142857142857)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="__TinkFmjEeiBDLXM-rqKVw" id="(0.5,0.4657142857142857)"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_IiV5cFmkEeiBDLXM-rqKVw" type="Message_AsynchEdge" source="_eFlqYFmiEeiBDLXM-rqKVw" target="_eMim8FmiEeiBDLXM-rqKVw"> + <children xmi:type="notation:DecorationNode" xmi:id="_IiWggFmkEeiBDLXM-rqKVw" type="Message_AsynchNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_IiWggVmkEeiBDLXM-rqKVw" x="1" y="-13"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_IiWgglmkEeiBDLXM-rqKVw" type="Message_AsynchStereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_IiWgg1mkEeiBDLXM-rqKVw" x="1" y="-33"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="_IiV5cVmkEeiBDLXM-rqKVw"/> + <styles xmi:type="notation:LineStyle" xmi:id="_IiWghFmkEeiBDLXM-rqKVw"/> + <element xmi:type="uml:Message" href="Bug533692-533698.uml#_IiBwYFmkEeiBDLXM-rqKVw"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_IiV5clmkEeiBDLXM-rqKVw" points="[-10, -9, -210, -60]$[190, 51, -10, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_IiqpkFmkEeiBDLXM-rqKVw" id="(0.5,0.4942857142857143)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_IiqpkVmkEeiBDLXM-rqKVw" id="(0.5,0.4942857142857143)"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_JSxQ0FmkEeiBDLXM-rqKVw" type="Message_AsynchEdge" source="_eMim8FmiEeiBDLXM-rqKVw" target="_eFlqYFmiEeiBDLXM-rqKVw"> + <children xmi:type="notation:DecorationNode" xmi:id="_JSx34FmkEeiBDLXM-rqKVw" type="Message_AsynchNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_JSx34VmkEeiBDLXM-rqKVw" x="1" y="-13"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_JSx34lmkEeiBDLXM-rqKVw" type="Message_AsynchStereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_JSx341mkEeiBDLXM-rqKVw" x="1" y="-33"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="_JSxQ0VmkEeiBDLXM-rqKVw"/> + <styles xmi:type="notation:LineStyle" xmi:id="_JSx35FmkEeiBDLXM-rqKVw"/> + <element xmi:type="uml:Message" href="Bug533692-533698.uml#_JSlDkFmkEeiBDLXM-rqKVw"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_JSxQ0lmkEeiBDLXM-rqKVw" points="[-10, 0, 190, 0]$[-200, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_JTFZ4FmkEeiBDLXM-rqKVw" id="(0.5,0.58)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_JTFZ4VmkEeiBDLXM-rqKVw" id="(0.5,0.58)"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_KRsXMFmkEeiBDLXM-rqKVw" type="Message_AsynchEdge" source="_eFlqYFmiEeiBDLXM-rqKVw" target="_eMim8FmiEeiBDLXM-rqKVw"> + <children xmi:type="notation:DecorationNode" xmi:id="_KRsXM1mkEeiBDLXM-rqKVw" type="Message_AsynchNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_KRsXNFmkEeiBDLXM-rqKVw" x="6" y="-33"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_KRs-QFmkEeiBDLXM-rqKVw" type="Message_AsynchStereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_KRs-QVmkEeiBDLXM-rqKVw" x="1" y="-33"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="_KRsXMVmkEeiBDLXM-rqKVw"/> + <styles xmi:type="notation:LineStyle" xmi:id="_KRs-QlmkEeiBDLXM-rqKVw"/> + <element xmi:type="uml:Message" href="Bug533692-533698.uml#_KRdtsFmkEeiBDLXM-rqKVw"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_KRsXMlmkEeiBDLXM-rqKVw" points="[0, 0, -200, 0]$[190, 0, -10, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_KSIcEFmkEeiBDLXM-rqKVw" id="(0.5,0.6085714285714285)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_KSJDIFmkEeiBDLXM-rqKVw" id="(0.5,0.6085714285714285)"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_L9Nd0FmkEeiBDLXM-rqKVw" type="Message_AsynchEdge" source="_eFlqYFmiEeiBDLXM-rqKVw" target="_eMim8FmiEeiBDLXM-rqKVw"> + <children xmi:type="notation:DecorationNode" xmi:id="_L9OE4FmkEeiBDLXM-rqKVw" type="Message_AsynchNameLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_L9OE4VmkEeiBDLXM-rqKVw" x="1" y="-13"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_L9OE4lmkEeiBDLXM-rqKVw" type="Message_AsynchStereotypeLabel"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_L9OE41mkEeiBDLXM-rqKVw" x="1" y="-33"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="_L9Nd0VmkEeiBDLXM-rqKVw"/> + <styles xmi:type="notation:LineStyle" xmi:id="_L9OE5FmkEeiBDLXM-rqKVw"/> + <element xmi:type="uml:Message" href="Bug533692-533698.uml#_L8_bYFmkEeiBDLXM-rqKVw"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_L9Nd0lmkEeiBDLXM-rqKVw" points="[0, 0, -200, 0]$[200, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_L9mfYFmkEeiBDLXM-rqKVw" id="(0.5,0.6657142857142857)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_L9mfYVmkEeiBDLXM-rqKVw" id="(0.5,0.6657142857142857)"/> + </edges> + </notation:Diagram> + <css:ModelStyleSheets xmi:id="_UKEnAFmjEeiBDLXM-rqKVw"> + <stylesheets xmi:type="css:StyleSheetReference" xmi:id="_UKHDQFmjEeiBDLXM-rqKVw" path="style.css"/> + </css:ModelStyleSheets> +</xmi:XMI> diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/Bug533692-533698.uml b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/Bug533692-533698.uml new file mode 100644 index 00000000000..b894de27c35 --- /dev/null +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/Bug533692-533698.uml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_bWhcEFmiEeiBDLXM-rqKVw" name="Bug533692-533698"> + <packageImport xmi:type="uml:PackageImport" xmi:id="_bicYMFmiEeiBDLXM-rqKVw"> + <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> + </packageImport> + <packagedElement xmi:type="uml:Interaction" xmi:id="_bbjGAFmiEeiBDLXM-rqKVw" name="Interaction1"> + <lifeline xmi:type="uml:Lifeline" xmi:id="_eFVLsFmiEeiBDLXM-rqKVw" name="Lifeline1" coveredBy="_e5udEFmiEeiBDLXM-rqKVw _iDC-cFmiEeiBDLXM-rqKVw _3KJekVmjEeiBDLXM-rqKVw _jP_SsFmiEeiBDLXM-rqKVw _7nAEYVmjEeiBDLXM-rqKVw _-qgRoFmjEeiBDLXM-rqKVw __TAcEFmjEeiBDLXM-rqKVw _IiC-gFmkEeiBDLXM-rqKVw _JSmRsVmkEeiBDLXM-rqKVw _KReUwFmkEeiBDLXM-rqKVw _L9ACcFmkEeiBDLXM-rqKVw _hlv-cFmiEeiBDLXM-rqKVw _ff_y4FmiEeiBDLXM-rqKVw"/> + <lifeline xmi:type="uml:Lifeline" xmi:id="_eMcgUFmiEeiBDLXM-rqKVw" name="Lifeline2" coveredBy="_e5udEFmiEeiBDLXM-rqKVw _iDC-cFmiEeiBDLXM-rqKVw _3KKFoFmjEeiBDLXM-rqKVw _jP_5wFmiEeiBDLXM-rqKVw _7nAEYFmjEeiBDLXM-rqKVw _grgjwFmiEeiBDLXM-rqKVw _grdgcFmiEeiBDLXM-rqKVw _-qg4sFmjEeiBDLXM-rqKVw __TBDIFmjEeiBDLXM-rqKVw _IiDlkFmkEeiBDLXM-rqKVw _JSmRsFmkEeiBDLXM-rqKVw _KRe70FmkEeiBDLXM-rqKVw _Fpp1EFmkEeiBDLXM-rqKVw _Fpn_4FmkEeiBDLXM-rqKVw _L9ApgFmkEeiBDLXM-rqKVw"/> + <lifeline xmi:type="uml:Lifeline" xmi:id="_eYG9wFmiEeiBDLXM-rqKVw" name="Lifeline3" coveredBy="_e5udEFmiEeiBDLXM-rqKVw _iDC-cFmiEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:ExecutionOccurrenceSpecification" xmi:id="_grgjwFmiEeiBDLXM-rqKVw" name="ActionExecutionSpecification8Finish" covered="_eMcgUFmiEeiBDLXM-rqKVw" execution="_grdgcFmiEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_-qgRoFmjEeiBDLXM-rqKVw" name="Message18SendEvent" covered="_eFVLsFmiEeiBDLXM-rqKVw" message="_-qd1YFmjEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_-qg4sFmjEeiBDLXM-rqKVw" name="Message18ReceiveEvent" covered="_eMcgUFmiEeiBDLXM-rqKVw" message="_-qd1YFmjEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="__TAcEFmjEeiBDLXM-rqKVw" name="Message21SendEvent" covered="_eFVLsFmiEeiBDLXM-rqKVw" message="__S_1AFmjEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="__TBDIFmjEeiBDLXM-rqKVw" name="Message21ReceiveEvent" covered="_eMcgUFmiEeiBDLXM-rqKVw" message="__S_1AFmjEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_IiC-gFmkEeiBDLXM-rqKVw" name="Message24SendEvent" covered="_eFVLsFmiEeiBDLXM-rqKVw" message="_IiBwYFmkEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_IiDlkFmkEeiBDLXM-rqKVw" name="Message24ReceiveEvent" covered="_eMcgUFmiEeiBDLXM-rqKVw" message="_IiBwYFmkEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:BehaviorExecutionSpecification" xmi:id="_Fpn_4FmkEeiBDLXM-rqKVw" name="BehaviorExecutionSpecification4" covered="_eMcgUFmiEeiBDLXM-rqKVw" finish="_Fpp1EFmkEeiBDLXM-rqKVw" start="_IiDlkFmkEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_JSmRsFmkEeiBDLXM-rqKVw" name="Message25SendEvent" covered="_eMcgUFmiEeiBDLXM-rqKVw" message="_JSlDkFmkEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_JSmRsVmkEeiBDLXM-rqKVw" name="Message25ReceiveEvent" covered="_eFVLsFmiEeiBDLXM-rqKVw" message="_JSlDkFmkEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_KReUwFmkEeiBDLXM-rqKVw" name="Message28SendEvent" covered="_eFVLsFmiEeiBDLXM-rqKVw" message="_KRdtsFmkEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_KRe70FmkEeiBDLXM-rqKVw" name="Message28ReceiveEvent" covered="_eMcgUFmiEeiBDLXM-rqKVw" message="_KRdtsFmkEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:ExecutionOccurrenceSpecification" xmi:id="_Fpp1EFmkEeiBDLXM-rqKVw" name="BehaviorExecutionSpecification21Finish" covered="_eMcgUFmiEeiBDLXM-rqKVw" execution="_Fpn_4FmkEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_L9ACcFmkEeiBDLXM-rqKVw" name="Message31SendEvent" covered="_eFVLsFmiEeiBDLXM-rqKVw" message="_L8_bYFmkEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_L9ApgFmkEeiBDLXM-rqKVw" name="Message31ReceiveEvent" covered="_eMcgUFmiEeiBDLXM-rqKVw" message="_L8_bYFmkEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:ActionExecutionSpecification" xmi:id="_ff_y4FmiEeiBDLXM-rqKVw" name="ActionExecutionSpecification1" covered="_eFVLsFmiEeiBDLXM-rqKVw" finish="_jP_SsFmiEeiBDLXM-rqKVw" start="_3KJekVmjEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:ActionExecutionSpecification" xmi:id="_hlv-cFmiEeiBDLXM-rqKVw" name="ActionExecutionSpecification3" covered="_eFVLsFmiEeiBDLXM-rqKVw" finish="_IiC-gFmkEeiBDLXM-rqKVw" start="_7nAEYFmjEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:ActionExecutionSpecification" xmi:id="_grdgcFmiEeiBDLXM-rqKVw" name="ActionExecutionSpecification2" covered="_eMcgUFmiEeiBDLXM-rqKVw" finish="_grgjwFmiEeiBDLXM-rqKVw" start="_jP_5wFmiEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:CombinedFragment" xmi:id="_e5nIUFmiEeiBDLXM-rqKVw" name="TestedCF"> + <operand xmi:type="uml:InteractionOperand" xmi:id="_e5udEFmiEeiBDLXM-rqKVw" name="InteractionOperand1" covered="_eFVLsFmiEeiBDLXM-rqKVw _eYG9wFmiEeiBDLXM-rqKVw _eMcgUFmiEeiBDLXM-rqKVw"> + <guard xmi:type="uml:InteractionConstraint" xmi:id="_e5udEVmiEeiBDLXM-rqKVw" name="guard"/> + </operand> + <operand xmi:type="uml:InteractionOperand" xmi:id="_iDC-cFmiEeiBDLXM-rqKVw" name="InteractionOperand2" covered="_eFVLsFmiEeiBDLXM-rqKVw _eYG9wFmiEeiBDLXM-rqKVw _eMcgUFmiEeiBDLXM-rqKVw"> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_7nAEYFmjEeiBDLXM-rqKVw" name="Message17SendEvent" covered="_eMcgUFmiEeiBDLXM-rqKVw" message="_7m_dUFmjEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_7nAEYVmjEeiBDLXM-rqKVw" name="Message17ReceiveEvent" covered="_eFVLsFmiEeiBDLXM-rqKVw" message="_7m_dUFmjEeiBDLXM-rqKVw"/> + <guard xmi:type="uml:InteractionConstraint" xmi:id="_iDGBwFmiEeiBDLXM-rqKVw" name="guard"/> + </operand> + </fragment> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_jP_SsFmiEeiBDLXM-rqKVw" name="Message13SendEvent" covered="_eFVLsFmiEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_jP_5wFmiEeiBDLXM-rqKVw" name="Message13ReceiveEvent" covered="_eMcgUFmiEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_3KJekVmjEeiBDLXM-rqKVw" name="Message15SendEvent" covered="_eFVLsFmiEeiBDLXM-rqKVw" message="_3KJekFmjEeiBDLXM-rqKVw"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_3KKFoFmjEeiBDLXM-rqKVw" name="Message15ReceiveEvent" covered="_eMcgUFmiEeiBDLXM-rqKVw" message="_3KJekFmjEeiBDLXM-rqKVw"/> + <message xmi:type="uml:Message" xmi:id="_3KJekFmjEeiBDLXM-rqKVw" name="Message15" messageSort="asynchCall" receiveEvent="_3KKFoFmjEeiBDLXM-rqKVw" sendEvent="_3KJekVmjEeiBDLXM-rqKVw"/> + <message xmi:type="uml:Message" xmi:id="_7m_dUFmjEeiBDLXM-rqKVw" name="Message17" messageSort="asynchCall" receiveEvent="_7nAEYVmjEeiBDLXM-rqKVw" sendEvent="_7nAEYFmjEeiBDLXM-rqKVw"/> + <message xmi:type="uml:Message" xmi:id="_-qd1YFmjEeiBDLXM-rqKVw" name="Message18" messageSort="asynchCall" receiveEvent="_-qg4sFmjEeiBDLXM-rqKVw" sendEvent="_-qgRoFmjEeiBDLXM-rqKVw"/> + <message xmi:type="uml:Message" xmi:id="__S_1AFmjEeiBDLXM-rqKVw" name="Message21" messageSort="asynchCall" receiveEvent="__TBDIFmjEeiBDLXM-rqKVw" sendEvent="__TAcEFmjEeiBDLXM-rqKVw"/> + <message xmi:type="uml:Message" xmi:id="_IiBwYFmkEeiBDLXM-rqKVw" name="Message24" messageSort="asynchCall" receiveEvent="_IiDlkFmkEeiBDLXM-rqKVw" sendEvent="_IiC-gFmkEeiBDLXM-rqKVw"/> + <message xmi:type="uml:Message" xmi:id="_JSlDkFmkEeiBDLXM-rqKVw" name="Message25" messageSort="asynchCall" receiveEvent="_JSmRsVmkEeiBDLXM-rqKVw" sendEvent="_JSmRsFmkEeiBDLXM-rqKVw"/> + <message xmi:type="uml:Message" xmi:id="_KRdtsFmkEeiBDLXM-rqKVw" name="Message28" messageSort="asynchCall" receiveEvent="_KRe70FmkEeiBDLXM-rqKVw" sendEvent="_KReUwFmkEeiBDLXM-rqKVw"/> + <message xmi:type="uml:Message" xmi:id="_L8_bYFmkEeiBDLXM-rqKVw" name="Message31" messageSort="asynchCall" receiveEvent="_L9ApgFmkEeiBDLXM-rqKVw" sendEvent="_L9ACcFmkEeiBDLXM-rqKVw"/> + </packagedElement> +</uml:Model> diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/BugTests.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/BugTests.java index eb64d422e3c..700c672586a 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/BugTests.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/BugTests.java @@ -35,6 +35,7 @@ import org.junit.runners.Suite.SuiteClasses; TestGuardEdition_364808.class, CombinedFragmentRegressionTest.class, TestCombinedFragmentOperandsLayout.class, + TestCFOperandsCoveredNodes.class, }) public class BugTests { diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCFOperandsCoveredNodes.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCFOperandsCoveredNodes.java new file mode 100644 index 00000000000..a1646b6d4dd --- /dev/null +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCFOperandsCoveredNodes.java @@ -0,0 +1,208 @@ +/***************************************************************************** + * Copyright (c) 2018 EclipseSource and others. + * + * 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: + * EclipseSource - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.tests.bug; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.PositionConstants; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gef.RequestConstants; +import org.eclipse.gef.requests.ChangeBoundsRequest; +import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; +import org.eclipse.papyrus.junit.utils.rules.ActiveDiagram; +import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; +import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrus.uml.diagram.sequence.requests.MoveSeparatorRequest; +import org.eclipse.uml2.uml.ActionExecutionSpecification; +import org.eclipse.uml2.uml.BehaviorExecutionSpecification; +import org.eclipse.uml2.uml.CombinedFragment; +import org.eclipse.uml2.uml.InteractionOperand; +import org.eclipse.uml2.uml.Message; +import org.eclipse.uml2.uml.NamedElement; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +/** + * Test class for Bugs 533692 & 533698: Moving/Resizing CFs/Operands should + * not visually affect covered nodes (i.e. these nodes must remain at the same + * location and keep the same size, even if they become visually inconsistent in the process) + */ +@PluginResource({ "resource/bugs/Bug533692-533698.di", "resource/bugs/style.css" }) +@ActiveDiagram("CFTest") +public class TestCFOperandsCoveredNodes extends AbstractPapyrusTest { + + @Rule + public final PapyrusEditorFixture editor = new PapyrusEditorFixture(); + + private Map<GraphicalEditPart, Rectangle> originalBounds = new HashMap<>(); + + private GraphicalEditPart cfEditPart; + private GraphicalEditPart op2EditPart; + + @Before + public void initParts() { + cfEditPart = (GraphicalEditPart) editor.findEditPart("TestedCF", CombinedFragment.class); + op2EditPart = (GraphicalEditPart) editor.findEditPart("InteractionOperand2", InteractionOperand.class); + + // For execution specifications, store the initial bounds. They shouldn't change during the execution of the tests + findEditPartAndStoreBounds("ActionExecutionSpecification1", ActionExecutionSpecification.class); + findEditPartAndStoreBounds("ActionExecutionSpecification2", ActionExecutionSpecification.class); + findEditPartAndStoreBounds("ActionExecutionSpecification3", ActionExecutionSpecification.class); + findEditPartAndStoreBounds("BehaviorExecutionSpecification4", BehaviorExecutionSpecification.class); + + // Same thing for messages + String[] messageNames = { "Message15", "Message17", "Message18", "Message21", "Message24", "Message28", "Message25", "Message31" }; + for (String messageName : messageNames) { + findEditPartAndStoreBounds(messageName, Message.class); + } + } + + @Test + public void testResizeOperands() { + // Prepare the request + MoveSeparatorRequest resizeOperands = new MoveSeparatorRequest(0); + Point separatorLocation = at(100, 0, op2EditPart); + resizeOperands.setLocation(separatorLocation); + resizeOperands.setEditParts(Collections.singletonList(cfEditPart)); + + // Move the separator down + resizeOperands.setMoveDelta(new Point(0, 80)); // Below Message 18 and exec2; in the middle of exec3 + editor.execute(cfEditPart.getCommand(resizeOperands)); + checkCurrentBounds(3); + + // Move the separator up + resizeOperands.setMoveDelta(new Point(0, -150)); // Below Message 15, in the middle of exec1 + editor.execute(cfEditPart.getCommand(resizeOperands)); + checkCurrentBounds(3); + } + + @Test + public void testResizeFragmentSE() { + // Prepare the request + ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_RESIZE); + request.setEditParts(cfEditPart); + request.setResizeDirection(PositionConstants.SOUTH_EAST); + + // Shrink the Fragment (South-East) + request.setSizeDelta(new Dimension(-250, -115)); // Only cover Lifeline1; between Message17 and Message18 + editor.execute(cfEditPart.getCommand(request)); + checkCurrentBounds(3); + + // Expand the Fragment (South-East) + request.setSizeDelta(new Dimension(130, 170)); // Cover both Lifelines, exclude Message31 and the end of Exec4 + editor.execute(cfEditPart.getCommand(request)); + checkCurrentBounds(3); + } + + @Test + public void testResizeFragmentNW() { + // Prepare the request + ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_RESIZE); + request.setEditParts(cfEditPart); + request.setResizeDirection(PositionConstants.NORTH_WEST); + + {// Shrink the Fragment (North-West) + int deltaW = 180; + int deltaH = 105; + request.setSizeDelta(new Dimension(-deltaW, -deltaH)); // Exclude first lifeline, below Message15 and in the middle of exec1 + request.setMoveDelta(new Point(deltaW, deltaH)); + editor.execute(cfEditPart.getCommand(request)); + checkCurrentBounds(3); + } + + {// Expand the Fragment (North-West) + int deltaW = 260; + int deltaH = 60; + request.setSizeDelta(new Dimension(deltaW, deltaH)); // Include everything, except the start of Exec1 + request.setMoveDelta(new Point(-deltaW, -deltaH)); + editor.execute(cfEditPart.getCommand(request)); + checkCurrentBounds(3); + } + } + + @Test + public void testMoveFragment() { + // Prepare the request + ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_MOVE); + request.setEditParts(cfEditPart); + + { + int deltaX = 350; + int deltaY = 410; + request.setMoveDelta(new Point(deltaX, deltaY)); // Move over the third lifeline, do not cover any Exec/Message + editor.execute(cfEditPart.getCommand(request)); + checkCurrentBounds(3); + } + + { + int deltaX = -325; + int deltaY = -250; + request.setMoveDelta(new Point(deltaX, deltaY)); // Between Lifeline 1 and 2, in the middle of exec2 (Before Message17) + editor.execute(cfEditPart.getCommand(request)); + checkCurrentBounds(3); + } + } + + private GraphicalEditPart findEditPartAndStoreBounds(String name, Class<? extends NamedElement> type) { + GraphicalEditPart result = (GraphicalEditPart) editor.findEditPart(name, type); + originalBounds.put(result, result.getFigure().getBounds().getCopy()); + return result; + } + + private void checkCurrentBounds(int undoRedoLoops) { + for (int i = 0; i < undoRedoLoops; i++) { + checkCurrentBounds(); + editor.undo(); + checkCurrentBounds(); + editor.redo(); + } + } + + private void checkCurrentBounds() { + for (Map.Entry<GraphicalEditPart, Rectangle> original : originalBounds.entrySet()) { + GraphicalEditPart part = original.getKey(); + Rectangle bounds = original.getValue(); + Assert.assertEquals(bounds, part.getFigure().getBounds()); + } + } + + // Convert a point that is relative to the given part to a point relative to the current Viewport (Taking zoom & translate into account). + // This can be used to get a "Mouse Location" to configure Requests + private static Point at(int x, int y, GraphicalEditPart relativeTo) { + Point at = new Point(x, y); + + IFigure figure = relativeTo.getContentPane(); + Point layoutOrigin = figure.getClientArea().getLocation(); + + at.performTranslate(layoutOrigin.x, layoutOrigin.y); + figure.translateToParent(at); + figure.translateToAbsolute(at); + + return at; + } + + @After + public void clear() { + originalBounds.clear(); + } + +} |