Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 261562 Details for
Bug 493136
Dot Attributes inconsistent handling
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Create DotSampleGraphs.xtend with sample graph definitions
493136-Create-DotSampleGraphs-xtend-file.patch (text/plain), 26.63 KB, created by
Tamas Miklossy
on 2016-05-09 10:42:47 EDT
(
hide
)
Description:
Create DotSampleGraphs.xtend with sample graph definitions
Filename:
MIME Type:
Creator:
Tamas Miklossy
Created:
2016-05-09 10:42:47 EDT
Size:
26.63 KB
patch
obsolete
>diff --git a/org.eclipse.gef4.dot.tests/.classpath b/org.eclipse.gef4.dot.tests/.classpath >index 6a42377..4269557 100644 >--- a/org.eclipse.gef4.dot.tests/.classpath >+++ b/org.eclipse.gef4.dot.tests/.classpath >@@ -3,6 +3,7 @@ > <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> > <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> > <classpathentry kind="src" path="src"/> >+ <classpathentry kind="src" path="xtend-gen"/> > <classpathentry kind="src" path="src-gen"/> > <classpathentry kind="output" path="bin"/> > </classpath> >diff --git a/org.eclipse.gef4.dot.tests/.gitignore b/org.eclipse.gef4.dot.tests/.gitignore >index 58eba3c..a5520bd 100644 >--- a/org.eclipse.gef4.dot.tests/.gitignore >+++ b/org.eclipse.gef4.dot.tests/.gitignore >@@ -1,2 +1,3 @@ > /output/ >-/src-gen/ >\ No newline at end of file >+/src-gen/ >+/xtend-gen/ >\ No newline at end of file >diff --git a/org.eclipse.gef4.dot.tests/.project b/org.eclipse.gef4.dot.tests/.project >index 16141ce..b465cd7 100644 >--- a/org.eclipse.gef4.dot.tests/.project >+++ b/org.eclipse.gef4.dot.tests/.project >@@ -6,6 +6,11 @@ > </projects> > <buildSpec> > <buildCommand> >+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name> >+ <arguments> >+ </arguments> >+ </buildCommand> >+ <buildCommand> > <name>org.eclipse.jdt.core.javabuilder</name> > <arguments> > </arguments> >@@ -25,5 +30,6 @@ > <nature>org.eclipse.pde.PluginNature</nature> > <nature>org.eclipse.jdt.core.javanature</nature> > <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> >+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> > </natures> > </projectDescription> >diff --git a/org.eclipse.gef4.dot.tests/build.properties b/org.eclipse.gef4.dot.tests/build.properties >index 6542829..66e13ea 100644 >--- a/org.eclipse.gef4.dot.tests/build.properties >+++ b/org.eclipse.gef4.dot.tests/build.properties >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2015 itemis AG and others. >+# Copyright (c) 2015, 2016 itemis AG 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 >@@ -7,9 +7,11 @@ > # > # Contributors: > # Alexander Ny�en (itemis AG) - initial API and implementation >+# Tamas Miklossy (itemis AG) - add xtend-gen to the source folders > ############################################################################### > source.. = src/,\ >- src-gen/ >+ src-gen/,\ >+ xtend-gen/ > output.. = bin/ > bin.includes = META-INF/,\ > . >diff --git a/org.eclipse.gef4.dot.tests/pom.xml b/org.eclipse.gef4.dot.tests/pom.xml >index 61171f2..12f57a5 100644 >--- a/org.eclipse.gef4.dot.tests/pom.xml >+++ b/org.eclipse.gef4.dot.tests/pom.xml >@@ -20,6 +20,39 @@ > <sourceDirectory>src</sourceDirectory> > <plugins> > <plugin> >+ <artifactId>maven-clean-plugin</artifactId> >+ <version>${maven-clean-plugin.version}</version> >+ <executions> >+ <execution> >+ <id>gen-clean</id> >+ <phase>clean</phase> >+ <configuration> >+ <filesets combine.children="append"> >+ <fileset> >+ <directory>${basedir}/xtend-gen/</directory> >+ </fileset> >+ </filesets> >+ </configuration> >+ </execution> >+ </executions> >+ </plugin> >+ <plugin> >+ <groupId>org.eclipse.xtend</groupId> >+ <artifactId>xtend-maven-plugin</artifactId> >+ <version>${xtext.version}</version> >+ <executions> >+ <execution> >+ <goals> >+ <goal>compile</goal> >+ </goals> >+ </execution> >+ </executions> >+ <configuration> >+ <encoding>${project.build.sourceEncoding}</encoding> >+ <outputDirectory>xtend-gen</outputDirectory> >+ </configuration> >+ </plugin> >+ <plugin> > <groupId>org.eclipse.tycho</groupId> > <artifactId>tycho-surefire-plugin</artifactId> > </plugin> >diff --git a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotInterpreterTests.java b/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotInterpreterTests.java >index fc03f28..ab8b5ff 100644 >--- a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotInterpreterTests.java >+++ b/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotInterpreterTests.java >@@ -52,7 +52,8 @@ > > @Test > public void digraphType() { >- Graph graph = interpreter.interpret(parse("digraph Sample{1;2;1->2}")) //$NON-NLS-1$ >+ Graph graph = interpreter >+ .interpret(parse(DotSampleGraphs.TWO_NODES_ONE_DIRECTED_EDGE)) > .get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(DotAttributes._TYPE__G__DIGRAPH, >@@ -61,8 +62,8 @@ > > @Test > public void graphType() { >- Graph graph = interpreter.interpret(parse("graph Sample{1;2;1--2}")) //$NON-NLS-1$ >- .get(0); >+ Graph graph = interpreter >+ .interpret(parse(DotSampleGraphs.TWO_NODES_ONE_EDGE)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(DotAttributes._TYPE__G__GRAPH, > DotAttributes._getType(graph)); >@@ -70,7 +71,8 @@ > > @Test > public void nodeDefaultLabel() { >- Graph graph = interpreter.interpret(parse("graph Sample{1}")).get(0); //$NON-NLS-1$ >+ Graph graph = interpreter.interpret(parse(DotSampleGraphs.ONE_NODE)) >+ .get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals("1", //$NON-NLS-1$ > DotAttributes._getName(graph.getNodes().get(0))); >@@ -78,7 +80,8 @@ > > @Test > public void nodeCount() { >- Graph graph = interpreter.interpret(parse("graph Sample{1;2}")).get(0); //$NON-NLS-1$ >+ Graph graph = interpreter.interpret(parse(DotSampleGraphs.TWO_NODES)) >+ .get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(2, graph.getNodes().size()); > } >@@ -86,7 +89,8 @@ > @Test > public void edgeCount() { > Graph graph = interpreter >- .interpret(parse("graph Sample{1;2;1--2;2--2;1--1}")).get(0); //$NON-NLS-1$ >+ .interpret(parse(DotSampleGraphs.TWO_NODES_AND_THREE_EDGES)) >+ .get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(3, graph.getEdges().size()); > } >@@ -94,7 +98,7 @@ > @Test > public void nodeLabel() { > Graph graph = interpreter >- .interpret(parse("graph Sample{1[label=\"Node1\"];}")).get(0); //$NON-NLS-1$ >+ .interpret(parse(DotSampleGraphs.NODE_LABEL_LOCAL)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals("Node1", //$NON-NLS-1$ > DotAttributes.getLabel(graph.getNodes().get(0))); >@@ -103,8 +107,7 @@ > @Test > public void edgeLabel() { > Graph graph = interpreter >- .interpret(parse("graph Sample{1;2;1--2[label=\"Edge1\"]}")) //$NON-NLS-1$ >- .get(0); >+ .interpret(parse(DotSampleGraphs.EDGE_LABEL_LOCAL)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals("Edge1", DotAttributes.getLabel(graph.getEdges() //$NON-NLS-1$ > .get(0))); >@@ -113,8 +116,7 @@ > @Test > public void edgeStyle() { > Graph graph = interpreter >- .interpret(parse("graph Sample{1;2;1->2[style=dashed]}")) //$NON-NLS-1$ >- .get(0); >+ .interpret(parse(DotSampleGraphs.EDGE_STYLE_LOCAL)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(EdgeStyle.DASHED.toString(), > DotAttributes.getStyle(graph.getEdges().get(0))); >@@ -123,8 +125,7 @@ > @Test > public void globalEdgeStyle() { > Graph graph = interpreter >- .interpret(parse("graph Sample{edge[style=dashed];1;2;1--2}")) //$NON-NLS-1$ >- .get(0); >+ .interpret(parse(DotSampleGraphs.EDGE_STYLE_GLOBAL)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(EdgeStyle.DASHED.toString(), > DotAttributes.getStyle(graph.getEdges().get(0))); >@@ -133,9 +134,7 @@ > @Test > public void globalEdgeLabel() { > Graph graph = interpreter >- .interpret( >- parse("graph Sample{edge[label=\"Edge1\"];1;2;1--2}")) //$NON-NLS-1$ >- .get(0); >+ .interpret(parse(DotSampleGraphs.EDGE_LABEL_GLOBAL)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals("Edge1", DotAttributes.getLabel(graph.getEdges() //$NON-NLS-1$ > .get(0))); >@@ -144,8 +143,7 @@ > @Test > public void globalNodeLabel() { > Graph graph = interpreter >- .interpret(parse("graph Sample{node[label=\"Node1\"];1;}")) //$NON-NLS-1$ >- .get(0); >+ .interpret(parse(DotSampleGraphs.NODE_LABEL_GLOBAL)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals("Node1", //$NON-NLS-1$ > DotAttributes.getLabel(graph.getNodes().get(0))); >@@ -154,7 +152,7 @@ > @Test > public void layoutSpring() { > Graph graph = interpreter >- .interpret(parse("graph Sample{graph[layout=fdp];1;}")).get(0); //$NON-NLS-1$ >+ .interpret(parse(DotSampleGraphs.GRAPH_LAYOUT_FDP)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(Layout.FDP.toString(), > DotAttributes.getLayout(graph)); >@@ -163,8 +161,7 @@ > @Test > public void layoutGrid() { > Graph graph = interpreter >- .interpret(parse("graph Sample{graph[layout=osage];1;}")) //$NON-NLS-1$ >- .get(0); >+ .interpret(parse(DotSampleGraphs.GRAPH_LAYOUT_OSAGE)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(Layout.OSAGE.toString(), > DotAttributes.getLayout(graph)); >@@ -173,8 +170,7 @@ > @Test > public void layoutRadial() { > Graph graph = interpreter >- .interpret(parse("graph Sample{graph[layout=twopi];1;}")) //$NON-NLS-1$ >- .get(0); >+ .interpret(parse(DotSampleGraphs.GRAPH_LAYOUT_TWOPI)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(Layout.TWOPI.toString(), > DotAttributes.getLayout(graph)); >@@ -183,7 +179,7 @@ > @Test > public void layoutTree() { > Graph graph = interpreter >- .interpret(parse("graph Sample{graph[layout=dot];1;}")).get(0); //$NON-NLS-1$ >+ .interpret(parse(DotSampleGraphs.GRAPH_LAYOUT_DOT)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(Layout.DOT.toString(), > DotAttributes.getLayout(graph)); >@@ -192,8 +188,7 @@ > @Test > public void layoutHorizontalTreeViaLayout() { > Graph graph = interpreter >- .interpret( >- parse("graph Sample{graph[layout=dot];rankdir=LR;1;}")) //$NON-NLS-1$ >+ .interpret(parse(DotSampleGraphs.GRAPH_LAYOUT_DOT_HORIZONTAL)) > .get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(Layout.DOT.toString(), >@@ -204,7 +199,7 @@ > @Test > public void layoutHorizontalTreeViaAttribute() { > Graph graph = interpreter >- .interpret(parse("graph Sample{rankdir=LR;1;}")).get(0); //$NON-NLS-1$ >+ .interpret(parse(DotSampleGraphs.GRAPH_RANKDIR_LR)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(Rankdir.LR, DotAttributes.getRankdirParsed(graph)); > } >@@ -212,7 +207,9 @@ > @Test > public void globalNodeAttributeAdHocNodes() { > Graph graph = interpreter >- .interpret(parse("graph{node[label=\"TEXT\"];1--2}")).get(0); //$NON-NLS-1$ >+ .interpret( >+ parse(DotSampleGraphs.GLOBAL_NODE_LABEL_AD_HOC_NODES)) >+ .get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals("TEXT", //$NON-NLS-1$ > DotAttributes.getLabel(graph.getNodes().get(0))); >@@ -221,7 +218,9 @@ > @Test > public void globalEdgeAttributeAdHocNodes() { > Graph graph = interpreter >- .interpret(parse("graph{edge[label=\"TEXT\"];1--2}")).get(0); //$NON-NLS-1$ >+ .interpret( >+ parse(DotSampleGraphs.GLOBAL_EDGE_LABEL_AD_HOC_NODES)) >+ .get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals("TEXT", DotAttributes.getLabel(graph.getEdges() //$NON-NLS-1$ > .get(0))); >@@ -230,7 +229,7 @@ > @Test > public void headerCommentGraph() { > Graph graph = interpreter >- .interpret(parse("/*A header comment*/\ngraph{1--2}")).get(0); //$NON-NLS-1$ >+ .interpret(parse(DotSampleGraphs.HEADER_COMMENT)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(2, graph.getNodes().size()); > Assert.assertEquals(1, graph.getEdges().size()); >@@ -239,7 +238,7 @@ > @Test > public void nodesBeforeEdges() { > Graph graph = interpreter >- .interpret(parse("graph{1;2;3;4; 1--2;2--3;2--4}")).get(0); //$NON-NLS-1$ >+ .interpret(parse(DotSampleGraphs.NODES_BEFORE_EDGES)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(4, graph.getNodes().size()); > Assert.assertEquals(3, graph.getEdges().size()); >@@ -248,9 +247,7 @@ > @Test > public void nodesAfterEdges() { > Graph graph = interpreter >- .interpret( >- parse("graph{1--2;2--3;2--4;1[label=\"node\"];2;3;4}")) //$NON-NLS-1$ >- .get(0); >+ .interpret(parse(DotSampleGraphs.NODES_AFTER_EDGES)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(4, graph.getNodes().size()); > Assert.assertEquals(3, graph.getEdges().size()); >@@ -260,7 +257,7 @@ > > @Test > public void useInterpreterTwice() { >- String dot = "graph{1;2;3;4; 1--2;2--3;2--4}"; //$NON-NLS-1$ >+ String dot = DotSampleGraphs.NODES_AFTER_EDGES; > Graph graph = interpreter.interpret(parse(dot)).get(0); > graph = interpreter.interpret(parse(dot)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ >@@ -270,8 +267,8 @@ > > @Test > public void idsWithQuotes() { >- String dot = "graph{\"node 1\";\"node 2\"}"; //$NON-NLS-1$ >- Graph graph = interpreter.interpret(parse(dot)).get(0); >+ Graph graph = interpreter >+ .interpret(parse(DotSampleGraphs.IDS_WITH_QUOTES)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > List<Node> list = graph.getNodes(); > Assert.assertEquals("node 1", //$NON-NLS-1$ >@@ -282,8 +279,8 @@ > > @Test > public void escapedQuotes() { >- String dot = "graph{n1[label=\"node \\\"1\\\"\"]}"; //$NON-NLS-1$ >- Graph graph = interpreter.interpret(parse(dot)).get(0); >+ Graph graph = interpreter >+ .interpret(parse(DotSampleGraphs.ESCAPED_QUOTES_LABEL)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals("node \"1\"", //$NON-NLS-1$ > DotAttributes.getLabel(graph.getNodes().get(0))); >@@ -291,8 +288,8 @@ > > @Test > public void fullyQuoted() { >- String dot = "graph{\"n1\";\"n2\";\"n1\"--\"n2\"}"; //$NON-NLS-1$ >- Graph graph = interpreter.interpret(parse(dot)).get(0); >+ Graph graph = interpreter >+ .interpret(parse(DotSampleGraphs.FULLY_QUOTED_IDS)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > Assert.assertEquals(2, graph.getNodes().size()); > Assert.assertEquals(1, graph.getEdges().size()); >@@ -305,8 +302,8 @@ > > @Test > public void labelsWithQuotes() { >- String dot = "graph{n1[label=\"node 1\"];n2[label=\"node 2\"];n1--n2[label=\"edge 1\"]}"; //$NON-NLS-1$ >- Graph graph = interpreter.interpret(parse(dot)).get(0); >+ Graph graph = interpreter >+ .interpret(parse(DotSampleGraphs.QUOTED_LABELS)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ > List<Node> list = graph.getNodes(); > Assert.assertEquals("node 1", //$NON-NLS-1$ >@@ -319,16 +316,17 @@ > > @Test > public void newLinesInLabels() { >- String dot = "graph{n1[label=\"node\n1\"]}"; //$NON-NLS-1$ >- Graph graph = interpreter.interpret(parse(dot)).get(0); >+ Graph graph = interpreter >+ .interpret(parse(DotSampleGraphs.NEW_LINES_IN_LABELS)).get(0); > Assert.assertNotNull("Created graph must not be null", graph); //$NON-NLS-1$ >- Assert.assertEquals("node\n1", //$NON-NLS-1$ >+ Assert.assertEquals("node" + System.lineSeparator() + "1", //$NON-NLS-1$ > DotAttributes.getLabel(graph.getNodes().get(0))); > } > > @Test > public void multiEdgeStatements() { >- Graph graph = new DotImport().importDot("digraph{1->2->3->4}"); //$NON-NLS-1$ >+ Graph graph = new DotImport() >+ .importDot(DotSampleGraphs.MULTI_EDGE_STATEMENTS); > assertEquals(4, graph.getNodes().size()); > assertEquals(3, graph.getEdges().size()); > /* Each node should be connected to one other, the previous node: */ >@@ -350,7 +348,8 @@ > @Test > /* see http://www.graphviz.org/doc/info/attrs.html#d:style */ > public void edgeStyleInvis() { >- Graph graph = new DotImport().importDot("digraph{1->2[style=invis]}"); >+ Graph graph = new DotImport() >+ .importDot(DotSampleGraphs.EDGE_STYLE_INVIS); > assertEquals(2, graph.getNodes().size()); > assertEquals(1, graph.getEdges().size()); > } >diff --git a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotParserTests.java b/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotParserTests.java >index 7519cc0..7285607 100644 >--- a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotParserTests.java >+++ b/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotParserTests.java >@@ -56,67 +56,67 @@ > > @Test > public void testEmptyGraph() { >- testString("graph {}"); >+ testString(DotSampleGraphs.EMPTY); > } > > @Test > public void testEmptyDirectedGraph() { >- testString("digraph {}"); >+ testString(DotSampleGraphs.EMPTY_DIRECTED); > } > > @Test > public void testEmptyStrictGraph() { >- testString("strict graph {}"); >+ testString(DotSampleGraphs.EMPTY_STRICT); > } > > @Test > public void testEmptyStrictDirectedGraph() { >- testString("strict digraph {}"); >+ testString(DotSampleGraphs.EMPTY_STRICT_DIRECTED); > } > > @Test > public void testGraphWithOneNode() { >- testString("graph {n1}"); >+ testString(DotSampleGraphs.ONE_NODE); > } > > @Test > public void testGraphWithOneNodeAndEmptyNodeAttributeList() { >- testString("graph {n1[]}"); >+ testString(DotSampleGraphs.EMPTY_NODE_ATTRIBUTE_LIST); > } > > @Test > public void testGraphWithOneEdge() { >- testString("graph {n1--n2}"); >+ testString(DotSampleGraphs.ONE_EDGE); >+ } >+ >+ @Test >+ public void testDirectedGraphWithOneEdge() { >+ testString(DotSampleGraphs.ONE_DIRECTED_EDGE); > } > > @Test > public void testGraphWithOneEdgeAndEmptyEdgeAttributeList() { >- testString("graph {n1--n2[]}"); >+ testString(DotSampleGraphs.EMPTY_EDGE_ATTRIBUTE_LIST); >+ } >+ >+ @Test >+ public void testDirectedGraphWithOneEdgeAndEmptyEdgeAttributeList() { >+ testString(DotSampleGraphs.EMPTY_DIRECTED_EDGE_ATTRIBUTE_LIST); > } > > @Test > public void testGraphWithEmptyGraphAttributeStatement() { >- testString("graph {graph[]}"); >+ testString(DotSampleGraphs.EMPTY_GRAPH_ATTRIBUTE_STATEMENT); > } > > @Test > public void testGraphWithEmptyNodeAttributeStatement() { >- testString("graph {node[]}"); >+ testString(DotSampleGraphs.EMPTY_NODE_ATTRIBUTE_STATEMENT); > } > > @Test > public void testGraphWithEmptyEdgeAttributeStatement() { >- testString("graph {edge[]}"); >- } >- >- @Test >- public void testArrowShapesSingle() { >- testFile("arrowshapes_single.dot"); >- } >- >- @Test >- public void testArrowShapesMultiple() { >- testFile("arrowshapes_multiple.dot"); >+ testString(DotSampleGraphs.EMPTY_EDGE_ATTRIBUTE_STATEMENT); > } > > @Test >@@ -125,7 +125,7 @@ > } > > @Test >- public void testArrowshapesDirectionBoth() { >+ public void testArrowShapesDirectionBoth() { > testFile("arrowshapes_direction_both.dot"); > } > >@@ -135,11 +135,91 @@ > } > > @Test >- public void testPolygonBasedNodeShapes() { >+ public void testArrowShapesMultiple() { >+ testFile("arrowshapes_multiple.dot"); >+ } >+ >+ @Test >+ public void testArrowShapesSingle() { >+ testFile("arrowshapes_single.dot"); >+ } >+ >+ @Test >+ public void testAttributesGraph() { >+ testFile("attributes_graph.dot"); >+ } >+ >+ @Test >+ public void testBasicDirectedGraph() { >+ testFile("basic_directed_graph.dot"); >+ } >+ >+ @Test >+ public void testGlobalEdgeGraph() { >+ testFile("global_edge_graph.dot"); >+ } >+ >+ @Test >+ public void testGlobalNodeGraph() { >+ testFile("global_node_graph.dot"); >+ } >+ >+ @Test >+ public void testIdMatchesKeyword() { >+ testFile("id_matches_keyword.dot"); >+ } >+ >+ @Test >+ public void testLabeledGraph() { >+ testFile("labeled_graph.dot"); >+ } >+ >+ @Test >+ public void testLayoutGridGraph() { >+ testFile("layout_grid_graph.dot"); >+ } >+ >+ @Test >+ public void testLayoutRadialGraph() { >+ testFile("layout_radial_graph.dot"); >+ } >+ >+ @Test >+ public void testLayoutSpringGraph() { >+ testFile("layout_spring_graph.dot"); >+ } >+ >+ @Test >+ public void testLayoutTreeGraph() { >+ testFile("layout_tree_graph.dot"); >+ } >+ >+ @Test >+ public void testNodeShapesPolygonBased() { > testFile("nodeshapes_polygon_based.dot"); > } > > @Test >+ public void testNodeGroups() { >+ testFile("node_groups.dot"); >+ } >+ >+ @Test >+ public void testSampleInput() { >+ testFile("sample_input.dot"); >+ } >+ >+ @Test >+ public void testSimpleDigraph() { >+ testFile("simple_digraph.dot"); >+ } >+ >+ @Test >+ public void testSimpleGraph() { >+ testFile("simple_graph.dot"); >+ } >+ >+ @Test > public void testStyledGraph() { > testFile("styled_graph.dot"); > } >diff --git a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotSampleGraphs.xtend b/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotSampleGraphs.xtend >new file mode 100644 >index 0000000..1d92f0c >--- /dev/null >+++ b/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotSampleGraphs.xtend >@@ -0,0 +1,312 @@ >+/******************************************************************************* >+ * Copyright (c) 2016 itemis AG 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: >+ * Tamas Miklossy (itemis AG) - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.gef4.dot.tests >+ >+class DotSampleGraphs { >+ >+ public static val EMPTY = ''' >+ graph {} >+ ''' >+ >+ public static val EMPTY_DIRECTED = ''' >+ digraph {} >+ ''' >+ >+ public static val EMPTY_STRICT = ''' >+ strict graph {} >+ ''' >+ >+ public static val EMPTY_STRICT_DIRECTED = ''' >+ strict digraph {} >+ ''' >+ >+ public static val ONE_NODE = ''' >+ graph { >+ 1 >+ } >+ ''' >+ >+ public static val TWO_NODES = ''' >+ graph { >+ 1 >+ 2 >+ } >+ ''' >+ >+ public static val ONE_EDGE = ''' >+ graph { >+ 1--2 >+ } >+ ''' >+ >+ public static val ONE_DIRECTED_EDGE = ''' >+ digraph { >+ 1->2 >+ } >+ ''' >+ >+ public static val TWO_EDGES = ''' >+ graph { >+ 1--2 >+ 3--4 >+ } >+ ''' >+ >+ public static val TWO_NODES_ONE_EDGE = ''' >+ graph { >+ 1;2; >+ 1--2 >+ } >+ ''' >+ >+ public static val TWO_NODES_ONE_DIRECTED_EDGE = ''' >+ digraph { >+ 1;2; >+ 1->2 >+ } >+ ''' >+ >+ public static val TWO_NODES_AND_THREE_EDGES = ''' >+ graph { >+ 1;2 >+ 1--2 >+ 2--2 >+ 1--1 >+ } >+ ''' >+ >+ public static val EMPTY_NODE_ATTRIBUTE_LIST = ''' >+ graph { >+ 1[] >+ } >+ ''' >+ >+ public static val EMPTY_EDGE_ATTRIBUTE_LIST = ''' >+ graph { >+ 1--2[] >+ } >+ ''' >+ >+ public static val EMPTY_DIRECTED_EDGE_ATTRIBUTE_LIST = ''' >+ digraph { >+ 1->2[] >+ } >+ ''' >+ >+ public static val EMPTY_GRAPH_ATTRIBUTE_STATEMENT = ''' >+ graph { >+ graph[] >+ } >+ ''' >+ >+ public static val EMPTY_NODE_ATTRIBUTE_STATEMENT = ''' >+ graph { >+ node[] >+ } >+ ''' >+ >+ public static val EMPTY_EDGE_ATTRIBUTE_STATEMENT = ''' >+ graph { >+ edge[] >+ } >+ ''' >+ >+ public static val ESCAPED_QUOTES_LABEL = ''' >+ graph { >+ n1[label="node \"1\""] >+ } >+ ''' >+ >+ public static val FULLY_QUOTED_IDS = ''' >+ graph { >+ "n1" >+ "n2" >+ "n1"--"n2" >+ } >+ ''' >+ >+ public static val GLOBAL_EDGE_LABEL_AD_HOC_NODES = ''' >+ graph { >+ edge[label="TEXT"] >+ 1--2 >+ } >+ ''' >+ >+ public static val GLOBAL_NODE_LABEL_AD_HOC_NODES = ''' >+ graph { >+ node[label="TEXT"] >+ 1--2 >+ } >+ ''' >+ >+ public static val GRAPH_LAYOUT_DOT_HORIZONTAL = ''' >+ graph { >+ graph[layout=dot] >+ rankdir=LR >+ 1 >+ } >+ ''' >+ >+ public static val HEADER_COMMENT = ''' >+ /*A header comment*/ >+ graph { >+ 1--2 >+ } >+ ''' >+ >+ public static val IDS_WITH_QUOTES = ''' >+ graph { >+ "node 1" >+ "node 2" >+ } >+ ''' >+ >+ public static val MULTI_EDGE_STATEMENTS = ''' >+ digraph { >+ 1->2->3->4 >+ } >+ ''' >+ >+ public static val NEW_LINES_IN_LABELS = ''' >+ graph { >+ n1[label= >+ "node >+ 1"]} >+ ''' >+ >+ public static val NODES_AFTER_EDGES = ''' >+ graph { >+ 1--2 >+ 2--3 >+ 2--4 >+ 1[label="node"] >+ 2 >+ 3 >+ 4 >+ } >+ ''' >+ >+ public static val NODES_BEFORE_EDGES = ''' >+ graph { >+ 1;2;3;4 >+ 1--2 >+ 2--3 >+ 2--4 >+ } >+ ''' >+ >+ public static val QUOTED_LABELS = ''' >+ graph { >+ n1[label="node 1"] >+ n2[label="node 2"] >+ n1--n2[label="edge 1"] >+ } >+ ''' >+ >+ >+/* >+ ************************************************************************************************************ >+ * Sample dot graphs with different dot attribute valid values >+ ************************************************************************************************************ >+ */ >+ >+ public static val GRAPH_LAYOUT_DOT = ''' >+ graph { >+ graph[layout=dot] >+ 1 >+ } >+ ''' >+ >+ public static val GRAPH_LAYOUT_FDP = ''' >+ graph { >+ graph[layout=fdp] >+ 1 >+ } >+ ''' >+ >+ public static val GRAPH_LAYOUT_OSAGE = ''' >+ graph { >+ graph[layout=osage] >+ 1 >+ } >+ ''' >+ >+ public static val GRAPH_LAYOUT_TWOPI = ''' >+ graph { >+ graph[layout=twopi] >+ 1 >+ } >+ ''' >+ >+ public static val GRAPH_RANKDIR_LR = ''' >+ graph { >+ rankdir=LR >+ 1 >+ } >+ ''' >+ >+ public static val EDGE_STYLE_INVIS = ''' >+ digraph { >+ 1->2[style=invis] >+ } >+ ''' >+ >+/* >+ ************************************************************************************************************ >+ * Sample dot graphs with local/global/override dot attributes >+ ************************************************************************************************************ >+ */ >+ >+ public static val NODE_LABEL_LOCAL = ''' >+ graph { >+ 1[label="Node1"] >+ } >+ ''' >+ >+ public static val NODE_LABEL_GLOBAL = ''' >+ graph { >+ node[label="Node1"] >+ 1 >+ } >+ ''' >+ >+ public static val EDGE_LABEL_LOCAL = ''' >+ graph { >+ 1;2; >+ 1--2[label="Edge1"] >+ } >+ ''' >+ >+ public static val EDGE_LABEL_GLOBAL = ''' >+ graph { >+ edge[label="Edge1"] >+ 1;2 >+ 1--2 >+ } >+ ''' >+ >+ public static val EDGE_STYLE_GLOBAL = ''' >+ graph { >+ edge[style=dashed] >+ 1;2 >+ 1--2 >+ } >+ ''' >+ >+ public static val EDGE_STYLE_LOCAL = ''' >+ graph { >+ 1;2; >+ 1->2[style=dashed] >+ } >+ ''' >+} >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
nyssen
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 493136
:
261510
|
261511
|
261535
| 261562 |
261603
|
261698
|
261715