diff options
author | Gabriel Pascual | 2014-07-01 15:23:38 +0000 |
---|---|---|
committer | Camille Letavernier | 2014-07-01 15:25:44 +0000 |
commit | c5677ed0f7ade1bc17dbb7f181cafe85fdb22f8a (patch) | |
tree | 83e4d6759993f6e01078c1d062df1a7f852297a6 | |
parent | 46c70c648d754b6b768acaed9e5a53bee4d19e88 (diff) | |
download | org.eclipse.papyrus-c5677ed0f7ade1bc17dbb7f181cafe85fdb22f8a.tar.gz org.eclipse.papyrus-c5677ed0f7ade1bc17dbb7f181cafe85fdb22f8a.tar.xz org.eclipse.papyrus-c5677ed0f7ade1bc17dbb7f181cafe85fdb22f8a.zip |
435538: [CSS] Unit tests shall be created for workspace theme feature
https://bugs.eclipse.org/bugs/show_bug.cgi?id=435538
- Add test case for workspace themes feature
- Fix errors in test data
Change-Id: Idc5b0bec648e8572e785fed44874ff68a1edfba1
Signed-off-by: Gabriel Pascual <gabriel.pascual@all4tec.net>
6 files changed, 462 insertions, 1 deletions
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/workspaceThemeTest/model.di b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/workspaceThemeTest/model.di new file mode 100644 index 00000000000..a8838c28bdd --- /dev/null +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/workspaceThemeTest/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/workspaceThemeTest/model.notation b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/workspaceThemeTest/model.notation new file mode 100644 index 00000000000..0d35682ea11 --- /dev/null +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/workspaceThemeTest/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/workspaceThemeTest/model.uml b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/workspaceThemeTest/model.uml new file mode 100644 index 00000000000..e8fa769a5e1 --- /dev/null +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/model/workspaceThemeTest/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/workspaceThemeTest.css b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/workspaceThemeTest.css new file mode 100644 index 00000000000..1d8e0d91bf8 --- /dev/null +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/resources/stylesheets/workspaceThemeTest.css @@ -0,0 +1,9 @@ + +* { + elementIcon: true; +} + +ClassDiagram Class { + lineColor : red; + lineWidth : 8; +}
\ No newline at end of file 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 c92f3ef628f..031e36076cc 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,7 +17,15 @@ import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class) -@SuiteClasses({ CSSClassProviderTest.class, CSSStylesheetTest.class, CSSModelStylesheetTest.class, CSSCompartmentsTests.class, CSSSupportTest.class, CSSProjectStylesheetsTest.class }) +@SuiteClasses({ + CSSClassProviderTest.class, + CSSStylesheetTest.class, + CSSModelStylesheetTest.class, + CSSCompartmentsTests.class, + CSSSupportTest.class, + CSSProjectStylesheetsTest.class, + CSSWorkspaceThemeTest.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/CSSWorkspaceThemeTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSWorkspaceThemeTest.java new file mode 100644 index 00000000000..0ef8710c8ec --- /dev/null +++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSWorkspaceThemeTest.java @@ -0,0 +1,122 @@ +/***************************************************************************** + * 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: + * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.css.tests.tests; + +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.stylesheets.StyleSheetReference; +import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StylesheetsFactory; +import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.Theme; +import org.eclipse.papyrus.infra.gmfdiag.css.tests.Activator; +import org.eclipse.papyrus.infra.gmfdiag.css.theme.ThemeManager; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + + +/** + * Test class for wokspace thme in Papyrus. + * + * @author Gabriel Pascual + * + */ +public class CSSWorkspaceThemeTest extends AbstractCSSStylesheetTest { + + /** + * Executed before any other methods are + * executed within the class. + * + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + 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(); + } + + + + /** + * Method will be executed before each test + * method + * + * @throws java.lang.Exception + */ + @Before + public void init() throws Exception { + + ResourceSet resourceSet = houseKeeper.createResourceSet(); + CSSHelper.installCSSSupport(resourceSet); + + URI modelURI = URI.createPlatformPluginURI(Activator.PLUGIN_ID + "/resources/model/workspaceThemeTest/model.notation", true); + + 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; + } + + /** + * Test of a addition of workspace theme and its expected results. + */ + @Test + public void testWorkspaceTheme() { + StylesheetsFactory factory = StylesheetsFactory.eINSTANCE; + + // Create theme to add + Theme expectedTheme = factory.createTheme(); + String expectedId = "_1215_2154_12"; + expectedTheme.setId(expectedId); + expectedTheme.setLabel("Workspace Theme Test "); + + StyleSheetReference styleSheetTheme = factory.createStyleSheetReference(); + URI cssFileUri = URI.createPlatformPluginURI(Activator.PLUGIN_ID + "/resources/stylesheets/workspaceThemeTest.css", true); + styleSheetTheme.setPath(cssFileUri.toString()); + expectedTheme.getStylesheets().add(styleSheetTheme); + + // Load themes in manager + ThemeManager themeManager = ThemeManager.instance; + themeManager.getThemes(); + + //Add theme to workspace preferences + themeManager.addTemporaryTheme(expectedTheme); + themeManager.refreshThemes(); + themeManager.persist(); + + // Verify if added theme exist in preferences + Theme persistedTheme = themeManager.getTheme(expectedId); + Assert.assertEquals("Fail to persist workspace theme", expectedId, persistedTheme.getId()); + + // Select added theme as current theme + IPreferenceStore cssThemePreferences = org.eclipse.papyrus.infra.gmfdiag.css.Activator.getDefault().getPreferenceStore(); + cssThemePreferences.setValue(ThemePreferences.CURRENT_THEME, expectedId); + WorkspaceCSSEngine.instance.reset(); + + Assert.assertEquals("Invalid theme in preference store", expectedId, cssThemePreferences.getString(ThemePreferences.CURRENT_THEME)); + + //Verify theme values with Class5 element + Shape fifthClassShape = findShape("Class5"); + Assert.assertEquals("Invalid color", rgb(255, 0, 0), fifthClassShape.getLineColor()); + + + } +} |