Beispiel #1
0
 @Test
 public void invalidNodeNames() throws IOException {
   dotWriter.beginGraph();
   dotWriter.edge("a.b", "a c");
   dotWriter.edge("a c", "a_d");
   dotWriter.endGraph();
   assertGraph(
       ""
           + "digraph G1 {\n"
           + "  n2 [label=\"a.b\"];\n"
           + "  n3 [label=\"a c\"];\n"
           + "  n2 -> n3;\n"
           + "  n3 -> a_d;\n"
           + "}\n");
 }
Beispiel #2
0
 @Test
 public void defaultAttributes() throws IOException {
   dotWriter.beginGraph();
   dotWriter.nodeDefaults("color", "red");
   dotWriter.edgeDefaults("style", "dotted");
   dotWriter.edge("CoffeeMaker", "Heater");
   dotWriter.endGraph();
   assertGraph(
       ""
           + "digraph G1 {\n"
           + "  node [color=red];\n"
           + "  edge [style=dotted];\n"
           + "  CoffeeMaker -> Heater;\n"
           + "}\n");
 }
Beispiel #3
0
 @Test
 public void graphWithAttributes() throws IOException {
   dotWriter.beginGraph();
   dotWriter.edge("CoffeeMaker", "Heater", "style", "dotted", "color", "red");
   dotWriter.edge("CoffeeMaker", "Pump");
   dotWriter.node("CoffeeMaker", "shape", "box");
   dotWriter.endGraph();
   assertGraph(
       ""
           + "digraph G1 {\n"
           + "  CoffeeMaker -> Heater [style=dotted;color=red];\n"
           + "  CoffeeMaker -> Pump;\n"
           + "  CoffeeMaker [shape=box];\n"
           + "}\n");
 }
Beispiel #4
0
 @Test
 public void subgraph() throws IOException {
   dotWriter.beginGraph("label", "10\" tall");
   dotWriter.beginGraph("style", "filled", "color", "lightgrey");
   dotWriter.edge("ElectricHeater", "Heater");
   dotWriter.endGraph();
   dotWriter.edge("CoffeeMaker", "Heater");
   dotWriter.edge("CoffeeMaker", "Pump");
   dotWriter.endGraph();
   assertGraph(
       ""
           + "digraph G1 {\n"
           + "  label = \"10\\\" tall\";\n"
           + "  subgraph cluster2 {\n"
           + "    style = filled;\n"
           + "    color = lightgrey;\n"
           + "    ElectricHeater -> Heater;\n"
           + "  }\n"
           + "  CoffeeMaker -> Heater;\n"
           + "  CoffeeMaker -> Pump;\n"
           + "}\n");
 }