diff options
author | Mickael ADAM | 2016-10-25 13:12:23 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-10-26 09:11:07 +0000 |
commit | af30be1506c19150bf6ba58746191cede7651f16 (patch) | |
tree | 31f93dc918384f070db5c5700419c98f5817b169 /tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests | |
parent | cbce4425e68dc8637e7236ed9f2d80ba6c8b905f (diff) | |
download | org.eclipse.papyrus-af30be1506c19150bf6ba58746191cede7651f16.tar.gz org.eclipse.papyrus-af30be1506c19150bf6ba58746191cede7651f16.tar.xz org.eclipse.papyrus-af30be1506c19150bf6ba58746191cede7651f16.zip |
Bug 506418 - [Test] Test for new customizable label provider should be
created
https://bugs.eclipse.org/bugs/show_bug.cgi?id=506418
Change-Id: Icbb81a4919dfe9479b35f0f9c6073a10221b0386
Signed-off-by: Mickael ADAM <mickael.adam@ALL4TEC.net>
Diffstat (limited to 'tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests')
8 files changed, 460 insertions, 4 deletions
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.di b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.di new file mode 100644 index 00000000000..8634d4c00e0 --- /dev/null +++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.di @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.notation b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.notation new file mode 100644 index 00000000000..81dfe705180 --- /dev/null +++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.notation @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_LgNjAJnQEea7EO1JCZQceQ" type="PapyrusUMLClassDiagram" name="ClassDiagram" measurementUnit="Pixel">
+ <styles xmi:type="notation:StringValueStyle" xmi:id="_LgNjAZnQEea7EO1JCZQceQ" name="diagram_compatibility_version" stringValue="1.2.0"/>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_LgNjApnQEea7EO1JCZQceQ"/>
+ <styles xmi:type="style:PapyrusViewStyle" xmi:id="_LgNjA5nQEea7EO1JCZQceQ">
+ <owner xmi:type="uml:Model" href="model.uml#_KmXb0JnOEea7EO1JCZQceQ"/>
+ </styles>
+ <element xmi:type="uml:Model" href="model.uml#_KmXb0JnOEea7EO1JCZQceQ"/>
+</notation:Diagram>
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.profile.di b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.profile.di new file mode 100644 index 00000000000..8634d4c00e0 --- /dev/null +++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.profile.di @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.profile.notation b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.profile.notation new file mode 100644 index 00000000000..11a075cd741 --- /dev/null +++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.profile.notation @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_I3m-gJnPEea7EO1JCZQceQ" type="PapyrusUMLProfileDiagram" name="Profile Diagram" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_Qulh0JnPEea7EO1JCZQceQ" type="Class_MetaclassShape">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_Qun-EJnPEea7EO1JCZQceQ" source="Stereotype_Annotation">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_QuolIJnPEea7EO1JCZQceQ" key="StereotypeWithQualifiedNameList" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_QuolIZnPEea7EO1JCZQceQ" key="StereotypeList" value="StandardProfile::Metaclass"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_QuolIpnPEea7EO1JCZQceQ" key="Stereotype_Presentation_Kind" value="HorizontalStereo"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_QuolI5nPEea7EO1JCZQceQ" key="PropStereoDisplay" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_QuolJJnPEea7EO1JCZQceQ" key="StereotypePropertyLocation" value="Compartment"/>
+ </eAnnotations>
+ <children xmi:type="notation:DecorationNode" xmi:id="_Qumv8JnPEea7EO1JCZQceQ" type="Class_MetaclassNameLabel"/>
+ <element xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Qumv8ZnPEea7EO1JCZQceQ" x="532" y="128"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_QwaGwJnPEea7EO1JCZQceQ" type="StereotypeComment">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_QwaGwZnPEea7EO1JCZQceQ"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_QwaGw5nPEea7EO1JCZQceQ" name="BASE_ELEMENT">
+ <eObjectValue xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ </styles>
+ <element xsi:nil="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_QwaGwpnPEea7EO1JCZQceQ" x="889" y="119"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_SXkR0JnPEea7EO1JCZQceQ" type="Stereotype_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_SXk44JnPEea7EO1JCZQceQ" type="Stereotype_NameLabel"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_SXk44ZnPEea7EO1JCZQceQ" type="Stereotype_AttributeCompartment">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_SXk44pnPEea7EO1JCZQceQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_SXk445nPEea7EO1JCZQceQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_SXk45JnPEea7EO1JCZQceQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_SXk45ZnPEea7EO1JCZQceQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_SXk45pnPEea7EO1JCZQceQ" type="Stereotype_OperationCompartment">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_SXk455nPEea7EO1JCZQceQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_SXk46JnPEea7EO1JCZQceQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_SXk46ZnPEea7EO1JCZQceQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_SXk46pnPEea7EO1JCZQceQ"/>
+ </children>
+ <element xmi:type="uml:Stereotype" href="model.profile.uml#_SXjDsJnPEea7EO1JCZQceQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_SXkR0ZnPEea7EO1JCZQceQ" x="533" y="271"/>
+ </children>
+ <styles xmi:type="notation:StringValueStyle" xmi:id="_I3m-gZnPEea7EO1JCZQceQ" name="diagram_compatibility_version" stringValue="1.2.0"/>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_I3m-gpnPEea7EO1JCZQceQ"/>
+ <styles xmi:type="style:PapyrusViewStyle" xmi:id="_I3m-g5nPEea7EO1JCZQceQ">
+ <owner xmi:type="uml:Profile" href="model.profile.uml#_I22JgJnPEea7EO1JCZQceQ"/>
+ </styles>
+ <element xmi:type="uml:Profile" href="model.profile.uml#_I22JgJnPEea7EO1JCZQceQ"/>
+ <edges xmi:type="notation:Connector" xmi:id="_QwbU4JnPEea7EO1JCZQceQ" type="StereotypeCommentLink" source="_Qulh0JnPEea7EO1JCZQceQ" target="_QwaGwJnPEea7EO1JCZQceQ">
+ <styles xmi:type="notation:FontStyle" xmi:id="_QwbU4ZnPEea7EO1JCZQceQ"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_Qwb78pnPEea7EO1JCZQceQ" name="BASE_ELEMENT">
+ <eObjectValue xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ </styles>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_QwbU4pnPEea7EO1JCZQceQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_Qwb78JnPEea7EO1JCZQceQ"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_Qwb78ZnPEea7EO1JCZQceQ"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_TcKiYJnPEea7EO1JCZQceQ" type="Extension_Edge" source="_SXkR0JnPEea7EO1JCZQceQ" target="_Qulh0JnPEea7EO1JCZQceQ">
+ <styles xmi:type="notation:FontStyle" xmi:id="_TcKiYZnPEea7EO1JCZQceQ"/>
+ <element xmi:type="uml:Extension" href="model.profile.uml#_Tb6qwJnPEea7EO1JCZQceQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_TcKiYpnPEea7EO1JCZQceQ" points="[582, 271, -643984, -643984]$[582, 178, -643984, -643984]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_TcfSgJnPEea7EO1JCZQceQ" id="(0.49,0.0)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_TcfSgZnPEea7EO1JCZQceQ" id="(0.5,1.0)"/>
+ </edges>
+</notation:Diagram>
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.profile.uml b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.profile.uml new file mode 100644 index 00000000000..7c8b12a9db7 --- /dev/null +++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.profile.uml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<uml:Profile xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_I22JgJnPEea7EO1JCZQceQ" name="ProfileTest" metaclassReference="_QuiegJnPEea7EO1JCZQceQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_Uzqg0JnPEea7EO1JCZQceQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <contents xmi:type="ecore:EPackage" xmi:id="_XrxWYJnPEea7EO1JCZQceQ" name="ProfileTest" nsURI="http:///schemas/ProfileTest/_XrwvUJnPEea7EO1JCZQceQ/1" nsPrefix="ProfileTest">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_Xrx9cJnPEea7EO1JCZQceQ" source="PapyrusVersion">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Xrx9cZnPEea7EO1JCZQceQ" key="Version" value="0.0.2"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Xrx9cpnPEea7EO1JCZQceQ" key="Comment" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Xrx9c5nPEea7EO1JCZQceQ" key="Copyright" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Xrx9dJnPEea7EO1JCZQceQ" key="Date" value="2016-10-24"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Xrx9dZnPEea7EO1JCZQceQ" key="Author" value=""/>
+ </eAnnotations>
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="_XrxWYZnPEea7EO1JCZQceQ" name="Stereotype1">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_XrxWYpnPEea7EO1JCZQceQ" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_SXjDsJnPEea7EO1JCZQceQ"/>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_XrxWY5nPEea7EO1JCZQceQ" name="base_Class" ordered="false" lowerBound="1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ </contents>
+ <contents xmi:type="ecore:EPackage" xmi:id="_UzrH4JnPEea7EO1JCZQceQ" name="RootElement" nsURI="http:///schemas/RootElement/_UzpSsJnPEea7EO1JCZQceQ/0" nsPrefix="RootElement">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_UzwncJnPEea7EO1JCZQceQ" source="PapyrusVersion">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_UzwncZnPEea7EO1JCZQceQ" key="Version" value="0.0.1"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_UzwncpnPEea7EO1JCZQceQ" key="Comment" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Uzwnc5nPEea7EO1JCZQceQ" key="Copyright" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_UzwndJnPEea7EO1JCZQceQ" key="Date" value="2016-10-24"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_UzwndZnPEea7EO1JCZQceQ" key="Author" value=""/>
+ </eAnnotations>
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="_UzrH4ZnPEea7EO1JCZQceQ" name="Stereotype1">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_UzrH4pnPEea7EO1JCZQceQ" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_SXjDsJnPEea7EO1JCZQceQ"/>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_UzrH45nPEea7EO1JCZQceQ" name="base_Class" ordered="false" lowerBound="1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ </contents>
+ </eAnnotations>
+ <elementImport xmi:type="uml:ElementImport" xmi:id="_QuiegJnPEea7EO1JCZQceQ" alias="Class">
+ <importedElement xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ </elementImport>
+ <packagedElement xmi:type="uml:Stereotype" xmi:id="_SXjDsJnPEea7EO1JCZQceQ" name="Stereotype1">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_Tb9HAJnPEea7EO1JCZQceQ" name="base_Class" association="_Tb6qwJnPEea7EO1JCZQceQ">
+ <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Extension" xmi:id="_Tb6qwJnPEea7EO1JCZQceQ" name="E_Stereotype1_Class1" memberEnd="_Tb8f8JnPEea7EO1JCZQceQ _Tb9HAJnPEea7EO1JCZQceQ">
+ <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_Tb8f8JnPEea7EO1JCZQceQ" name="extension_Stereotype1" type="_SXjDsJnPEea7EO1JCZQceQ" aggregation="composite" association="_Tb6qwJnPEea7EO1JCZQceQ"/>
+ </packagedElement>
+</uml:Profile>
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.uml b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.uml new file mode 100644 index 00000000000..c6af12a7ec5 --- /dev/null +++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/resources/CustomizableLabelProvider/model.uml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ProfileTest="http:///schemas/ProfileTest/_XrwvUJnPEea7EO1JCZQceQ/1" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http:///schemas/ProfileTest/_XrwvUJnPEea7EO1JCZQceQ/1 model.profile.uml#_XrxWYJnPEea7EO1JCZQceQ">
+ <uml:Model xmi:id="_KmXb0JnOEea7EO1JCZQceQ" name="RootElement">
+ <ownedComment xmi:type="uml:Comment" xmi:id="_P2VgoJnOEea7EO1JCZQceQ"/>
+ <ownedComment xmi:type="uml:Comment" xmi:id="_RVipkJnOEea7EO1JCZQceQ">
+ <body>body comment</body>
+ </ownedComment>
+ <ownedTemplateSignature xmi:type="uml:TemplateSignature" xmi:id="_MI_DEJqoEea7EO1JCZQceQ" parameter="_P8DFAJqoEea7EO1JCZQceQ">
+ <ownedParameter xmi:type="uml:TemplateParameter" xmi:id="_P8DFAJqoEea7EO1JCZQceQ"/>
+ </ownedTemplateSignature>
+ <packagedElement xmi:type="uml:Class" xmi:id="_OGGSEJnOEea7EO1JCZQceQ" name="SimpleClass"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_WbJ4gJnOEea7EO1JCZQceQ" name="StereotypedClass"/>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_1Y0OEJnPEea7EO1JCZQceQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1Y2DQJnPEea7EO1JCZQceQ" source="PapyrusVersion">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_1Y2DQZnPEea7EO1JCZQceQ" key="Version" value="0.0.2"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_1Y2DQpnPEea7EO1JCZQceQ" key="Comment" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_1Y2DQ5nPEea7EO1JCZQceQ" key="Copyright" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_1Y2DRJnPEea7EO1JCZQceQ" key="Date" value="2016-10-24"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_1Y2DRZnPEea7EO1JCZQceQ" key="Author" value=""/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1Y1cMJnPEea7EO1JCZQceQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="model.profile.uml#_XrxWYJnPEea7EO1JCZQceQ"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="model.profile.uml#_I22JgJnPEea7EO1JCZQceQ"/>
+ </profileApplication>
+ </uml:Model>
+ <ProfileTest:Stereotype1 xmi:id="_20jMQJnPEea7EO1JCZQceQ" base_Class="_WbJ4gJnOEea7EO1JCZQceQ"/>
+</xmi:XMI>
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/AllTests.java b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/AllTests.java index 2b6d10dcccd..6ac24b9a344 100644 --- a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/AllTests.java +++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/AllTests.java @@ -22,10 +22,18 @@ import org.junit.runners.Suite.SuiteClasses; @Headless @RunWith(ClassificationSuite.class) -@SuiteClasses({ ContentProviderTest.class, UMLStereotypePropertyContentProviderTest.class, DependencyManagementTest.class, - NamedElementValidatorTest.class, StereotypeElementListenerTest.class, ProfileApplicationListenerTest.class, UMLReferenceConverterTest.class, UMLReferenceConverterCompletionTest.class, - UMLLanguageProvidersTest.class, IconsStereotypesTest.class, - +@SuiteClasses({ + ContentProviderTest.class, + UMLStereotypePropertyContentProviderTest.class, + DependencyManagementTest.class, + NamedElementValidatorTest.class, + StereotypeElementListenerTest.class, + ProfileApplicationListenerTest.class, + UMLReferenceConverterTest.class, + UMLReferenceConverterCompletionTest.class, + UMLLanguageProvidersTest.class, + IconsStereotypesTest.class, + CustomizableDelegatingItemLabelProviderTest.class, }) public class AllTests { // Test suite diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/CustomizableDelegatingItemLabelProviderTest.java b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/CustomizableDelegatingItemLabelProviderTest.java new file mode 100644 index 00000000000..d55a5eb09d7 --- /dev/null +++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/CustomizableDelegatingItemLabelProviderTest.java @@ -0,0 +1,298 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST, ALL4TEC 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: + * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and implementation + *****************************************************************************/ + +package org.eclipse.papyrus.uml.tools.tests.tests; + +import static org.eclipse.papyrus.uml.tools.providers.CustomizableDelegatingItemLabelProvider.ST_LEFT; +import static org.eclipse.papyrus.uml.tools.providers.CustomizableDelegatingItemLabelProvider.ST_RIGHT; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.StyledString.Styler; +import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; +import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrus.uml.tools.profile.definition.LabelStylersEnum; +import org.eclipse.papyrus.uml.tools.profile.definition.LabelTypesEnum; +import org.eclipse.papyrus.uml.tools.providers.CustomizableDelegatingItemLabelProvider; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Comment; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.Profile; +import org.eclipse.uml2.uml.TemplateParameter; +import org.eclipse.uml2.uml.TemplateSignature; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + + + +/** + * Class to test {@link CustomizableDelegatingItemLabelProvider}. + */ +@SuppressWarnings("nls") +@PluginResource("/resources/CustomizableLabelProvider/model.di") +public class CustomizableDelegatingItemLabelProviderTest { + + /** The space character. */ + public static final char SPACE = ' '; + + /** The colon separator. */ + public static final String COLON_SEPARATOR = ":"; + + /** The dash separator. */ + public static final String DASH_SEPARATOR = "-"; + + /** The fixture. */ + @Rule + public final PapyrusEditorFixture editorFixture = new PapyrusEditorFixture(); + + /** the list of types */ + public static List<String> types = Arrays.asList( + LabelTypesEnum.COLON_SEPARATOR.toString(), + LabelTypesEnum.METACLASS.toString(), + LabelTypesEnum.DASH_SEPARATOR.toString(), + LabelTypesEnum.LABEL.toString(), + LabelTypesEnum.STEREOTYPE.toString(), + LabelTypesEnum.COLON_SEPARATOR.toString(), + LabelTypesEnum.QUALIFY_NAME.toString()); + + /** the list of style */ + public static List<Styler> styles = Arrays.asList( + LabelStylersEnum.DEFAULT.getStyler(), + LabelStylersEnum.BLACK.getStyler(), + LabelStylersEnum.BLUE.getStyler(), + LabelStylersEnum.DEFAULT.getStyler(), + LabelStylersEnum.GOLD.getStyler(), + LabelStylersEnum.GREY.getStyler()); + + /** the label provider */ + private final CustomizableDelegatingItemLabelProvider labelProvider = new CustomizableDelegatingItemLabelProvider(types, styles); + + /** Profile that has been applied. */ + private Profile profile = null; + + /** Profile Name. */ + private static final String PROFILE_NAME = "ProfileTest"; + + /** The model */ + private Package model; + + /** The expected returned styled label for the model. */ + private static final StyledString MODEL_STYLED_LABEL = new StyledString() + .append("<Model>", styles.get(1)) + .append(SPACE) + .append(DASH_SEPARATOR, styles.get(2)) + .append(SPACE) + .append("RootElement", styles.get(3)) + .append(SPACE) + .append(COLON_SEPARATOR, styles.get(5)) + .append(SPACE) + .append("RootElement", LabelStylersEnum.DEFAULT.getStyler());// $NON-NLS-1$ + + /** The simple class. */ + private NamedElement simpleClass = null; + + /** The simple class name. */ + private static final String SIMPLE_CLASS_NAME = "SimpleClass"; + + /** The expected returned styled label for the class. */ + private static final StyledString SIMPLE_CLASS_STYLED_LABEL = new StyledString() + .append("<Class>", styles.get(1)) + .append(SPACE) + .append(DASH_SEPARATOR, styles.get(2)) + .append(SPACE) + .append("SimpleClass", styles.get(3)) + .append(SPACE) + .append(COLON_SEPARATOR, styles.get(5)) + .append(SPACE) + .append("RootElement::SimpleClass", LabelStylersEnum.DEFAULT.getStyler()); + + /** The stereotyped class. */ + private NamedElement stereotypedClass = null; + + /** The stereotyped class name. */ + private static final String STEREOTYPED_CLASS_NAME = "StereotypedClass"; + + /** The expected returned styled label for the stereotyped class. */ + private static final StyledString STEREOTYPED_CLASS_STYLED_LABEL = new StyledString() + .append("<Class>", styles.get(1)) + .append(SPACE) + .append(DASH_SEPARATOR, styles.get(2)) + .append(SPACE) + .append("StereotypedClass", styles.get(3)) + .append(SPACE) + .append(ST_LEFT + "Stereotype1" + ST_RIGHT, styles.get(4)) + .append(SPACE) + .append(COLON_SEPARATOR, styles.get(5)) + .append(SPACE) + .append("RootElement::StereotypedClass", LabelStylersEnum.DEFAULT.getStyler()); + + /** The empty comment */ + private Comment emptyCommment = null; + + /** The expected returned styled label for the empty comment. */ + private static final StyledString EMPTY_COMMENT_STYLED_LABEL = new StyledString() + .append("<Comment>", styles.get(1)) + .append(SPACE) + .append(DASH_SEPARATOR, styles.get(2)) + .append(SPACE) + .append("<Empty Comment>", styles.get(3)); + + /** the comment */ + private Comment commment = null; + + /** The expected returned styled label for the comment. */ + private static final StyledString BODY_COMMENT_STYLED_LABEL = new StyledString() + .append("<Comment>", styles.get(1)) + .append(SPACE) + .append(DASH_SEPARATOR, styles.get(2)) + .append(SPACE) + .append("body comment", styles.get(3)); + + /** the list of style to type template test. */ + static List<String> types4templateParameterTest = new ArrayList<String>(); + static { + // initialize label provider + types4templateParameterTest.add(LabelTypesEnum.LABEL.toString()); + } + + /** The template signature. */ + private TemplateSignature templateSignature = null; + + /** The expected returned styled label for the comment. */ + private static final StyledString TEMPLATE_SIGNATURE_STYLED_LABEL = new StyledString() + .append("<Template Signature>"); + + /** The template parameters. */ + private TemplateParameter templateParameter = null; + /** The expected returned styled label for the comment. */ + private static final StyledString TEMPLATE_PARAMETER_STYLED_LABEL = new StyledString() + .append("<UNDEFINED>"); + + /** + * Initialization of the test cases. + */ + @Before + public void init() { + + // Gets all needed Element from loaded papyrus model + + model = editorFixture.getModel(); + assertNotNull("The model cannot be null", model); + + profile = model.getAppliedProfile(PROFILE_NAME); + assertEquals("Profile is not the one Expected", PROFILE_NAME, profile.getName()); + + simpleClass = model.getMember(SIMPLE_CLASS_NAME); + assertTrue("The element is not a Class", simpleClass instanceof Class); + assertEquals("Element is not the one expected", SIMPLE_CLASS_NAME, simpleClass.getName()); + + stereotypedClass = model.getMember(STEREOTYPED_CLASS_NAME); + assertTrue("The element is not a Class", stereotypedClass instanceof Class); + assertEquals("Element is not the one expected", STEREOTYPED_CLASS_NAME, stereotypedClass.getName()); + + for (Iterator<Comment> iterator = model.getOwnedComments().iterator(); iterator.hasNext();) { + Comment comment = iterator.next(); + if (comment.getBody() == null) { + emptyCommment = comment; + } else { + commment = comment; + } + } + + templateSignature = model.getOwnedTemplateSignature(); + assertNotNull("The template signature must exist", templateSignature); + + templateParameter = templateSignature.getParameters().get(0); + assertNotNull("The template parameters must exist", templateParameter); + } + + /** + * Test the return text of {@link CustomizableDelegatingItemLabelProvider}. + */ + @Test + public void returnedTextTest() { + + assertEquals("model return label is incorrect", MODEL_STYLED_LABEL.getString(), labelProvider.getText(model)); + + assertEquals("simple class return label is incorrect", SIMPLE_CLASS_STYLED_LABEL.getString(), labelProvider.getText(simpleClass)); + + assertEquals("stereotyped Class return label is incorrect", STEREOTYPED_CLASS_STYLED_LABEL.getString(), labelProvider.getText(stereotypedClass)); + + assertEquals("empty comment return label is incorrect", EMPTY_COMMENT_STYLED_LABEL.getString(), labelProvider.getText(emptyCommment)); + + assertEquals("comment return label is incorrect", BODY_COMMENT_STYLED_LABEL.getString(), labelProvider.getText(commment)); + + // Set label provider to display only the name + labelProvider.setStylesList(types4templateParameterTest, Collections.<Styler> emptyList()); + + assertEquals("template signature return label is incorrect", TEMPLATE_SIGNATURE_STYLED_LABEL.getString(), labelProvider.getText(templateSignature)); + + assertEquals("template parameter return label is incorrect", TEMPLATE_PARAMETER_STYLED_LABEL.getString(), labelProvider.getText(templateParameter)); + } + + /** + * Test the returned styled text of {@link CustomizableDelegatingItemLabelProvider}. + */ + @Test + public void returnedStyledTextTest() { + + checkStyledString(model, MODEL_STYLED_LABEL); + + checkStyledString(simpleClass, SIMPLE_CLASS_STYLED_LABEL); + + checkStyledString(stereotypedClass, STEREOTYPED_CLASS_STYLED_LABEL); + + checkStyledString(emptyCommment, EMPTY_COMMENT_STYLED_LABEL); + + checkStyledString(commment, BODY_COMMENT_STYLED_LABEL); + + // Set label provider to display only the name + labelProvider.setStylesList(types4templateParameterTest, Collections.<Styler> emptyList()); + + checkStyledString(templateSignature, TEMPLATE_SIGNATURE_STYLED_LABEL); + + checkStyledString(templateParameter, TEMPLATE_PARAMETER_STYLED_LABEL); + } + + /** + * Check the return style string of the object compare to a style string + * + * @param object + * The object. + * @param objectStyledLabel + * The styled string to compare with. + */ + protected void checkStyledString(final Object object, final StyledString objectStyledLabel) { + StyledString styledText = labelProvider.getStyledText(object); + StyleRange[] styleRanges = styledText.getStyleRanges(); + StyleRange[] styleRangesRef = objectStyledLabel.getStyleRanges(); + + for (int i = 0; i < styleRanges.length; i++) { + assertTrue("\n" + styleRanges[i].toString() + + "\n not similar to expected:\n " + + styleRangesRef[i] + "\n in " + + styledText.toString(), styleRanges[i].similarTo(styleRangesRef[i])); + } + } + +} |