#include "test_edge_node_overlap_utilities.h"
#include "test_utilities.h"
-TEST_CASE(
- "Overlap",
- "[!shouldfail] An edge connected to a node shall not overlap that node") {
+TEST_CASE("Edge node overlap",
+ "[!shouldfail] An edge connected to a node shall touch that node and "
+ "not overlap it too much") {
const graph_options graph_options = {
.node_shape = "polygon",
UNREACHABLE();
}
-/// check that edges do not overlap nodes
+/// check overlap between the edge and the nodes
static bool check_analyzed_svg(SVGAnalyzer &svg_analyzer,
const graph_options &graph_options,
const check_options &check_options) {
check_options.max_node_edge_overlap +
check_options.svg_rounding_error * 2);
}
+
+ // check minimum head node and edge overlap
+ if (check_options.check_min_edge_node_overlap) {
+ DO_CHECK(head_node_edge_overlap >=
+ check_options.min_node_edge_overlap -
+ check_options.svg_rounding_error * 2);
+ }
}
// check tail node and edge overlap
check_options.max_node_edge_overlap +
check_options.svg_rounding_error * 2);
}
+
+ // check minimum overlap at edge tail
+ if (check_options.check_min_edge_node_overlap) {
+ DO_CHECK(tail_node_edge_overlap >=
+ check_options.min_node_edge_overlap -
+ check_options.svg_rounding_error * 2);
+ }
}
return success;
const check_options check_options = {
.check_max_edge_node_overlap =
tc_check_options.check_max_edge_node_overlap,
+ .check_min_edge_node_overlap =
+ tc_check_options.check_min_edge_node_overlap,
.max_node_edge_overlap = graphviz_bezier_clip_margin,
+ .min_node_edge_overlap = 0,
.svg_rounding_error = graphviz_max_svg_rounding_error,
};
struct tc_check_options {
/// whether to check that there is not too much overlap
bool check_max_edge_node_overlap = true;
+ /// whether to check that there is enough overlap
+ bool check_min_edge_node_overlap = true;
};
struct check_options {
/// whether to check that there is not too much overlap
bool check_max_edge_node_overlap = true;
+ /// whether to check that there is enough overlap
+ bool check_min_edge_node_overlap = true;
/// maximum allowed overlap between edge and node
double max_node_edge_overlap;
+ /// minimum required overlap between edge and node
+ double min_node_edge_overlap;
/// rounding error caused by limited precision in SVG attribute values
double svg_rounding_error;
};