Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-01-30 13:30:51 +0000
committerCamille Letavernier2014-01-30 13:30:51 +0000
commit3d98d0203b66ab05bda7c24d2c032c83391023fd (patch)
treeea9e2818983eb9e256d5c8a89b2d4e5b2036ab23 /tests/junit/plugins/infra/gmfdiag
parentbe67bc8bcf1bf5fb870e17af7506dbf405b62885 (diff)
downloadorg.eclipse.papyrus-3d98d0203b66ab05bda7c24d2c032c83391023fd.tar.gz
org.eclipse.papyrus-3d98d0203b66ab05bda7c24d2c032c83391023fd.tar.xz
org.eclipse.papyrus-3d98d0203b66ab05bda7c24d2c032c83391023fd.zip
417178: [CSS] The CSS Engine shall support compartments (Show/Hide,
collapse, show title...) https://bugs.eclipse.org/bugs/show_bug.cgi?id=417178 Add tests
Diffstat (limited to 'tests/junit/plugins/infra/gmfdiag')
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/.project6
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/META-INF/MANIFEST.MF3
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/org.eclipse.papyrus.infra.gmfdiag.css.tests.launch3
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/compartmentsTest/model.di23
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/compartmentsTest/model.notation254
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/compartmentsTest/model.uml44
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/compartments.css39
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/labels.css0
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/AllTests.java4
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java233
10 files changed, 605 insertions, 4 deletions
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/.project b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/.project
index ddbc718c56e..ff2463a3162 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/.project
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/.project
@@ -6,6 +6,11 @@
</projects>
<buildSpec>
<buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
@@ -24,5 +29,6 @@
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/META-INF/MANIFEST.MF
index eb2be6b5fd3..481cbb8fc50 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.resources;bundle-version="3.8.0",
org.eclipse.uml2.uml;bundle-version="4.0.0",
org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.0.0",
- org.junit;bundle-version="4.10.0"
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.infra.gmfdiag.css.tests,
org.eclipse.papyrus.infra.gmfdiag.css.tests.tests
Bundle-Vendor: Eclipse Modeling Project
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/org.eclipse.papyrus.infra.gmfdiag.css.tests.launch b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/org.eclipse.papyrus.infra.gmfdiag.css.tests.launch
index 934fbbe559c..eb1de64a68e 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/org.eclipse.papyrus.infra.gmfdiag.css.tests.launch
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/org.eclipse.papyrus.infra.gmfdiag.css.tests.launch
@@ -23,11 +23,12 @@
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.infra.gmfdiag.css.tests.tests.AllTests"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.infra.gmfdiag.css.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -Xms1024m -Xmx4086m"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -Xms1024m -Xmx4086m -XX:MaxPermSize=512M"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<booleanAttribute key="run_in_ui_thread" value="true"/>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/compartmentsTest/model.di b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/compartmentsTest/model.di
new file mode 100644
index 00000000000..b38a75b62ee
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/compartmentsTest/model.di
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi">
+ <pageList>
+ <availablePage>
+ <emfPageIdentifier href="model.notation#_4EGG0ImVEeOGN4dVepS-Uw"/>
+ </availablePage>
+ <availablePage>
+ <emfPageIdentifier href="model.notation#_8JDKAImVEeOGN4dVepS-Uw"/>
+ </availablePage>
+ </pageList>
+ <sashModel currentSelection="//@sashModel/@windows.0/@children.0">
+ <windows>
+ <children xsi:type="di:TabFolder">
+ <children>
+ <emfPageIdentifier href="model.notation#_4EGG0ImVEeOGN4dVepS-Uw"/>
+ </children>
+ <children>
+ <emfPageIdentifier href="model.notation#_8JDKAImVEeOGN4dVepS-Uw"/>
+ </children>
+ </children>
+ </windows>
+ </sashModel>
+</di:SashWindowsMngr>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/compartmentsTest/model.notation b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/compartmentsTest/model.notation
new file mode 100644
index 00000000000..6fa635f903c
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/compartmentsTest/model.notation
@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:css="http://www.eclipse.org/papyrus/infra/gmfdiag/css" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML">
+ <notation:Diagram xmi:id="_4EGG0ImVEeOGN4dVepS-Uw" type="PapyrusUMLClassDiagram" name="compartments" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_Cz4qUImWEeOGN4dVepS-Uw" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_Cz4qUomWEeOGN4dVepS-Uw" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_Cz4qU4mWEeOGN4dVepS-Uw" type="7017">
+ <children xmi:type="notation:Shape" xmi:id="_U81zwYmWEeOGN4dVepS-Uw" type="3012">
+ <element xmi:type="uml:Property" href="model.uml#_U81zwImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_U81zwomWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_VDYgoYmWEeOGN4dVepS-Uw" type="3012">
+ <element xmi:type="uml:Property" href="model.uml#_VDYgoImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_VDYgoomWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_VJCcsYmWEeOGN4dVepS-Uw" type="3012">
+ <element xmi:type="uml:Property" href="model.uml#_VJCcsImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_VJCcsomWEeOGN4dVepS-Uw"/>
+ </children>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_Cz4qVImWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_Cz4qVYmWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_Cz4qVomWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Cz4qV4mWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_Cz4qWImWEeOGN4dVepS-Uw" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_Cz4qWYmWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_Cz4qWomWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_Cz4qW4mWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Cz4qXImWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_Cz4qXYmWEeOGN4dVepS-Uw" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_Cz4qXomWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_Cz4qX4mWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_Cz4qYImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Cz4qYYmWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_cpYD0ImlEeO69MVKNB7cFw" type="compartment_shape_display">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_cpYD0YmlEeO69MVKNB7cFw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cpYD0omlEeO69MVKNB7cFw"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_CzvgYImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Cz4qUYmWEeOGN4dVepS-Uw" x="45" y="70" width="169"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_DZrfAYmWEeOGN4dVepS-Uw" type="2004">
+ <children xmi:type="notation:DecorationNode" xmi:id="_DZrfA4mWEeOGN4dVepS-Uw" type="5011"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_DZrfBImWEeOGN4dVepS-Uw" type="7006">
+ <children xmi:type="notation:Shape" xmi:id="_V6u_YYmWEeOGN4dVepS-Uw" type="3006">
+ <element xmi:type="uml:Property" href="model.uml#_V6u_YImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_V6u_YomWEeOGN4dVepS-Uw"/>
+ </children>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_DZrfBYmWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_DZrfBomWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_DZrfB4mWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_DZrfCImWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_DZrfCYmWEeOGN4dVepS-Uw" type="7007">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_DZrfComWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_DZrfC4mWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_DZrfDImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_DZrfDYmWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_DZrfDomWEeOGN4dVepS-Uw" type="7008">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_DZrfD4mWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_DZrfEImWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_DZrfEYmWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_DZrfEomWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_cp95sImlEeO69MVKNB7cFw" type="compartment_shape_display">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_cp95sYmlEeO69MVKNB7cFw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cp95somlEeO69MVKNB7cFw"/>
+ </children>
+ <element xmi:type="uml:Interface" href="model.uml#_DZrfAImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_DZrfAomWEeOGN4dVepS-Uw" x="680" y="67"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_Dp5FQImWEeOGN4dVepS-Uw" type="2006">
+ <children xmi:type="notation:DecorationNode" xmi:id="_Dp5FQomWEeOGN4dVepS-Uw" type="5023"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_Dp5FQ4mWEeOGN4dVepS-Uw" type="7015">
+ <children xmi:type="notation:Shape" xmi:id="_EAp_cImWEeOGN4dVepS-Uw" type="3017">
+ <element xmi:type="uml:EnumerationLiteral" href="model.uml#_EAgOcImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_EAp_cYmWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_ENAZYYmWEeOGN4dVepS-Uw" type="3017">
+ <element xmi:type="uml:EnumerationLiteral" href="model.uml#_ENAZYImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_ENAZYomWEeOGN4dVepS-Uw"/>
+ </children>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_Dp5FRImWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_Dp5FRYmWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_Dp5FRomWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Dp5FR4mWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_cqHqsImlEeO69MVKNB7cFw" type="compartment_shape_display">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_cqHqsYmlEeO69MVKNB7cFw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cqHqsomlEeO69MVKNB7cFw"/>
+ </children>
+ <element xmi:type="uml:Enumeration" href="model.uml#_DpvUQImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Dp5FQYmWEeOGN4dVepS-Uw" x="36" y="431"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_az5twYmWEeOGN4dVepS-Uw" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_az5tw4mWEeOGN4dVepS-Uw" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_az5txImWEeOGN4dVepS-Uw" type="7017">
+ <children xmi:type="notation:Shape" xmi:id="_cSX24ImWEeOGN4dVepS-Uw" type="3012">
+ <element xmi:type="uml:Property" href="model.uml#_cSOF4ImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cSX24YmWEeOGN4dVepS-Uw"/>
+ </children>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_az5txYmWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_az5txomWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_az5tx4mWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_az5tyImWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_az5tyYmWEeOGN4dVepS-Uw" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_az5tyomWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_az5ty4mWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_az5tzImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_az5tzYmWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_az5tzomWEeOGN4dVepS-Uw" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_az5tz4mWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_az5t0ImWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_az5t0YmWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_az5t0omWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_cqHqs4mlEeO69MVKNB7cFw" type="compartment_shape_display">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_cqHqtImlEeO69MVKNB7cFw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cqHqtYmlEeO69MVKNB7cFw"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_az5twImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_az5twomWEeOGN4dVepS-Uw" x="42" y="223" width="177" height="163"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_1epSEYmWEeOGN4dVepS-Uw" type="2004">
+ <children xmi:type="notation:DecorationNode" xmi:id="_1epSE4mWEeOGN4dVepS-Uw" type="5011"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_1epSFImWEeOGN4dVepS-Uw" type="7006">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_1epSFYmWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_1epSFomWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_1epSF4mWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_1epSGImWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_1epSGYmWEeOGN4dVepS-Uw" type="7007">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_1epSGomWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_1epSG4mWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_1epSHImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_1epSHYmWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_1epSHomWEeOGN4dVepS-Uw" type="7008">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_1epSH4mWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_1epSIImWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_1epSIYmWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_1epSIomWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_cqHqtomlEeO69MVKNB7cFw" type="compartment_shape_display">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_cqHqt4mlEeO69MVKNB7cFw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cqHquImlEeO69MVKNB7cFw"/>
+ </children>
+ <element xmi:type="uml:Interface" href="model.uml#_1epSEImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_1epSEomWEeOGN4dVepS-Uw" x="683" y="219"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_61R_kYmWEeOGN4dVepS-Uw" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_61R_k4mWEeOGN4dVepS-Uw" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_61R_lImWEeOGN4dVepS-Uw" visible="false" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_61R_lYmWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_61R_lomWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_61R_l4mWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_61R_mImWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_61R_mYmWEeOGN4dVepS-Uw" visible="false" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_61R_momWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_61R_m4mWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_61R_nImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_61R_nYmWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_61R_nomWEeOGN4dVepS-Uw" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_61R_n4mWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_61R_oImWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_61R_oYmWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_61R_oomWEeOGN4dVepS-Uw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_cqHquYmlEeO69MVKNB7cFw" type="compartment_shape_display">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_cqHquomlEeO69MVKNB7cFw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cqHqu4mlEeO69MVKNB7cFw"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_61R_kImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_61R_komWEeOGN4dVepS-Uw" x="42" y="597" height="34"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_9TcEEImWEeOGN4dVepS-Uw" type="2012">
+ <children xmi:type="notation:DecorationNode" xmi:id="_9TcEEomWEeOGN4dVepS-Uw" type="5038"/>
+ <element xmi:type="uml:Comment" href="model.uml#_9S_YIImWEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_9TcEEYmWEeOGN4dVepS-Uw" x="309" y="101"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_D1WR4YmXEeOGN4dVepS-Uw" type="2012">
+ <children xmi:type="notation:DecorationNode" xmi:id="_D1WR44mXEeOGN4dVepS-Uw" type="5038"/>
+ <element xmi:type="uml:Comment" href="model.uml#_D1WR4ImXEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_D1WR4omXEeOGN4dVepS-Uw" x="353" y="588"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_TnYnQYmXEeOGN4dVepS-Uw" type="2012">
+ <children xmi:type="notation:DecorationNode" xmi:id="_TnYnQ4mXEeOGN4dVepS-Uw" type="5038"/>
+ <element xmi:type="uml:Comment" href="model.uml#_TnYnQImXEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_TnYnQomXEeOGN4dVepS-Uw" x="360" y="457"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_anMSAYmXEeOGN4dVepS-Uw" type="2012">
+ <children xmi:type="notation:DecorationNode" xmi:id="_anMSA4mXEeOGN4dVepS-Uw" type="5038"/>
+ <element xmi:type="uml:Comment" href="model.uml#_anMSAImXEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_anMSAomXEeOGN4dVepS-Uw" x="353" y="273" width="148"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_Tfr8cYmaEeOGN4dVepS-Uw" type="2012">
+ <children xmi:type="notation:DecorationNode" xmi:id="_Tfr8c4maEeOGN4dVepS-Uw" type="5038"/>
+ <element xmi:type="uml:Comment" href="model.uml#_Tfr8cImaEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Tfr8comaEeOGN4dVepS-Uw" x="852" y="85" width="167"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_TlMukYmaEeOGN4dVepS-Uw" type="2012">
+ <children xmi:type="notation:DecorationNode" xmi:id="_TlV4gImaEeOGN4dVepS-Uw" type="5038"/>
+ <element xmi:type="uml:Comment" href="model.uml#_TlMukImaEeOGN4dVepS-Uw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_TlMukomaEeOGN4dVepS-Uw" x="859" y="248" width="149"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_4EGG0YmVEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:EObjectListValueStyle" xmi:id="_OgIPAImWEeOGN4dVepS-Uw" name="css_stylesheets" eObjectListValue="_OgIPAYmWEeOGN4dVepS-Uw"/>
+ <styles xmi:type="notation:StringListValueStyle" xmi:id="_PR97oImWEeOGN4dVepS-Uw" name="cssClass"/>
+ <element xmi:type="uml:Model" href="model.uml#_4DWgNImVEeOGN4dVepS-Uw"/>
+ <edges xmi:type="notation:Connector" xmi:id="_BTVBEImXEeOGN4dVepS-Uw" type="4013" source="_9TcEEImWEeOGN4dVepS-Uw" target="_Cz4qUImWEeOGN4dVepS-Uw">
+ <styles xmi:type="notation:FontStyle" xmi:id="_BTVBEYmXEeOGN4dVepS-Uw"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_BTVBEomXEeOGN4dVepS-Uw" points="[-35, 6, 146, -36]$[-97, -8, 84, -50]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_BTeyEImXEeOGN4dVepS-Uw" id="(0.12323943661971831,0.31666666666666665)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_GP624ImXEeOGN4dVepS-Uw" type="4013" source="_D1WR4YmXEeOGN4dVepS-Uw" target="_61R_kYmWEeOGN4dVepS-Uw">
+ <styles xmi:type="notation:FontStyle" xmi:id="_GP624YmXEeOGN4dVepS-Uw"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_GP624omXEeOGN4dVepS-Uw" points="[-88, 4, 270, -13]$[-308, 18, 50, 1]"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_UCAtwImXEeOGN4dVepS-Uw" type="4013" source="_TnYnQYmXEeOGN4dVepS-Uw" target="_Dp5FQImWEeOGN4dVepS-Uw">
+ <styles xmi:type="notation:FontStyle" xmi:id="_UCAtwYmXEeOGN4dVepS-Uw"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_UCAtwomXEeOGN4dVepS-Uw" points="[-16, 1, 271, -20]$[-237, 18, 50, -3]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_UCKewImXEeOGN4dVepS-Uw" id="(0.16,0.35)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_bQjYEImXEeOGN4dVepS-Uw" type="4013" source="_anMSAYmXEeOGN4dVepS-Uw" target="_az5twYmWEeOGN4dVepS-Uw">
+ <styles xmi:type="notation:FontStyle" xmi:id="_bQjYEYmXEeOGN4dVepS-Uw"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_bQjYEomXEeOGN4dVepS-Uw" points="[-74, -1, 224, -18]$[-386, -47, -88, -64]"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_YgJloImaEeOGN4dVepS-Uw" type="4013" source="_TlMukYmaEeOGN4dVepS-Uw" target="_1epSEYmWEeOGN4dVepS-Uw">
+ <styles xmi:type="notation:FontStyle" xmi:id="_YgJloYmaEeOGN4dVepS-Uw"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_YgJloomaEeOGN4dVepS-Uw" points="[-74, -6, 126, 1]$[-192, 45, 8, 52]"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_Y5mAYImaEeOGN4dVepS-Uw" type="4013" source="_Tfr8cYmaEeOGN4dVepS-Uw" target="_DZrfAYmWEeOGN4dVepS-Uw">
+ <styles xmi:type="notation:FontStyle" xmi:id="_Y5mAYYmaEeOGN4dVepS-Uw"/>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_Y5mAYomaEeOGN4dVepS-Uw" points="[-83, -1, 122, -8]$[-198, -48, 7, -55]"/>
+ </edges>
+ </notation:Diagram>
+ <notation:Diagram xmi:id="_8JDKAImVEeOGN4dVepS-Uw" type="PapyrusUMLClassDiagram" name="labels" measurementUnit="Pixel">
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_8JDKAYmVEeOGN4dVepS-Uw"/>
+ <element xmi:type="uml:Model" href="model.uml#_4DWgNImVEeOGN4dVepS-Uw"/>
+ </notation:Diagram>
+ <css:StyleSheetReference xmi:id="_OgIPAYmWEeOGN4dVepS-Uw" path="platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/compartments.css"/>
+</xmi:XMI>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/compartmentsTest/model.uml b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/compartmentsTest/model.uml
new file mode 100644
index 00000000000..b356eaf5ce0
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/compartmentsTest/model.uml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_4DWgNImVEeOGN4dVepS-Uw" name="CSSTests">
+ <ownedComment xmi:type="uml:Comment" xmi:id="__TiJAImVEeOGN4dVepS-Uw">
+ <body>Test model for CSS in Luna >= M5 (Compartments, Labels)</body>
+ </ownedComment>
+ <ownedComment xmi:type="uml:Comment" xmi:id="_9S_YIImWEeOGN4dVepS-Uw" annotatedElement="_CzvgYImWEeOGN4dVepS-Uw">
+ <body>Expected: Attribute collapsed, Nested classifier hidden</body>
+ </ownedComment>
+ <ownedComment xmi:type="uml:Comment" xmi:id="_D1WR4ImXEeOGN4dVepS-Uw" annotatedElement="_61R_kImWEeOGN4dVepS-Uw">
+ <body>Expected: Compartments hidden</body>
+ </ownedComment>
+ <ownedComment xmi:type="uml:Comment" xmi:id="_TnYnQImXEeOGN4dVepS-Uw" annotatedElement="_DpvUQImWEeOGN4dVepS-Uw">
+ <body>Expected: Collapsed = false</body>
+ </ownedComment>
+ <ownedComment xmi:type="uml:Comment" xmi:id="_anMSAImXEeOGN4dVepS-Uw" annotatedElement="_az5twImWEeOGN4dVepS-Uw">
+ <body>Expected: Attribute and Operation visible</body>
+ </ownedComment>
+ <ownedComment xmi:type="uml:Comment" xmi:id="_Tfr8cImaEeOGN4dVepS-Uw" annotatedElement="_DZrfAImWEeOGN4dVepS-Uw">
+ <body>Expected: Compartment Attribute and Operation visible</body>
+ </ownedComment>
+ <ownedComment xmi:type="uml:Comment" xmi:id="_TlMukImaEeOGN4dVepS-Uw" annotatedElement="_1epSEImWEeOGN4dVepS-Uw">
+ <body>Expected: Only operation compartment is visible</body>
+ </ownedComment>
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_4DWgNYmVEeOGN4dVepS-Uw">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Class" xmi:id="_CzvgYImWEeOGN4dVepS-Uw" name="Class1">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_U81zwImWEeOGN4dVepS-Uw" name="P1"/>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_VDYgoImWEeOGN4dVepS-Uw" name="P2"/>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_VJCcsImWEeOGN4dVepS-Uw" name="P3"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Interface" xmi:id="_DZrfAImWEeOGN4dVepS-Uw" name="Interface1">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_V6u_YImWEeOGN4dVepS-Uw" name="Attribute1"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Enumeration" xmi:id="_DpvUQImWEeOGN4dVepS-Uw" name="Enumeration1">
+ <ownedLiteral xmi:type="uml:EnumerationLiteral" xmi:id="_EAgOcImWEeOGN4dVepS-Uw" name="EnumerationLiteral1"/>
+ <ownedLiteral xmi:type="uml:EnumerationLiteral" xmi:id="_ENAZYImWEeOGN4dVepS-Uw" name="EnumerationLiteral2"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Class" xmi:id="_az5twImWEeOGN4dVepS-Uw" name="Class2">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_cSOF4ImWEeOGN4dVepS-Uw" name="P"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Interface" xmi:id="_1epSEImWEeOGN4dVepS-Uw" name="Interface2"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_61R_kImWEeOGN4dVepS-Uw" name="Class3"/>
+</uml:Model>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/compartments.css b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/compartments.css
new file mode 100644
index 00000000000..a07ea565036
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/compartments.css
@@ -0,0 +1,39 @@
+* {
+ showTitle: false;
+}
+
+/* Check showTitle, to avoid priority conflicts with more specific rules */
+.showTitleForAllCompartments Compartment {
+ showTitle: true;
+}
+
+Interface > Compartment[kind=attribute],
+Interface > Compartment[kind=nestedClassifier] {
+ visible:false;
+}
+
+Interface[ownedAttribute] > Compartment[kind=attribute]{
+ visible:true;
+}
+
+Compartment[kind=nestedClassifier] {
+ visible: false;
+}
+
+
+/* Collapse the Attribute compartment if the Class contains a P1 attribute (Displayed) */
+Class[ownedAttribute~="P1"] > Compartment[kind=attribute]{
+ collapsed: true;
+}
+
+Enumeration > Compartment {
+ collapsed: true;
+}
+
+Enumeration > Compartment[kind=EnUmerAtionLiteRal]{ /* Case insensitive */
+ collapsed: false;
+}
+
+Compartment {
+ showTitle: true;
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/labels.css b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/labels.css
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/labels.css
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/AllTests.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/AllTests.java
index 54ee115ce9a..185aab5136d 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/AllTests.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/AllTests.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -17,7 +17,7 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({ CSSClassProviderTest.class, CSSStylesheetTest.class
+@SuiteClasses({ CSSClassProviderTest.class, CSSStylesheetTest.class, CSSCompartmentsTests.class
})
public class AllTests {
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java
new file mode 100644
index 00000000000..c311a50ca4e
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java
@@ -0,0 +1,233 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.tests.tests;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
+import org.eclipse.gmf.runtime.notation.BasicCompartment;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom.CustomStringStyleObservableList;
+import org.eclipse.papyrus.infra.gmfdiag.css.helper.CSSHelper;
+import org.eclipse.papyrus.infra.gmfdiag.css.helper.ResetStyleHelper;
+import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagram;
+import org.eclipse.papyrus.infra.gmfdiag.css.tests.Activator;
+import org.eclipse.uml2.uml.NamedElement;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test case for Compartment-related styles and properties
+ * See resources/model/compartmentsTest/model.di for details
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class CSSCompartmentsTests {
+
+ public static final String CLASS_ATTRIBUTE_COMPARTMENT_TYPE = "7017"; //$NON-NLS-1$
+
+ public static final String CLASS_OPERATION_COMPARTMENT_TYPE = "7018"; //$NON-NLS-1$
+
+ public static final String CLASS_CLASSIFIER_COMPARTMENT_TYPE = "7019"; //$NON-NLS-1$
+
+ public static final String INTERFACE_ATTRIBUTE_COMPARTMENT_TYPE = "7006"; //$NON-NLS-1$
+
+ public static final String INTERFACE_OPERATION_COMPARTMENT_TYPE = "7007"; //$NON-NLS-1$
+
+ public static final String INTERFACE_INTERFACEIFIER_COMPARTMENT_TYPE = "7008"; //$NON-NLS-1$
+
+ public static final String ENUMERATION_LITERAL_COMPARTMENT_TYPE = "7015"; //$NON-NLS-1$
+
+ private CSSDiagram diagram;
+
+ @Before
+ public void init() {
+ ResourceSet resourceSet = new ResourceSetImpl();
+ CSSHelper.installCSSSupport(resourceSet);
+
+ URI uri = URI.createPlatformPluginURI(Activator.PLUGIN_ID + "/resources/model/compartmentsTest/model.notation", true); //$NON-NLS-1$
+ try {
+ Diagram diagram = (Diagram)EMFHelper.loadEMFModel(resourceSet, uri);
+ Assert.assertNotNull("Cannot find the model", diagram);
+ Assert.assertTrue("CSS are not activated on this resource", diagram instanceof CSSDiagram);
+ this.diagram = (CSSDiagram)diagram;
+ } catch (IOException ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ /* Test Class1 and Class2 */
+ @Test
+ public void testAttributeCompartment() {
+ Shape class1 = findShape("Class1");
+ Shape class2 = findShape("Class2");
+
+ BasicCompartment attributes1 = findCompartment(class1, CLASS_ATTRIBUTE_COMPARTMENT_TYPE);
+ Assert.assertTrue("Attribute compartment should be collapsed, as it contains a P1 property", attributes1.isCollapsed());
+ Assert.assertTrue("Attribute compartment should be visible", attributes1.isVisible());
+ BasicCompartment operations1 = findCompartment(class1, CLASS_OPERATION_COMPARTMENT_TYPE);
+ Assert.assertTrue("Operation compartment should be visible", operations1.isVisible());
+ BasicCompartment classifiers1 = findCompartment(class1, CLASS_CLASSIFIER_COMPARTMENT_TYPE);
+ Assert.assertFalse("Classifiers compartment should be hidden", classifiers1.isVisible());
+
+ BasicCompartment attributes2 = findCompartment(class2, CLASS_ATTRIBUTE_COMPARTMENT_TYPE);
+ Assert.assertFalse("Attribute compartment should not be collapsed, as it doesn't contain a P1 property", attributes2.isCollapsed());
+ Assert.assertTrue("Attribute compartment should be visible", attributes2.isVisible());
+ BasicCompartment operations2 = findCompartment(class2, CLASS_OPERATION_COMPARTMENT_TYPE);
+ Assert.assertTrue("Operation compartment should be visible", operations2.isVisible());
+ BasicCompartment classifiers2 = findCompartment(class2, CLASS_CLASSIFIER_COMPARTMENT_TYPE);
+ Assert.assertFalse("Classifiers compartment should be hidden", classifiers2.isVisible());
+
+
+ }
+
+ /* Test Enumeration1 */
+ @Test
+ //Currently fails. The EnumerationLiteral compartment is not defined in the NotationTypesMap
+ public void testCaseInsensitiveForEnumeration() {
+ Shape enumeration = findShape("Enumeration1");
+ BasicCompartment compartment = findCompartment(enumeration, ENUMERATION_LITERAL_COMPARTMENT_TYPE);
+
+ Assert.assertFalse("EnumerationLiteral Compartment should not be collapsed", compartment.isCollapsed());
+ }
+
+ /* Test Interface 1 and Interface 2 */
+ //Currently fails. The interface compartments are not defined in the NotationTypesMap
+ @Test
+ public void testAttributeCompartmentForInterface() {
+ Shape interface1 = findShape("Interface1");
+ Shape interface2 = findShape("Interface2");
+
+ BasicCompartment attributes1 = findCompartment(interface1, INTERFACE_ATTRIBUTE_COMPARTMENT_TYPE);
+ Assert.assertTrue("Attribute compartment should be visible, as it contains a Property", attributes1.isVisible());
+ BasicCompartment operations1 = findCompartment(interface1, INTERFACE_OPERATION_COMPARTMENT_TYPE);
+ Assert.assertTrue("Operation compartment should be visible", operations1.isVisible());
+ BasicCompartment classifiers1 = findCompartment(interface1, INTERFACE_INTERFACEIFIER_COMPARTMENT_TYPE);
+ Assert.assertFalse("Classifiers compartment should be hidden", classifiers1.isVisible());
+
+ BasicCompartment attributes2 = findCompartment(interface2, INTERFACE_ATTRIBUTE_COMPARTMENT_TYPE);
+ Assert.assertFalse("Attribute compartment should not be visible, as it doesn't contain any property", attributes2.isVisible());
+ BasicCompartment operations2 = findCompartment(interface2, INTERFACE_OPERATION_COMPARTMENT_TYPE);
+ Assert.assertTrue("Operation compartment should be visible", operations2.isVisible());
+ BasicCompartment classifiers2 = findCompartment(interface2, INTERFACE_INTERFACEIFIER_COMPARTMENT_TYPE);
+ Assert.assertFalse("Classifiers compartment should be hidden", classifiers2.isVisible());
+ }
+
+ /* Test Class 3 */
+ @Test
+ public void testCompartmentForceValue() {
+ //Test initial situation
+ Shape class3 = findShape("Class3");
+
+ //Check all compartments
+ for(View childNode : (List<View>)class3.getChildren()) {
+ if(childNode instanceof BasicCompartment) {
+ Assert.assertFalse("All compartments from Class3 should be hidden", childNode.isVisible());
+ }
+ }
+
+ //We need an editingDomain for the ResetStyle operation
+ new TransactionalEditingDomainImpl(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE), diagram.eResource().getResourceSet());
+
+ //Test resetStyle
+ ResetStyleHelper.resetStyle(Collections.singleton(class3));
+ //Check only some specific compartments. Some style rules still hide the nestedClassifier compartment. The visibility of e.g. the ShapeCompartment is undetermined.
+ BasicCompartment attributesCompartment = findCompartment(class3, CLASS_ATTRIBUTE_COMPARTMENT_TYPE);
+ BasicCompartment operationsCompartment = findCompartment(class3, CLASS_OPERATION_COMPARTMENT_TYPE);
+
+ Assert.assertTrue("Attributes compartment should be visible after the reset style", attributesCompartment.isVisible());
+ Assert.assertTrue("Operations compartment should be visible after the reset style", operationsCompartment.isVisible());
+ }
+
+ /* Test apply style */
+ @Test
+ //Currently fails. showTitle is not properly supported for BasicCompartments
+ //Unlike Compartment, BasicCompartment doesn't implement TitleStyle. Instead,
+ //it owns a specific instance of TitleStyle, which is not supported by the CSS Engine (?)
+ public void testShowAllCompartmentsTitles() {
+ //Initial state: title should be hidden
+ for(View childNode : (List<View>)diagram.getChildren()) {
+ for(View compartment : (List<View>)childNode.getChildren()) {
+ if(compartment instanceof BasicCompartment) {
+ TitleStyle titleStyle = (TitleStyle)compartment.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ Assert.assertFalse("Title should be hidden", titleStyle.isShowTitle());
+ }
+ }
+ }
+
+ //Apply style
+ CustomStringStyleObservableList stylesList = new CustomStringStyleObservableList(diagram, null, "cssClass");
+ stylesList.add("showTitleForAllCompartments");
+
+ //Check that all titles are visible
+ for(View childNode : (List<View>)diagram.getChildren()) {
+ for(View compartment : (List<View>)childNode.getChildren()) {
+ if(compartment instanceof BasicCompartment) {
+ TitleStyle titleStyle = (TitleStyle)compartment.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ Assert.assertTrue("Title should be visible", titleStyle.isShowTitle());
+ }
+ }
+ }
+ }
+
+
+ @After
+ public void dispose() {
+ Iterator<Resource> iterator = diagram.eResource().getResourceSet().getResources().iterator();
+ while(iterator.hasNext()) {
+ iterator.next().unload();
+ iterator.remove();
+ }
+ }
+
+ private BasicCompartment findCompartment(Shape element, String type) {
+ for(View childNode : (List<View>)element.getChildren()) {
+ if(type.equals(childNode.getType())) {
+ return (BasicCompartment)childNode;
+ }
+ }
+
+ return null;
+ }
+
+ private Shape findShape(String elementName) {
+ for(Object viewObject : diagram.getChildren()) {
+ View view = (View)viewObject;
+ if(view instanceof Shape && view.getElement() instanceof NamedElement) {
+ NamedElement element = (NamedElement)view.getElement();
+ if(elementName.equals(element.getName())) {
+ return (Shape)view;
+ }
+ }
+ }
+
+ Assert.fail("Cannot find the view associated to " + elementName);
+ return null;
+ }
+
+}

Back to the top