Debian Codegraph @

tests/test_edge_node_overlap_tee_edge_arrow.cpp

raw
1 #include <string>
2
3 #include <catch2/catch_all.hpp>
4
5 #include "test_edge_node_overlap_utilities.h"
6 #include "test_utilities.h"
7
8 TEST_CASE("Edge node overlap for 'tee' arrow",
9 "An edge connected to a node shall touch that node and not overlap "
10 "it too much") {
11
12 const std::string_view primitive_arrow_shape = "tee";
13
14 INFO("Edge arrowhead: " << primitive_arrow_shape);
15
16 std::string filename_base = AUTO_NAME();
17
18 const graph_options graph_options = {
19 .node_shape = "polygon",
20 .node_penwidth = 2,
21 .dir = "both",
22 // The 'tee' arrow shape consists of a 'polygon' part which expands with
23 // penwidth in the forward and reverse direction of the arrow and a
24 // 'polyline' part which does not expand with penwidth in the forward and
25 // reverse direction of the arrow.
26 //
27 // Edge penwidth > 2 causes the 'polygon' part of the arrow to overlap
28 // the 'polyline' part at the end of the arrow.
29 //
30 // Edge penwidth > 4 causes the 'polygon' part of the arrow to overlap
31 // the 'polyline' part at the start of the arrow.
32 //
33 // However, in the 'test_edge_node_overlap' function, we allow a quite
34 // large overlap between the edge stem and the edge arrow because it's not
35 // visible if it's less than the edge penwidth (unless the color is
36 // semi-transparent). We therefore set an edge penwidth much larger than 4
37 // in this test in order to be able to check that edge stem and edge arrow
38 // don't overlap too much.
39 .edge_penwidth = 7,
40 .primitive_arrowhead_shape = primitive_arrow_shape,
41 .primitive_arrowtail_shape = primitive_arrow_shape,
42 };
43
44 test_edge_node_overlap(graph_options, {}, {.filename_base = filename_base});
45 }