summaryrefslogtreecommitdiff
path: root/tests/test_graphviz_1.c
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-12-10 22:30:12 +0100
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-12-10 22:30:12 +0100
commit429d5f88b94ff28416cbfc6420b6389fa284df97 (patch)
treefb6fdaf7731de1ef396f98b748c56f3149801c84 /tests/test_graphviz_1.c
Import RTFL 0.1.1v0.1.1
Diffstat (limited to 'tests/test_graphviz_1.c')
-rw-r--r--tests/test_graphviz_1.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/test_graphviz_1.c b/tests/test_graphviz_1.c
new file mode 100644
index 0000000..9199b25
--- /dev/null
+++ b/tests/test_graphviz_1.c
@@ -0,0 +1,46 @@
+#include <graphviz/gvc.h>
+
+int main(int argc, char *argv[])
+{
+ Agnode_t *node1, *node2;
+ Agedge_t *edge1;
+ Agraph_t *graph;
+ GVC_t *gvc;
+
+ gvc = gvContext ();
+ graph = agopen ("graph", Agdirected, NULL);
+
+ node1 = agnode(graph, "node1", TRUE);
+ agsafeset (node1, "width", "1", "");
+ agsafeset (node1, "height", "1", "");
+
+ node2 = agnode(graph, "node2", TRUE);
+ agsafeset (node2, "width", "1", "");
+ agsafeset (node2, "height", "1", "");
+
+ edge1 = agedge(graph, node1, node2, "edge1", TRUE);
+
+ puts ("---------- initially ----------");
+ agwrite (graph, stdout);
+
+ gvLayout (gvc, graph, "dot");
+ gvRender(gvc, graph, "dot", NULL);
+ gvFreeLayout(gvc, graph);
+
+ puts ("---------- after first layouting ----------");
+ agwrite (graph, stdout);
+
+ agsafeset (node2, "height", "2", "");
+
+ gvLayout (gvc, graph, "dot");
+ gvRender(gvc, graph, "dot", NULL);
+ gvFreeLayout(gvc, graph);
+
+ puts ("---------- after second layouting ----------");
+ agwrite (graph, stdout);
+
+ agclose (graph);
+ gvFreeContext(gvc);
+
+ return 0;
+}