From: Magnus Jacobsson Date: Thu, 6 Oct 2022 06:23:38 +0000 (+0200) Subject: arrows: arrow_length_dot: take edge penwidth into account when calculating length X-Git-Tag: 7.0.0~6^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1dd46de1c6bbaa36ada74dfdca84986049849516;p=graphviz arrows: arrow_length_dot: take edge penwidth into account when calculating length The test_edge_node_overlap_dot_edge_arrow test case now succeeds, so the expectancy that it should fail is removed. Towards https://gitlab.com/graphviz/graphviz/-/issues/372. --- diff --git a/lib/common/arrows.c b/lib/common/arrows.c index 860278391..bfc5f9c2e 100644 --- a/lib/common/arrows.c +++ b/lib/common/arrows.c @@ -125,6 +125,7 @@ static pointf arrow_type_gap(GVJ_t * job, pointf p, pointf u, double arrowsize, static double arrow_length_generic(double lenfact, double arrowsize, double penwidth, int flag); static double arrow_length_normal(double lenfact, double arrowsize, double penwidth, int flag); static double arrow_length_box(double lenfact, double arrowsize, double penwidth, int flag); +static double arrow_length_dot(double lenfact, double arrowsize, double penwidth, int flag); static const arrowtype_t Arrowtypes[] = { {ARR_TYPE_NORM, 1.0, arrow_type_normal, arrow_length_normal}, @@ -132,7 +133,7 @@ static const arrowtype_t Arrowtypes[] = { {ARR_TYPE_TEE, 0.5, arrow_type_tee, arrow_length_generic}, {ARR_TYPE_BOX, 1.0, arrow_type_box, arrow_length_box}, {ARR_TYPE_DIAMOND, 1.2, arrow_type_diamond, arrow_length_generic}, - {ARR_TYPE_DOT, 0.8, arrow_type_dot, arrow_length_generic}, + {ARR_TYPE_DOT, 0.8, arrow_type_dot, arrow_length_dot}, {ARR_TYPE_CURVE, 1.0, arrow_type_curve, arrow_length_generic}, {ARR_TYPE_GAP, 0.5, arrow_type_gap, arrow_length_generic}, }; @@ -1010,3 +1011,10 @@ static double arrow_length_box(double lenfact, double arrowsize, return lenfact * arrowsize * ARROW_LENGTH + penwidth / 2; } + +static double arrow_length_dot(double lenfact, double arrowsize, + double penwidth, int flag) { + (void)flag; + + return lenfact * arrowsize * ARROW_LENGTH + penwidth; +} diff --git a/tests/test_edge_node_overlap_dot_edge_arrow.cpp b/tests/test_edge_node_overlap_dot_edge_arrow.cpp index 575476a0d..1152359c0 100644 --- a/tests/test_edge_node_overlap_dot_edge_arrow.cpp +++ b/tests/test_edge_node_overlap_dot_edge_arrow.cpp @@ -6,8 +6,8 @@ #include "test_utilities.h" TEST_CASE("Edge node overlap for dot arrow", - "[!shouldfail] An edge connected to a node shall touch that node and " - "not overlap it too much") { + "An edge connected to a node shall touch that node and not overlap " + "it too much") { const std::string_view primitive_arrow_shape = "dot";