summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael ADAM2014-05-19 13:38:30 (EDT)
committerCamille Letavernier2014-05-19 13:38:30 (EDT)
commit6b5830d267b7330ac146898fc11b3e2138509330 (patch)
treeca0c1584fa1372d376865f7354e66fe395e95370
parent1f5b965bce65e0098d0d6e95b3a07df6611b47ae (diff)
downloadorg.eclipse.papyrus-6b5830d267b7330ac146898fc11b3e2138509330.zip
org.eclipse.papyrus-6b5830d267b7330ac146898fc11b3e2138509330.tar.gz
org.eclipse.papyrus-6b5830d267b7330ac146898fc11b3e2138509330.tar.bz2
434978: [CSS] JUnit tests must be created to Stylesheets applied to arefs/changes/85/26685/3
model https://bugs.eclipse.org/bugs/show_bug.cgi?id=434978 - Add Junit tests for CSS applied to a model. - Test the highter priority of a diagram CSS relative to model CSS. Change-Id: I5df1fd2ccb85dd43373a1c98ea29e6998b6927a4 Signed-off-by: Mickael ADAM <mickael.adam@ALL4TEC.net>
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/modelStylesheetTest/model.di17
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/modelStylesheetTest/model.notation287
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/modelStylesheetTest/model.uml18
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/ModelStylesheetTest.css15
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/stylesheetTest.css5
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/AbstractCSSStylesheetTest.java156
-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.java6
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSModelStylesheetTest.java64
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSStylesheetTest.java142
9 files changed, 565 insertions, 145 deletions
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/modelStylesheetTest/model.di b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/modelStylesheetTest/model.di
new file mode 100644
index 0000000..15fd7df
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/modelStylesheetTest/model.di
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="ASCII"?>
+<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#_o6cwoH_vEeGjwt6V_QPj1Q"/>
+ </availablePage>
+ </pageList>
+ <sashModel currentSelection="//@sashModel/@windows.0/@children.0">
+ <windows>
+ <children xsi:type="di:TabFolder">
+ <children>
+ <emfPageIdentifier href="model.notation#_o6cwoH_vEeGjwt6V_QPj1Q"/>
+ </children>
+ </children>
+ </windows>
+ </sashModel>
+</di:SashWindowsMngr>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/modelStylesheetTest/model.notation b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/modelStylesheetTest/model.notation
new file mode 100644
index 0000000..ff03f22
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/modelStylesheetTest/model.notation
@@ -0,0 +1,287 @@
+<?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:uml="http://www.eclipse.org/uml2/5.0.0/UML">
+ <notation:Diagram xmi:id="_o6cwoH_vEeGjwt6V_QPj1Q" type="PapyrusUMLClassDiagram" name="NewDiagram" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_prvDoH_vEeGjwt6V_QPj1Q" type="2008" transparency="0">
+ <children xmi:type="notation:DecorationNode" xmi:id="_prwRxH_vEeGjwt6V_QPj1Q" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_prwRxX_vEeGjwt6V_QPj1Q" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_prwRxn_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_prwRx3_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_prwRyH_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_prwRyX_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_prwRyn_vEeGjwt6V_QPj1Q" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_prwRy3_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_prwRzH_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_prwRzX_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_prwRzn_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_prw40H_vEeGjwt6V_QPj1Q" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_prw40X_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_prw40n_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_prw403_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_prw41H_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_pqo3cH_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_prvDoX_vEeGjwt6V_QPj1Q" x="235" y="170"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_pwH0YH_vEeGjwt6V_QPj1Q" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_pwIbdn_vEeGjwt6V_QPj1Q" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_pwIbd3_vEeGjwt6V_QPj1Q" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_pwIbeH_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_pwIbeX_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_pwIben_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_pwIbe3_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_pwIbfH_vEeGjwt6V_QPj1Q" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_pwIbfX_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_pwIbfn_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_pwIbf3_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_pwIbgH_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_pwIbgX_vEeGjwt6V_QPj1Q" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_pwIbgn_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_pwIbg3_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_pwIbhH_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_pwIbhX_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_pwFYIH_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_pwH0YX_vEeGjwt6V_QPj1Q" x="540" y="165"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_qRBiAH_vEeGjwt6V_QPj1Q" type="2004">
+ <children xmi:type="notation:DecorationNode" xmi:id="_qRCwJn_vEeGjwt6V_QPj1Q" type="5011"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_qRCwJ3_vEeGjwt6V_QPj1Q" type="7006">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_qRCwKH_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_qRCwKX_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_qRDXMH_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qRDXMX_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_qRDXMn_vEeGjwt6V_QPj1Q" type="7007">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_qRDXM3_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_qRDXNH_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_qRDXNX_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qRDXNn_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_qRDXN3_vEeGjwt6V_QPj1Q" type="7008">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_qRDXOH_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_qRDXOX_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_qRDXOn_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qRDXO3_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <element xmi:type="uml:Interface" href="model.uml#_qQ-esH_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qRBiAX_vEeGjwt6V_QPj1Q" x="134" y="378"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_qWScgH_vEeGjwt6V_QPj1Q" type="2004">
+ <children xmi:type="notation:DecorationNode" xmi:id="_qWTqon_vEeGjwt6V_QPj1Q" type="5011"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_qWTqo3_vEeGjwt6V_QPj1Q" type="7006">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_qWTqpH_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_qWTqpX_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_qWTqpn_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qWTqp3_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_qWTqqH_vEeGjwt6V_QPj1Q" type="7007">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_qWTqqX_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_qWTqqn_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_qWTqq3_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qWTqrH_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_qWTqrX_vEeGjwt6V_QPj1Q" type="7008">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_qWTqrn_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_qWTqr3_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_qWTqsH_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qWTqsX_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <styles xmi:type="notation:StringListValueStyle" xmi:id="_yGpacH_vEeGjwt6V_QPj1Q" name="cssClass">
+ <stringListValue>myInterface</stringListValue>
+ </styles>
+ <element xmi:type="uml:Interface" href="model.uml#_qWPZMH_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qWScgX_vEeGjwt6V_QPj1Q" x="450" y="375"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_qcFigH_vEeGjwt6V_QPj1Q" type="2004">
+ <children xmi:type="notation:DecorationNode" xmi:id="_qcGwoX_vEeGjwt6V_QPj1Q" type="5011"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_qcGwon_vEeGjwt6V_QPj1Q" type="7006">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_qcGwo3_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_qcGwpH_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_qcGwpX_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qcGwpn_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_qcGwp3_vEeGjwt6V_QPj1Q" type="7007">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_qcGwqH_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_qcGwqX_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_qcGwqn_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qcGwq3_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_qcGwrH_vEeGjwt6V_QPj1Q" type="7008">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_qcGwrX_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_qcGwrn_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_qcGwr3_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qcGwsH_vEeGjwt6V_QPj1Q"/>
+ </children>
+ <element xmi:type="uml:Interface" href="model.uml#_qcCfMH_vEeGjwt6V_QPj1Q"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qcFigX_vEeGjwt6V_QPj1Q" x="720" y="370"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_j7FOcIABEeGwNeJPoDbgzg" type="2007">
+ <children xmi:type="notation:DecorationNode" xmi:id="_j7HqsoABEeGwNeJPoDbgzg" type="5026"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_j7Hqs4ABEeGwNeJPoDbgzg" type="7016">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_j7HqtIABEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_j7HqtYABEeGwNeJPoDbgzg"/>
+ </children>
+ <element xmi:type="uml:Package" href="model.uml#_j6agEIABEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_j7FOcYABEeGwNeJPoDbgzg" x="715" y="95" width="186" height="131"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="__AfVgIABEeGwNeJPoDbgzg" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="__AgjpoABEeGwNeJPoDbgzg" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="__Agjp4ABEeGwNeJPoDbgzg" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="__AhKsIABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="__AhKsYABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="__AhKsoABEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="__AhKs4ABEeGwNeJPoDbgzg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="__AhKtIABEeGwNeJPoDbgzg" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="__AhKtYABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="__AhKtoABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="__AhKt4ABEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="__AhKuIABEeGwNeJPoDbgzg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="__AhKuYABEeGwNeJPoDbgzg" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="__AhKuoABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="__AhKu4ABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="__AhKvIABEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="__AhKvYABEeGwNeJPoDbgzg"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#__AZ18IABEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="__AfVgYABEeGwNeJPoDbgzg" x="105" y="525"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="__TuakIABEeGwNeJPoDbgzg" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="__TvotIABEeGwNeJPoDbgzg" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="__TvotYABEeGwNeJPoDbgzg" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="__TvotoABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="__Tvot4ABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="__TvouIABEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="__TvouYABEeGwNeJPoDbgzg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="__TvouoABEeGwNeJPoDbgzg" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="__Tvou4ABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="__TvovIABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="__TvovYABEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="__TwPwIABEeGwNeJPoDbgzg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="__TwPwYABEeGwNeJPoDbgzg" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="__TwPwoABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="__TwPw4ABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="__TwPxIABEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="__TwPxYABEeGwNeJPoDbgzg"/>
+ </children>
+ <styles xmi:type="notation:StringListValueStyle" xmi:id="_R7m7sIACEeGwNeJPoDbgzg" name="cssClass">
+ <stringListValue>myClass</stringListValue>
+ <stringListValue>myOtherClass</stringListValue>
+ </styles>
+ <element xmi:type="uml:Class" href="model.uml#__TtMcIABEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="__TuakYABEeGwNeJPoDbgzg" x="363" y="528"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="__jbqgIABEeGwNeJPoDbgzg" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="__jcRl4ABEeGwNeJPoDbgzg" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="__jcRmIABEeGwNeJPoDbgzg" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="__jcRmYABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="__jcRmoABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="__jcRm4ABEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="__jcRnIABEeGwNeJPoDbgzg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="__jc4oIABEeGwNeJPoDbgzg" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="__jc4oYABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="__jc4ooABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="__jc4o4ABEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="__jc4pIABEeGwNeJPoDbgzg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="__jc4pYABEeGwNeJPoDbgzg" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="__jc4poABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="__jc4p4ABEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="__jc4qIABEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="__jc4qYABEeGwNeJPoDbgzg"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#__jacYIABEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="__jbqgYABEeGwNeJPoDbgzg" x="647" y="541"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_aQdt0IACEeGwNeJPoDbgzg" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_aQe79IACEeGwNeJPoDbgzg" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_aQe79YACEeGwNeJPoDbgzg" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_aQe79oACEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_aQe794ACEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_aQe7-IACEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_aQe7-YACEeGwNeJPoDbgzg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_aQe7-oACEeGwNeJPoDbgzg" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_aQe7-4ACEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_aQe7_IACEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_aQe7_YACEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_aQe7_oACEeGwNeJPoDbgzg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_aQfjAIACEeGwNeJPoDbgzg" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_aQfjAYACEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_aQfjAoACEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_aQfjA4ACEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_aQfjBIACEeGwNeJPoDbgzg"/>
+ </children>
+ <styles xmi:type="notation:StringListValueStyle" xmi:id="_bTq3QIACEeGwNeJPoDbgzg" name="cssClass">
+ <stringListValue>myClass</stringListValue>
+ </styles>
+ <element xmi:type="uml:Class" href="model.uml#_aQb4oIACEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_aQdt0YACEeGwNeJPoDbgzg" x="859" y="555"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_b0maEIACEeGwNeJPoDbgzg" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_b0oPQIACEeGwNeJPoDbgzg" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_b0oPQYACEeGwNeJPoDbgzg" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_b0oPQoACEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_b0oPQ4ACEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_b0oPRIACEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_b0oPRYACEeGwNeJPoDbgzg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_b0oPRoACEeGwNeJPoDbgzg" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_b0oPR4ACEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_b0oPSIACEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_b0oPSYACEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_b0oPSoACEeGwNeJPoDbgzg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_b0oPS4ACEeGwNeJPoDbgzg" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_b0oPTIACEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_b0oPTYACEeGwNeJPoDbgzg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_b0oPToACEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_b0oPT4ACEeGwNeJPoDbgzg"/>
+ </children>
+ <styles xmi:type="notation:StringListValueStyle" xmi:id="_dz2VAIACEeGwNeJPoDbgzg" name="cssClass">
+ <stringListValue>myClass</stringListValue>
+ </styles>
+ <element xmi:type="uml:Class" href="model.uml#_b0lL8IACEeGwNeJPoDbgzg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_b0maEYACEeGwNeJPoDbgzg" x="490" y="610"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_PSJHANt1EeOqjfzVFOrWIg" type="2002">
+ <children xmi:type="notation:DecorationNode" xmi:id="_PSJuENt1EeOqjfzVFOrWIg" type="5005"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_PSKVINt1EeOqjfzVFOrWIg" type="7002">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_PSKVIdt1EeOqjfzVFOrWIg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PSKVItt1EeOqjfzVFOrWIg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PSKVI9t1EeOqjfzVFOrWIg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PSKVJNt1EeOqjfzVFOrWIg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_PSK8MNt1EeOqjfzVFOrWIg" type="7003">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_PSK8Mdt1EeOqjfzVFOrWIg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PSK8Mtt1EeOqjfzVFOrWIg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PSK8M9t1EeOqjfzVFOrWIg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PSK8NNt1EeOqjfzVFOrWIg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_PSLjQNt1EeOqjfzVFOrWIg" type="7004">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_PSLjQdt1EeOqjfzVFOrWIg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_PSLjQtt1EeOqjfzVFOrWIg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_PSLjQ9t1EeOqjfzVFOrWIg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PSLjRNt1EeOqjfzVFOrWIg"/>
+ </children>
+ <element xmi:type="uml:Component" href="model.uml#_PSFcoNt1EeOqjfzVFOrWIg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_PSJHAdt1EeOqjfzVFOrWIg" x="121" y="158"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_o6cwoX_vEeGjwt6V_QPj1Q"/>
+ <styles xmi:type="notation:EObjectListValueStyle" xmi:id="_wKMU0H_vEeGjwt6V_QPj1Q" name="css_stylesheets" eObjectListValue="_3CgL0Nt3EeOqjfzVFOrWIg"/>
+ <element xmi:type="uml:Model" href="model.uml#_o6SYkH_vEeGjwt6V_QPj1Q"/>
+ </notation:Diagram>
+ <css:ModelStyleSheets xmi:id="_qfstMNtkEeODyIXFMLqUjw">
+ <stylesheets xmi:type="css:StyleSheetReference" xmi:id="_wKMU0X_vEeGjwt6V_QPj1Q" path="../../stylesheets/stylesheetTest.css"/>
+ </css:ModelStyleSheets>
+ <css:StyleSheetReference xmi:id="_3CgL0Nt3EeOqjfzVFOrWIg" path="../../stylesheets/ModelStylesheetTest.css"/>
+</xmi:XMI>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/modelStylesheetTest/model.uml b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/modelStylesheetTest/model.uml
new file mode 100644
index 0000000..44c585d
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/modelStylesheetTest/model.uml
@@ -0,0 +1,18 @@
+<?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="_o6SYkH_vEeGjwt6V_QPj1Q" name="Model">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_o6SYkX_vEeGjwt6V_QPj1Q">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Class" xmi:id="_pqo3cH_vEeGjwt6V_QPj1Q" name="Class1"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_pwFYIH_vEeGjwt6V_QPj1Q" name="Class2"/>
+ <packagedElement xmi:type="uml:Interface" xmi:id="_qQ-esH_vEeGjwt6V_QPj1Q" name="Interface1"/>
+ <packagedElement xmi:type="uml:Interface" xmi:id="_qWPZMH_vEeGjwt6V_QPj1Q" name="Interface2"/>
+ <packagedElement xmi:type="uml:Interface" xmi:id="_qcCfMH_vEeGjwt6V_QPj1Q" name="Interface3"/>
+ <packagedElement xmi:type="uml:Package" xmi:id="_j6agEIABEeGwNeJPoDbgzg" name="Package1"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="__AZ18IABEeGwNeJPoDbgzg" name="Class3" isAbstract="true"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="__TtMcIABEeGwNeJPoDbgzg" name="Class4" isAbstract="true"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="__jacYIABEeGwNeJPoDbgzg" name="Class5" isAbstract="true"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_aQb4oIACEeGwNeJPoDbgzg" name="Class6"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_b0lL8IACEeGwNeJPoDbgzg" name="Class7" isAbstract="true"/>
+ <packagedElement xmi:type="uml:Component" xmi:id="_PSFcoNt1EeOqjfzVFOrWIg" name="Component1"/>
+</uml:Model>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/ModelStylesheetTest.css b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/ModelStylesheetTest.css
new file mode 100644
index 0000000..4dee630
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/ModelStylesheetTest.css
@@ -0,0 +1,15 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+
+/* Component in Red */
+Component {
+ gradient:none;
+ fillColor:lime;
+} \ No newline at end of file
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/stylesheetTest.css b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/stylesheetTest.css
index 0542d4d..2bde9cb 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/stylesheetTest.css
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/stylesheetTest.css
@@ -53,3 +53,8 @@ Class[isAbstract=true] {
fillColor: rgb(195, 205, 255);
gradient: white vertical;
}
+
+Component {
+ gradient:none;
+ fillColor:rgb(0, 0, 255);
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/AbstractCSSStylesheetTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/AbstractCSSStylesheetTest.java
new file mode 100644
index 0000000..da172b6
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/AbstractCSSStylesheetTest.java
@@ -0,0 +1,156 @@
+/*****************************************************************************
+ * Copyright (c) 2012, 2014 CEA LIST 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 422257
+ * MickaŽl ADAM (ALL4TEC) mickael.adam@all4tec.net
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.tests.tests;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.gmf.runtime.notation.GradientStyle;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
+import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagram;
+import org.eclipse.papyrus.junit.utils.rules.HouseKeeper;
+import org.eclipse.papyrus.junit.utils.tests.AbstractPapyrusTest;
+import org.eclipse.uml2.uml.NamedElement;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ *
+ * An abstract Class to test CSSStylesheet. The Papyrus model tested is "../../model/stylesheetTest/".
+ * In the daughter's class you must implement initCSSTheme() with the @BeforeClass tag and init() with the @Before tag.
+ *
+ * @author Mickael ADAM
+ *
+ */
+public abstract class AbstractCSSStylesheetTest extends AbstractPapyrusTest {
+
+ @Rule
+ public final HouseKeeper houseKeeper = new HouseKeeper();
+
+ protected CSSDiagram diagram;
+
+ abstract void init();
+
+ @Test
+ public void testClassStyle() {
+ Shape classView = findShape("Class1");
+ if(classView == null) {
+ return;
+ }
+ Assert.assertEquals("Invalid color", rgb(255, 0, 0), classView.getFillColor()); //Red = #FF0000
+ Assert.assertNull("Invalid gradient", classView.getGradient());
+ Assert.assertTrue("The element icon should be displayed", AppearanceHelper.showElementIcon(classView));
+ }
+
+ @Test
+ public void testInterfaceStyle() {
+ Shape interfaceView = findShape("Interface1");
+ Assert.assertNotNull("The interface should have a gradient", interfaceView.getGradient());
+ Assert.assertEquals("The fill color should be yellow", rgb(255, 255, 0), interfaceView.getFillColor()); //Yellow = #FFFF00
+ Assert.assertEquals("The gradient should be red", rgb(255, 0, 0), interfaceView.getGradient().getGradientColor1()); //Red = #FF0000
+ Assert.assertEquals("The gradient should be vertical", GradientStyle.VERTICAL, interfaceView.getGradient().getGradientStyle());
+ Assert.assertTrue("The element icon should be displayed", AppearanceHelper.showElementIcon(interfaceView));
+ }
+
+ @Test
+ public void testCSSClassStyle() {
+ Shape interfaceView = findShape("Interface2");
+ Assert.assertNotNull("The interface should have a gradient", interfaceView.getGradient());
+ Assert.assertEquals("The fill color should be light green (#90EE90)", rgb(144, 238, 144), interfaceView.getFillColor()); //Lightgreen = #90EE90
+ //Case insensitive color name
+ Assert.assertEquals(rgb(0, 191, 255), interfaceView.getGradient().getGradientColor1()); //DeepSkyBlue = #00BFFF
+ Assert.assertEquals(GradientStyle.HORIZONTAL, interfaceView.getGradient().getGradientStyle());
+ Assert.assertFalse(AppearanceHelper.showElementIcon(interfaceView));
+ //TODO: Font names should be case-insensitive
+ Assert.assertEquals("KaiTi", interfaceView.getFontName());
+ }
+
+ @Test
+ public void testPackage() {
+ Shape packageView = findShape("Package1");
+ Assert.assertNotNull(packageView.getGradient());
+ //Inherited style (From *)
+ Assert.assertEquals(rgb(255, 0, 0), packageView.getGradient().getGradientColor1()); //Red = #FF0000
+ }
+
+ @Test
+ public void testPriorities() {
+ //Tests the priorities between styles:
+ //.myClass : Low priority
+ //.myClass.myOtherClass : Highest priority
+ //[isAbstract=true] : Medium priority
+ //Styles should also be merged when they aren't conflicting (ie. [isAbstract] + .myClass -> fontName = Tunga)
+ Shape class3 = findShape("Class3");
+ Shape class5 = findShape("Class5");
+ testBlueStyle(class3); //isAbstract
+ testBlueStyle(class5); //isAbstract
+ Shape class4 = findShape("Class4");
+ testWhiteStyle(class4); //.myClass.myOtherClass (Overrides isAbstract)
+ testFontName(class4); //.myClass (Doesn't conflict with isAbstract)
+ Shape class6 = findShape("Class6");
+ testWhiteStyle(class6); //.myClass
+ testFontName(class6); //.myClass
+ Shape class7 = findShape("Class7");
+ testBlueStyle(class7); //isAbstract
+ testFontName(class7); //.myClass (Doesn't conflict with isAbstract)
+ }
+
+ private void testBlueStyle(Shape shape) {
+ Assert.assertEquals(rgb(195, 205, 255), shape.getFillColor()); //rgb syntax
+ Assert.assertTrue(shape.isBold());
+ Assert.assertNotNull(shape.getGradient());
+ }
+
+ private void testWhiteStyle(Shape shape) {
+ Assert.assertEquals(rgb(255, 255, 255), shape.getFillColor()); //White = #FFFFFF (Hexa syntax)
+ Assert.assertFalse(shape.isBold());
+ Assert.assertNull(shape.getGradient());
+ }
+
+ private void testFontName(Shape shape) {
+ Assert.assertEquals("Tunga", shape.getFontName());
+ }
+
+ @After
+ public void dispose() {
+ Iterator<Resource> iterator = diagram.eResource().getResourceSet().getResources().iterator();
+ while(iterator.hasNext()) {
+ iterator.next().unload();
+ iterator.remove();
+ }
+ }
+
+ protected int rgb(int red, int green, int blue) {
+ return red | green << 8 | blue << 16;
+ }
+
+ protected 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;
+ }
+}
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 2148351..38d5847 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
@@ -17,9 +17,7 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({ CSSClassProviderTest.class, CSSStylesheetTest.class, CSSCompartmentsTests.class, CSSSupportTest.class
-
-})
+@SuiteClasses({ CSSClassProviderTest.class, CSSStylesheetTest.class, CSSModelStylesheetTest.class, CSSCompartmentsTests.class, CSSSupportTest.class })
public class AllTests {
-
+ //Test suite
}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSModelStylesheetTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSModelStylesheetTest.java
new file mode 100644
index 0000000..b5c4d93
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSModelStylesheetTest.java
@@ -0,0 +1,64 @@
+/*****************************************************************************
+ * Copyright (c) 2012, 2014 CEA LIST 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:
+ * MickaŽl ADAM (ALL4TEC) mickael.adam@all4tec.net
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.tests.tests;
+
+import java.io.IOException;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.css.engine.WorkspaceCSSEngine;
+import org.eclipse.papyrus.infra.gmfdiag.css.helper.CSSHelper;
+import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagram;
+import org.eclipse.papyrus.infra.gmfdiag.css.preferences.ThemePreferences;
+import org.eclipse.papyrus.infra.gmfdiag.css.tests.Activator;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CSSModelStylesheetTest extends AbstractCSSStylesheetTest {
+
+ @BeforeClass
+ public static void initCSSTheme() {
+ IPreferenceStore cssThemePreferences = org.eclipse.papyrus.infra.gmfdiag.css.Activator.getDefault().getPreferenceStore();
+ cssThemePreferences.setValue(ThemePreferences.CURRENT_THEME, "org.eclipse.papyrus.css.papyrus_theme");
+ WorkspaceCSSEngine.instance.reset();
+ }
+
+ @Before
+ public void init() {
+ ResourceSet resourceSet = houseKeeper.createResourceSet();
+ CSSHelper.installCSSSupport(resourceSet);
+ URI modelURI = URI.createPlatformPluginURI(Activator.PLUGIN_ID + "/resources/model/ModelStylesheetTest/model.notation", true);
+ try {
+ Diagram diagram = (Diagram)EMFHelper.loadEMFModel(resourceSet, modelURI);
+ 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
+ public void testStyleSheetsPriorities() {
+ //Diagram CSS have a highter priority than Model CSS
+ //Component for Model CSS is Red and for diagram must be Lime
+ Shape componentView = findShape("Component1");
+ Assert.assertEquals("Invalid color", rgb(0, 255, 0), componentView.getFillColor()); //RGB(0,255,0)
+ }
+}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSStylesheetTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSStylesheetTest.java
index 80ed236..65a89b6 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSStylesheetTest.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSStylesheetTest.java
@@ -14,40 +14,22 @@
package org.eclipse.papyrus.infra.gmfdiag.css.tests.tests;
import java.io.IOException;
-import java.util.Iterator;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.GradientStyle;
-import org.eclipse.gmf.runtime.notation.Shape;
-import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.engine.WorkspaceCSSEngine;
import org.eclipse.papyrus.infra.gmfdiag.css.helper.CSSHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagram;
import org.eclipse.papyrus.infra.gmfdiag.css.preferences.ThemePreferences;
import org.eclipse.papyrus.infra.gmfdiag.css.tests.Activator;
-import org.eclipse.papyrus.junit.utils.rules.HouseKeeper;
-import org.eclipse.papyrus.junit.utils.tests.AbstractPapyrusTest;
-import org.eclipse.uml2.uml.NamedElement;
-import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class CSSStylesheetTest extends AbstractPapyrusTest {
-
- @Rule
- public final HouseKeeper houseKeeper = new HouseKeeper();
-
- private CSSDiagram diagram;
+public class CSSStylesheetTest extends AbstractCSSStylesheetTest {
@BeforeClass
public static void initCSSTheme() {
@@ -60,7 +42,6 @@ public class CSSStylesheetTest extends AbstractPapyrusTest {
public void init() {
ResourceSet resourceSet = houseKeeper.createResourceSet();
CSSHelper.installCSSSupport(resourceSet);
-
URI uri = URI.createPlatformPluginURI(Activator.PLUGIN_ID + "/resources/model/stylesheetTest/model.notation", true);
try {
Diagram diagram = (Diagram)EMFHelper.loadEMFModel(resourceSet, uri);
@@ -71,125 +52,4 @@ public class CSSStylesheetTest extends AbstractPapyrusTest {
Activator.log.error(ex);
}
}
-
- @Test
- public void testClassStyle() {
- Shape classView = findShape("Class1");
- if(classView == null) {
- return;
- }
-
- Assert.assertEquals("Invalid color", rgb(255, 0, 0), classView.getFillColor()); //Red = #FF0000
- Assert.assertNull("Invalid gradient", classView.getGradient());
- Assert.assertTrue("The element icon should be displayed", AppearanceHelper.showElementIcon(classView));
- }
-
- @Test
- public void testInterfaceStyle() {
- Shape interfaceView = findShape("Interface1");
-
- Assert.assertNotNull("The interface should have a gradient", interfaceView.getGradient());
- Assert.assertEquals("The fill color should be yellow", rgb(255, 255, 0), interfaceView.getFillColor()); //Yellow = #FFFF00
- Assert.assertEquals("The gradient should be red", rgb(255, 0, 0), interfaceView.getGradient().getGradientColor1()); //Red = #FF0000
- Assert.assertEquals("The gradient should be vertical", GradientStyle.VERTICAL, interfaceView.getGradient().getGradientStyle());
- Assert.assertTrue("The element icon should be displayed", AppearanceHelper.showElementIcon(interfaceView));
- }
-
- @Test
- public void testCSSClassStyle() {
- Shape interfaceView = findShape("Interface2");
- Assert.assertNotNull("The interface should have a gradient", interfaceView.getGradient());
- Assert.assertEquals("The fill color should be light green (#90EE90)", rgb(144, 238, 144), interfaceView.getFillColor()); //Lightgreen = #90EE90
-
- //Case insensitive color name
- Assert.assertEquals(rgb(0, 191, 255), interfaceView.getGradient().getGradientColor1()); //DeepSkyBlue = #00BFFF
-
- Assert.assertEquals(GradientStyle.HORIZONTAL, interfaceView.getGradient().getGradientStyle());
- Assert.assertFalse(AppearanceHelper.showElementIcon(interfaceView));
-
- //TODO: Font names should be case-insensitive
- Assert.assertEquals("KaiTi", interfaceView.getFontName());
- }
-
- @Test
- public void testPackage() {
- Shape packageView = findShape("Package1");
- Assert.assertNotNull(packageView.getGradient());
-
- //Inherited style (From *)
- Assert.assertEquals(rgb(255, 0, 0), packageView.getGradient().getGradientColor1()); //Red = #FF0000
- }
-
- @Test
- public void testPriorities() {
- //Tests the priorities between styles:
- //.myClass : Low priority
- //.myClass.myOtherClass : Highest priority
- //[isAbstract=true] : Medium priority
- //Styles should also be merged when they aren't conflicting (ie. [isAbstract] + .myClass -> fontName = Tunga)
- Shape class3 = findShape("Class3");
- Shape class5 = findShape("Class5");
-
- testBlueStyle(class3); //isAbstract
- testBlueStyle(class5); //isAbstract
-
- Shape class4 = findShape("Class4");
-
- testWhiteStyle(class4); //.myClass.myOtherClass (Overrides isAbstract)
- testFontName(class4); //.myClass (Doesn't conflict with isAbstract)
-
- Shape class6 = findShape("Class6");
-
- testWhiteStyle(class6); //.myClass
- testFontName(class6); //.myClass
-
- Shape class7 = findShape("Class7");
-
- testBlueStyle(class7); //isAbstract
- testFontName(class7); //.myClass (Doesn't conflict with isAbstract)
- }
-
- private void testBlueStyle(Shape shape) {
- Assert.assertEquals(rgb(195, 205, 255), shape.getFillColor()); //rgb syntax
- Assert.assertTrue(shape.isBold());
- Assert.assertNotNull(shape.getGradient());
- }
-
- private void testWhiteStyle(Shape shape) {
- Assert.assertEquals(rgb(255, 255, 255), shape.getFillColor()); //White = #FFFFFF (Hexa syntax)
- Assert.assertFalse(shape.isBold());
- Assert.assertNull(shape.getGradient());
- }
-
- private void testFontName(Shape shape) {
- Assert.assertEquals("Tunga", shape.getFontName());
- }
-
- @After
- public void dispose() {
- Iterator<Resource> iterator = diagram.eResource().getResourceSet().getResources().iterator();
- while(iterator.hasNext()) {
- iterator.next().unload();
- iterator.remove();
- }
- }
-
- private int rgb(int red, int green, int blue) {
- return red | green << 8 | blue << 16;
- }
-
- 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;
- }
}