Skip to content

Commit 8c03f2b

Browse files
committed
test:Added DOT highlights test.
1 parent 5b02e5f commit 8c03f2b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

xt/20-graphviz-dot-format.rakutest

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,32 @@ END
5555
is $res.indices('label="here"').elems, 1, 'Expected number of "here" edge labels';
5656
}, 'Labeled directed graph as mixed';
5757

58+
## 3
59+
subtest {
60+
my @edges = '1' => '2', '2' => '1', '1' => '3', '3' => '2';
61+
my %edge-labels = '1' => { '2' => 'here'};
62+
my %highlight = Red => ( '1' => '2', );
63+
my $res = Graph.new(@edges, :directed).dot(:%highlight);
64+
65+
my $dot = q:to/END/;
66+
digraph {
67+
bgcolor="none";
68+
node [style=filled, fixedsize=true, shape=circle, color="Black", fillcolor="SteelBlue", penwidth=1, fontsize=12, fontcolor="White", labelloc=c, width=0.3, height=0.3];
69+
edge [color="SteelBlue", penwidth=2, fontsize=10, fontcolor="Ivory", arrowsize=1];
70+
"1"; "2"; "3";
71+
"2" -> "1"
72+
"1" -> "3"
73+
"3" -> "2"
74+
edge [color="Red", penwidth=2, arrowsize=1];
75+
"1" -> "2"
76+
}
77+
END
78+
79+
is $res.indices('->').elems, 4, 'Expected number of edge specs';
80+
is $res.indices('[dir=forward]').elems, 0, 'Expected number of directed edge specs';
81+
is $res.indices('[dir=none]').elems, 0, 'Expected number of un-directed edge specs';
82+
is $res.indices('color="Red"').elems, 1, 'Expected number of Red color specs';
83+
84+
}, 'Directed graph with highlights';
5885

5986
done-testing;

0 commit comments

Comments
 (0)