예제 #1
0
 @Test
 public void dotImport() {
   Shell shell = new Shell();
   DotImport importer = new DotImport("digraph Sample{1;2;1->2}"); // $NON-NLS-1$
   GraphWidget graph = new GraphWidget(importer.newGraphInstance(), shell, SWT.NONE);
   Assert.assertNotNull("Created graph must not be null", graph); // $NON-NLS-1$
   Assert.assertEquals(ZestStyles.CONNECTIONS_DIRECTED, graph.getConnectionStyle());
   // open(shell);
 }
예제 #2
0
 @Test
 public void clusterSubgraph() {
   Shell shell = new Shell();
   DotImport dotImport =
       new DotImport("digraph{subgraph cluster_1{1->2}; subgraph cluster_2{1->3}}");
   GraphWidget graph = new GraphWidget(dotImport.newGraphInstance(), shell, SWT.NONE);
   assertEquals("Cluster subgraphs are ignored in rendering", 3, graph.getNodes().size());
   assertEquals(2, graph.getConnections().size());
 }
예제 #3
0
 @Test
 public void minimalUsage() {
   Shell shell = new Shell();
   /* The DOT input, can be given as a String, File or IFile: */
   DotImport dotImport = new DotImport("digraph Simple { 1;2; 1->2 }"); // $NON-NLS-1$
   /* Create a Zest graph instance in a parent, with a style: */
   GraphWidget graph = new GraphWidget(dotImport.newGraphInstance(), shell, SWT.NONE);
   // open(shell); // sets title, layout, and size, opens the shell
   System.out.println(graph);
 }