| 1 |
/* test case for repeated use of Pango plugin (see |
| 2 |
* test_regression.py:test_1767()) |
| 3 |
*/ |
| 4 |
|
| 5 |
#include <assert.h> |
| 6 |
#include <graphviz/cgraph.h> |
| 7 |
#include <graphviz/gvc.h> |
| 8 |
#include <stdio.h> |
| 9 |
#include <stdlib.h> |
| 10 |
|
| 11 |
static void load(const char *filename) { |
| 12 |
Agraph_t *g; |
| 13 |
GVC_t *gvc; |
| 14 |
FILE *file; |
| 15 |
int r; |
| 16 |
Agraph_t *sg; |
| 17 |
|
| 18 |
gvc = gvContext(); |
| 19 |
assert(gvc != NULL); |
| 20 |
|
| 21 |
file = fopen(filename, "r"); |
| 22 |
assert(file != NULL); |
| 23 |
|
| 24 |
g = agread(file, NULL); |
| 25 |
printf("Loaded graph:%s\n", agnameof(g)); |
| 26 |
|
| 27 |
r = gvLayout(gvc, g, "dot"); |
| 28 |
assert(r == 0); |
| 29 |
|
| 30 |
for (sg = agfstsubg(g); sg != NULL; sg = agnxtsubg(sg)) { |
| 31 |
printf("%s contains %d nodes\n", agnameof(sg), (int)agnnodes(sg)); |
| 32 |
} |
| 33 |
|
| 34 |
gvFreeLayout(gvc, g); |
| 35 |
agclose(g); |
| 36 |
fclose(file); |
| 37 |
gvFreeContext(gvc); |
| 38 |
} |
| 39 |
|
| 40 |
int main(int argc, char **argv) { |
| 41 |
|
| 42 |
assert(argc == 2); |
| 43 |
|
| 44 |
load(argv[1]); |
| 45 |
load(argv[1]); |
| 46 |
|
| 47 |
return 0; |
| 48 |
} |