]> granicus.if.org Git - graphviz/commitdiff
arrows: arrow_length_dot: take edge penwidth into account when calculating length
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Thu, 6 Oct 2022 06:23:38 +0000 (08:23 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Tue, 18 Oct 2022 18:58:25 +0000 (20:58 +0200)
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.

lib/common/arrows.c
tests/test_edge_node_overlap_dot_edge_arrow.cpp

index 8602783912deb0e8ef85fd2366ee9d4c5f60ed1d..bfc5f9c2e39672aa4515c9bd6ef78ace56263f95 100644 (file)
@@ -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;
+}
index 575476a0db2a11904e00a32b8eabc79bc5deda51..1152359c05152d4db328797b51af145b4c4575aa 100644 (file)
@@ -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";