diff options
author | Laurent Redor | 2015-05-21 09:10:00 +0000 |
---|---|---|
committer | Laurent Redor | 2015-05-29 14:02:09 +0000 |
commit | e0d053b4dcc0aeb80d28ef307a96f098ff6be4cb (patch) | |
tree | 1aec5f12080522c986894ada0e498adbf60eb572 | |
parent | da24f3110bc5cd13fd0a73126d9b438d121f55e1 (diff) | |
download | org.eclipse.sirius-e0d053b4dcc0aeb80d28ef307a96f098ff6be4cb.tar.gz org.eclipse.sirius-e0d053b4dcc0aeb80d28ef307a96f098ff6be4cb.tar.xz org.eclipse.sirius-e0d053b4dcc0aeb80d28ef307a96f098ff6be4cb.zip |
[test] Make test BorderMarginTest.testAutoSize() more reliable
The test
org.eclipse.sirius.tests.unit.diagram.layout.margin.BorderMarginTest.testAutoSize()
was not reliable. It fails systematically on the Sirius HIPP. The result
depends of the environment and OS.
So this commit:
* changes the labelExpression in VSM to have a label with a width
greater than the default.
* updates the representations file according to the labelExpression
change.
* uses the label width as reference to compute the expected container
width (instead of stored values).
Change-Id: I98cb2bdb7135a1593d21f74ec093b785bbab9d54
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
4 files changed, 75 insertions, 70 deletions
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/margin/My.aird b/plugins/org.eclipse.sirius.tests.junit/data/unit/margin/My.aird index 5afebec60d..de9b03698f 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/margin/My.aird +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/margin/My.aird @@ -107,7 +107,7 @@ <styles xmi:type="notation:DiagramStyle" xmi:id="_ivsTYuS1EeKH-OJR8wbplA"/> </data> </ownedAnnotationEntries> - <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_ivna4eS1EeKH-OJR8wbplA" name="border label VSM size: 0 "> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_ivna4eS1EeKH-OJR8wbplA" name="The border label VSM size is 0 "> <target xmi:type="ecore:EClass" href="My.ecore#//0"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//0"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -133,7 +133,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='List']/@subNodeMappings[name='Attributes']"/> </ownedElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_ivoB-eS1EeKH-OJR8wbplA" name="border label VSM size: 1 "> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_ivoB-eS1EeKH-OJR8wbplA" name="The border label VSM size is 1 "> <target xmi:type="ecore:EClass" href="My.ecore#//1"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//1"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -159,7 +159,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='List']/@subNodeMappings[name='Attributes']"/> </ownedElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_ivopBeS1EeKH-OJR8wbplA" name="border label VSM size: 10 "> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_ivopBeS1EeKH-OJR8wbplA" name="The border label VSM size is 10 "> <target xmi:type="ecore:EClass" href="My.ecore#//10"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//10"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -185,7 +185,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='List']/@subNodeMappings[name='Attributes']"/> </ownedElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_rHTekOS1EeKH-OJR8wbplA" name="border label VSM size: 0 "> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_rHTekOS1EeKH-OJR8wbplA" name="The border label VSM size is 0 "> <target xmi:type="ecore:EClass" href="My.ecore#//0"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//0"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -211,7 +211,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='Container']/@subNodeMappings[name='Attributes']"/> </ownedDiagramElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_rHWh4OS1EeKH-OJR8wbplA" name="border label VSM size: 1 "> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_rHWh4OS1EeKH-OJR8wbplA" name="The border label VSM size is 1 "> <target xmi:type="ecore:EClass" href="My.ecore#//1"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//1"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -237,7 +237,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='Container']/@subNodeMappings[name='Attributes']"/> </ownedDiagramElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_rHZlMOS1EeKH-OJR8wbplA" name="border label VSM size: 10 "> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_rHZlMOS1EeKH-OJR8wbplA" name="The border label VSM size is 10 "> <target xmi:type="ecore:EClass" href="My.ecore#//10"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//10"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -285,7 +285,7 @@ <styles xmi:type="notation:FilteringStyle" xmi:id="_XDs_yT19EeO8172-f6hTJg"/> </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_XDs_yj19EeO8172-f6hTJg" fontColor="2697711" fontName="Comic Sans MS" fontHeight="8"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XDs_yz19EeO8172-f6hTJg" x="20" y="9" width="152" height="49"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XDs_yz19EeO8172-f6hTJg" x="20" y="9" width="183" height="49"/> </children> <children xmi:type="notation:Node" xmi:id="_XDs_zD19EeO8172-f6hTJg" type="2003" element="_XDtnAD19EeO8172-f6hTJg"> <children xmi:type="notation:Node" xmi:id="_XDs_zT19EeO8172-f6hTJg" type="5007"/> @@ -298,7 +298,7 @@ <styles xmi:type="notation:FilteringStyle" xmi:id="_XDs_0j19EeO8172-f6hTJg"/> </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_XDs_0z19EeO8172-f6hTJg" fontColor="2697711" fontName="Comic Sans MS" fontHeight="8"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XDs_1D19EeO8172-f6hTJg" x="205" y="11" width="150" height="49"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XDs_1D19EeO8172-f6hTJg" x="205" y="11" width="181" height="49"/> </children> <children xmi:type="notation:Node" xmi:id="_XDs_1T19EeO8172-f6hTJg" type="2003" element="_XDtnCz19EeO8172-f6hTJg"> <children xmi:type="notation:Node" xmi:id="_XDs_1j19EeO8172-f6hTJg" type="5007"/> @@ -311,7 +311,7 @@ <styles xmi:type="notation:FilteringStyle" xmi:id="_XDs_2z19EeO8172-f6hTJg"/> </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_XDs_3D19EeO8172-f6hTJg" fontColor="2697711" fontName="Comic Sans MS" fontHeight="8"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XDs_3T19EeO8172-f6hTJg" x="418" width="175" height="67"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XDs_3T19EeO8172-f6hTJg" x="418" width="206" height="67"/> </children> <children xmi:type="notation:Node" xmi:id="_XDs_3j19EeO8172-f6hTJg" type="2002" element="_XDtnFj19EeO8172-f6hTJg"> <children xmi:type="notation:Node" xmi:id="_XDs_3z19EeO8172-f6hTJg" type="5006"/> @@ -331,7 +331,7 @@ <styles xmi:type="notation:FilteringStyle" xmi:id="_XDtm0z19EeO8172-f6hTJg"/> </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_XDtm1D19EeO8172-f6hTJg" fontColor="2697711" fontName="Comic Sans MS" fontHeight="8"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XDtm1T19EeO8172-f6hTJg" x="10" y="92" width="152" height="74"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XDtm1T19EeO8172-f6hTJg" x="10" y="92" width="183" height="74"/> </children> <children xmi:type="notation:Node" xmi:id="_XDtm1j19EeO8172-f6hTJg" type="2002" element="_XDtnIT19EeO8172-f6hTJg"> <children xmi:type="notation:Node" xmi:id="_XDtm1z19EeO8172-f6hTJg" type="5006"/> @@ -351,7 +351,7 @@ <styles xmi:type="notation:FilteringStyle" xmi:id="_XDtm4j19EeO8172-f6hTJg"/> </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_XDtm4z19EeO8172-f6hTJg" fontColor="2697711" fontName="Comic Sans MS" fontHeight="8"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XDtm5D19EeO8172-f6hTJg" x="202" y="87" width="150" height="74"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XDtm5D19EeO8172-f6hTJg" x="202" y="87" width="181" height="74"/> </children> <children xmi:type="notation:Node" xmi:id="_XDtm5T19EeO8172-f6hTJg" type="2002" element="_XDuN4T19EeO8172-f6hTJg"> <children xmi:type="notation:Node" xmi:id="_XDtm5j19EeO8172-f6hTJg" type="5006"/> @@ -371,12 +371,12 @@ <styles xmi:type="notation:FilteringStyle" xmi:id="_XDtm8T19EeO8172-f6hTJg"/> </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_XDtm8j19EeO8172-f6hTJg" fontColor="2697711" fontName="Comic Sans MS" fontHeight="8"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XDtm8z19EeO8172-f6hTJg" x="413" y="82" width="175" height="92"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XDtm8z19EeO8172-f6hTJg" x="413" y="82" width="206" height="92"/> </children> <styles xmi:type="notation:DiagramStyle" xmi:id="_XDtm9D19EeO8172-f6hTJg"/> </data> </ownedAnnotationEntries> - <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_XDtm9T19EeO8172-f6hTJg" name="border label VSM size: 0 "> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_XDtm9T19EeO8172-f6hTJg" name="The border label VSM size is 0 "> <target xmi:type="ecore:EClass" href="My.ecore#//0"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//0"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -402,7 +402,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='List']/@subNodeMappings[name='Attributes']"/> </ownedElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_XDtnAD19EeO8172-f6hTJg" name="border label VSM size: 1 "> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_XDtnAD19EeO8172-f6hTJg" name="The border label VSM size is 1 "> <target xmi:type="ecore:EClass" href="My.ecore#//1"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//1"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -428,7 +428,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='List']/@subNodeMappings[name='Attributes']"/> </ownedElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_XDtnCz19EeO8172-f6hTJg" name="border label VSM size: 10 "> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_XDtnCz19EeO8172-f6hTJg" name="The border label VSM size is 10 "> <target xmi:type="ecore:EClass" href="My.ecore#//10"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//10"/> <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_XDtnDD19EeO8172-f6hTJg" labelAlignment="LEFT" borderSize="10" borderSizeComputationExpression="<%name%>" backgroundStyle="Liquid"> @@ -451,7 +451,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='List']/@subNodeMappings[name='Attributes']"/> </ownedElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_XDtnFj19EeO8172-f6hTJg" name="border label VSM size: 0 "> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_XDtnFj19EeO8172-f6hTJg" name="The border label VSM size is 0 "> <target xmi:type="ecore:EClass" href="My.ecore#//0"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//0"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -477,7 +477,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='Container']/@subNodeMappings[name='Attributes']"/> </ownedDiagramElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_XDtnIT19EeO8172-f6hTJg" name="border label VSM size: 1 "> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_XDtnIT19EeO8172-f6hTJg" name="The border label VSM size is 1 "> <target xmi:type="ecore:EClass" href="My.ecore#//1"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//1"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -503,7 +503,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='Container']/@subNodeMappings[name='Attributes']"/> </ownedDiagramElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_XDuN4T19EeO8172-f6hTJg" name="border label VSM size: 10 "> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_XDuN4T19EeO8172-f6hTJg" name="The border label VSM size is 10 "> <target xmi:type="ecore:EClass" href="My.ecore#//10"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//10"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -548,7 +548,7 @@ <styles xmi:type="notation:FilteringStyle" xmi:id="_fqu3G0JLEeO5N5dgVuiiuA"/> </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_fqu3HEJLEeO5N5dgVuiiuA" fontColor="2697711" fontName="Comic Sans MS" fontHeight="8"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fqu3HUJLEeO5N5dgVuiiuA" x="20" y="9" width="152" height="47"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fqu3HUJLEeO5N5dgVuiiuA" x="20" y="9" width="183" height="47"/> </children> <children xmi:type="notation:Node" xmi:id="_fqu3HkJLEeO5N5dgVuiiuA" type="2003" element="_fqveUEJLEeO5N5dgVuiiuA"> <children xmi:type="notation:Node" xmi:id="_fqu3H0JLEeO5N5dgVuiiuA" type="5007"/> @@ -561,7 +561,7 @@ <styles xmi:type="notation:FilteringStyle" xmi:id="_fqu3JUJLEeO5N5dgVuiiuA"/> </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_fqu3JkJLEeO5N5dgVuiiuA" fontColor="2697711" fontName="Comic Sans MS" fontHeight="8"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fqu3J0JLEeO5N5dgVuiiuA" x="205" y="11" width="150" height="47"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fqu3J0JLEeO5N5dgVuiiuA" x="205" y="11" width="181" height="47"/> </children> <children xmi:type="notation:Node" xmi:id="_fqu3KEJLEeO5N5dgVuiiuA" type="2003" element="_fqveW0JLEeO5N5dgVuiiuA"> <children xmi:type="notation:Node" xmi:id="_fqu3KUJLEeO5N5dgVuiiuA" type="5007"/> @@ -574,7 +574,7 @@ <styles xmi:type="notation:FilteringStyle" xmi:id="_fqu3L0JLEeO5N5dgVuiiuA"/> </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_fqu3MEJLEeO5N5dgVuiiuA" fontColor="2697711" fontName="Comic Sans MS" fontHeight="8"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fqu3MUJLEeO5N5dgVuiiuA" x="418" width="175" height="65"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fqu3MUJLEeO5N5dgVuiiuA" x="418" width="206" height="65"/> </children> <children xmi:type="notation:Node" xmi:id="_fqu3MkJLEeO5N5dgVuiiuA" type="2002" element="_fqveZkJLEeO5N5dgVuiiuA"> <children xmi:type="notation:Node" xmi:id="_fqu3M0JLEeO5N5dgVuiiuA" type="5006"/> @@ -594,7 +594,7 @@ <styles xmi:type="notation:FilteringStyle" xmi:id="_fqveI0JLEeO5N5dgVuiiuA"/> </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_fqveJEJLEeO5N5dgVuiiuA" fontColor="2697711" fontName="Comic Sans MS" fontHeight="8"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fqveJUJLEeO5N5dgVuiiuA" x="10" y="92" width="152" height="74"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fqveJUJLEeO5N5dgVuiiuA" x="10" y="92" width="183" height="74"/> </children> <children xmi:type="notation:Node" xmi:id="_fqveJkJLEeO5N5dgVuiiuA" type="2002" element="_fqvecUJLEeO5N5dgVuiiuA"> <children xmi:type="notation:Node" xmi:id="_fqveJ0JLEeO5N5dgVuiiuA" type="5006"/> @@ -614,7 +614,7 @@ <styles xmi:type="notation:FilteringStyle" xmi:id="_fqveMkJLEeO5N5dgVuiiuA"/> </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_fqveM0JLEeO5N5dgVuiiuA" fontColor="2697711" fontName="Comic Sans MS" fontHeight="8"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fqveNEJLEeO5N5dgVuiiuA" x="202" y="87" width="150" height="74"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fqveNEJLEeO5N5dgVuiiuA" x="202" y="87" width="181" height="74"/> </children> <children xmi:type="notation:Node" xmi:id="_fqveNUJLEeO5N5dgVuiiuA" type="2002" element="_fqvefEJLEeO5N5dgVuiiuA"> <children xmi:type="notation:Node" xmi:id="_fqveNkJLEeO5N5dgVuiiuA" type="5006"/> @@ -634,12 +634,12 @@ <styles xmi:type="notation:FilteringStyle" xmi:id="_fqveQUJLEeO5N5dgVuiiuA"/> </children> <styles xmi:type="notation:ShapeStyle" xmi:id="_fqveQkJLEeO5N5dgVuiiuA" fontColor="2697711" fontName="Comic Sans MS" fontHeight="8"/> - <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fqveQ0JLEeO5N5dgVuiiuA" x="413" y="82" width="175" height="92"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fqveQ0JLEeO5N5dgVuiiuA" x="413" y="82" width="206" height="92"/> </children> <styles xmi:type="notation:DiagramStyle" xmi:id="_fqveREJLEeO5N5dgVuiiuA"/> </data> </ownedAnnotationEntries> - <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_fqveRUJLEeO5N5dgVuiiuA" name="border label VSM size: 0 "> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_fqveRUJLEeO5N5dgVuiiuA" name="The border label VSM size is 0 "> <target xmi:type="ecore:EClass" href="My.ecore#//0"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//0"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -665,7 +665,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='List']/@subNodeMappings[name='Attributes']"/> </ownedElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_fqveUEJLEeO5N5dgVuiiuA" name="border label VSM size: 1 "> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_fqveUEJLEeO5N5dgVuiiuA" name="The border label VSM size is 1 "> <target xmi:type="ecore:EClass" href="My.ecore#//1"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//1"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -691,7 +691,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='List']/@subNodeMappings[name='Attributes']"/> </ownedElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_fqveW0JLEeO5N5dgVuiiuA" name="border label VSM size: 10 "> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_fqveW0JLEeO5N5dgVuiiuA" name="The border label VSM size is 10 "> <target xmi:type="ecore:EClass" href="My.ecore#//10"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//10"/> <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_fqveXEJLEeO5N5dgVuiiuA" labelAlignment="LEFT" borderSize="10" borderSizeComputationExpression="<%name%>" backgroundStyle="Liquid"> @@ -714,7 +714,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='List']/@subNodeMappings[name='Attributes']"/> </ownedElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_fqveZkJLEeO5N5dgVuiiuA" name="border label VSM size: 0 "> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_fqveZkJLEeO5N5dgVuiiuA" name="The border label VSM size is 0 "> <target xmi:type="ecore:EClass" href="My.ecore#//0"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//0"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -740,7 +740,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='Container']/@subNodeMappings[name='Attributes']"/> </ownedDiagramElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_fqvecUJLEeO5N5dgVuiiuA" name="border label VSM size: 1 "> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_fqvecUJLEeO5N5dgVuiiuA" name="The border label VSM size is 1 "> <target xmi:type="ecore:EClass" href="My.ecore#//1"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//1"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> @@ -766,7 +766,7 @@ <actualMapping xmi:type="description_1:NodeMapping" href="margin.odesign#//@ownedViewpoints[name='margin']/@ownedRepresentations[name='Margin%20Diagram']/@defaultLayer/@containerMappings[name='Container']/@subNodeMappings[name='Attributes']"/> </ownedDiagramElements> </ownedDiagramElements> - <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_fqvefEJLEeO5N5dgVuiiuA" name="border label VSM size: 10 "> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_fqvefEJLEeO5N5dgVuiiuA" name="The border label VSM size is 10 "> <target xmi:type="ecore:EClass" href="My.ecore#//10"/> <semanticElements xmi:type="ecore:EClass" href="My.ecore#//10"/> <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/margin/margin.odesign b/plugins/org.eclipse.sirius.tests.junit/data/unit/margin/margin.odesign index 2fd7866768..4d0f75e48d 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/margin/margin.odesign +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/margin/margin.odesign @@ -11,7 +11,7 @@ <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/> </style> </subNodeMappings> - <style xsi:type="style:FlatContainerStyleDescription" borderSizeComputationExpression="<%name%>" labelExpression="border label VSM size: <%name%> " labelAlignment="LEFT" backgroundStyle="Liquid"> + <style xsi:type="style:FlatContainerStyleDescription" borderSizeComputationExpression="<%name%>" labelExpression="The border label VSM size is <%name%> " labelAlignment="LEFT" backgroundStyle="Liquid"> <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='blue']"/> <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='red']"/> <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='dark_gray']"/> @@ -26,7 +26,7 @@ <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/> </style> </subNodeMappings> - <style xsi:type="style:FlatContainerStyleDescription" borderSizeComputationExpression="<%name%>" labelExpression="border label VSM size: <%name%> " labelAlignment="LEFT" backgroundStyle="Liquid"> + <style xsi:type="style:FlatContainerStyleDescription" borderSizeComputationExpression="<%name%>" labelExpression="The border label VSM size is <%name%> " labelAlignment="LEFT" backgroundStyle="Liquid"> <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='blue']"/> <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='red']"/> <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='dark_gray']"/> diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java index 211eab5c28..cdc890fae4 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java @@ -10,11 +10,6 @@ *******************************************************************************/ package org.eclipse.sirius.tests.suite.diagram; -import junit.framework.JUnit4TestAdapter; -import junit.framework.Test; -import junit.framework.TestSuite; -import junit.textui.TestRunner; - import org.eclipse.core.runtime.Platform; import org.eclipse.sirius.tests.suite.diagram.sequence.AllSequenceDiagramsPluginTests; import org.eclipse.sirius.tests.support.api.TestsUtil; @@ -227,6 +222,11 @@ import org.eclipse.sirius.tests.unit.diagram.vsm.VSMValidationTest; import org.eclipse.sirius.tests.unit.diagram.vsm.VSMWithCustomizationValidationTests; import org.eclipse.sirius.tests.unit.perf.diagram.refresh.connections.DCompartmentConnectionRefreshMgrTest; +import junit.framework.JUnit4TestAdapter; +import junit.framework.Test; +import junit.framework.TestSuite; +import junit.textui.TestRunner; + public class AllDiagramPluginsTests { /** diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/margin/BorderMarginTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/margin/BorderMarginTest.java index 441ef51ec4..7c27b6cef0 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/margin/BorderMarginTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/margin/BorderMarginTest.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.sirius.tests.unit.diagram.layout.margin; -import java.awt.GraphicsEnvironment; import java.util.Collection; import java.util.List; import java.util.Map; @@ -37,7 +36,9 @@ import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramElementContain import org.eclipse.sirius.diagram.ui.edit.api.part.IDiagramContainerEditPart; import org.eclipse.sirius.diagram.ui.edit.api.part.IDiagramListEditPart; import org.eclipse.sirius.diagram.ui.tools.api.editor.DDiagramEditor; +import org.eclipse.sirius.diagram.ui.tools.api.figure.FigureQuery; import org.eclipse.sirius.diagram.ui.tools.api.graphical.edit.styles.IContainerLabelOffsets; +import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.tests.SiriusTestsPlugin; import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase; import org.eclipse.sirius.tests.support.api.TestsUtil; @@ -89,21 +90,21 @@ public class BorderMarginTest extends SiriusDiagramTestCase { { // Comic Sans MS has been used to create the test data, but there are // differences between linux and windows. - listAutoSizes.put(Integer.valueOf(0), new Dimension(152, 49)); - listAutoSizes.put(Integer.valueOf(1), new Dimension(150, 49)); - listAutoSizes.put(Integer.valueOf(10), new Dimension(175, 67)); + listAutoSizes.put(Integer.valueOf(0), new Dimension(183, 49)); + listAutoSizes.put(Integer.valueOf(1), new Dimension(181, 49)); + listAutoSizes.put(Integer.valueOf(10), new Dimension(206, 67)); - listAutoSizesWin.put(Integer.valueOf(0), new Dimension(152, 47)); - listAutoSizesWin.put(Integer.valueOf(1), new Dimension(150, 47)); - listAutoSizesWin.put(Integer.valueOf(10), new Dimension(175, 65)); + listAutoSizesWin.put(Integer.valueOf(0), new Dimension(182, 47)); + listAutoSizesWin.put(Integer.valueOf(1), new Dimension(180, 47)); + listAutoSizesWin.put(Integer.valueOf(10), new Dimension(205, 65)); - containerAutoSizes.put(Integer.valueOf(0), new Dimension(152, 74)); - containerAutoSizes.put(Integer.valueOf(1), new Dimension(150, 74)); - containerAutoSizes.put(Integer.valueOf(10), new Dimension(175, 92)); + containerAutoSizes.put(Integer.valueOf(0), new Dimension(183, 74)); + containerAutoSizes.put(Integer.valueOf(1), new Dimension(181, 74)); + containerAutoSizes.put(Integer.valueOf(10), new Dimension(206, 92)); - containerAutoSizesWin.put(Integer.valueOf(0), new Dimension(152, 74)); - containerAutoSizesWin.put(Integer.valueOf(1), new Dimension(150, 74)); - containerAutoSizesWin.put(Integer.valueOf(10), new Dimension(175, 92)); + containerAutoSizesWin.put(Integer.valueOf(0), new Dimension(182, 74)); + containerAutoSizesWin.put(Integer.valueOf(1), new Dimension(180, 74)); + containerAutoSizesWin.put(Integer.valueOf(10), new Dimension(205, 92)); } private DDiagramEditor diagramEditor; @@ -205,7 +206,11 @@ public class BorderMarginTest extends SiriusDiagramTestCase { /** * Test that auto-size did not change. It could allow to detect unwanted * figure/margin/... changes. Test that scrollbars are not displayed in list - * and containers in auto-size. + * and containers in auto-size.<BR> + * This test is based on the width of the label. Indeed, a font has not the + * same size according to the OS used to launch the test. So we can not use + * a stored value. Only the width is checked because the height is more + * complex. * * @throws Exception */ @@ -229,15 +234,26 @@ public class BorderMarginTest extends SiriusDiagramTestCase { assertEquals("GMF Node should be in auto-size.", -1, ((Size) gmfNode.getLayoutConstraint()).getHeight()); assertEquals("GMF Node should be in auto-size.", -1, ((Size) gmfNode.getLayoutConstraint()).getWidth()); - Dimension expected = getExpectedAutoSize(dde); + String borderSizeString = dde.getName().substring(29, dde.getName().length() - 1); sb.append(" ." + dde.eClass().getName() + " " + dde.getName()); - Dimension figureSize = part.getFigure().getBounds().getSize(); - if (!expected.equals(figureSize)) { - wrongSizes = true; - sb.append(", expected: " + expected); - sb.append(" but was: " + figureSize).append("\n"); - } else { - sb.append(" expected and observed: " + expected).append("\n"); + Option<IFigure> labelFigure = new FigureQuery(part.getFigure()).getLabelFigure(); + if (labelFigure.some()) { + Dimension labelFigureSize = labelFigure.get().getBounds().getSize(); + int borderSize = Integer.valueOf(borderSizeString); + if (borderSize == 0) { + // There is a specific case for border size of 0 pixel. + // It is currently considered as 1 pixel. + borderSize = 1; + } + int expectedWidth = labelFigureSize.width + 2 + (borderSize * 2); + Dimension figureSize = part.getFigure().getBounds().getSize(); + if (expectedWidth != figureSize.width) { + wrongSizes = true; + sb.append(", expected: " + expectedWidth); + sb.append(" but was: " + figureSize.width).append("\n"); + } else { + sb.append(" expected and observed: " + expectedWidth).append("\n"); + } } assertNoVisibleScrollBar(dde, part); @@ -280,17 +296,6 @@ public class BorderMarginTest extends SiriusDiagramTestCase { } } - /** - * Temporary test to display fonts available on OS. - */ - public void testFonts() { - String fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); - - for (int i = 0; i < fonts.length; i++) { - System.out.println(fonts[i]); - } - } - private void assertNoVisibleScrollBar(DDiagramElement dde, AbstractDiagramElementContainerEditPart part) { IFigure hScrollBar = null; IFigure vScrollBar = null; |