From: Magnus Jacobsson Date: Thu, 15 Sep 2022 12:12:16 +0000 (+0200) Subject: arrows: arrow_type_normal0: fix positioning of normal/inv arrow also for l/r modifiers X-Git-Tag: 7.0.0~21^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5a11aede5dc28e62ddc651ff01027e51efe58d49;p=graphviz arrows: arrow_type_normal0: fix positioning of normal/inv arrow also for l/r modifiers The test_edge_node_overlap_normal_and_inv_edge_arrows_all_modifiers now succeeds, so the expectancy that it should fail is removed. --- diff --git a/lib/common/arrows.c b/lib/common/arrows.c index 705fca7da..e68f193cc 100644 --- a/lib/common/arrows.c +++ b/lib/common/arrows.c @@ -504,11 +504,10 @@ static pointf arrow_type_normal0(pointf p, pointf u, double penwidth, int flag, q.x = p.x + u.x; q.y = p.y + u.y; - // FIXME: handle this correctly for ARR_MOD_LEFT and ARR_MOD_RIGHT when the - // angle of the arrow tip is half of the normal arrow - - const pointf normal_left = {-v.x, -v.y}; - const pointf normal_right = v; + const pointf origin = {0, 0}; + const pointf v_inv = {-v.x, -v.y}; + const pointf normal_left = flag & ARR_MOD_RIGHT ? origin : v_inv; + const pointf normal_right = flag & ARR_MOD_LEFT ? origin : v; const pointf base_left = flag & ARR_MOD_INV ? normal_right : normal_left; const pointf base_right = flag & ARR_MOD_INV ? normal_left : normal_right; const pointf normal_tip = {-u.x, -u.y}; diff --git a/tests/test_edge_node_overlap_normal_and_inv_edge_arrows_all_modifiers.cpp b/tests/test_edge_node_overlap_normal_and_inv_edge_arrows_all_modifiers.cpp index 22a2ce84f..10a4b3de8 100644 --- a/tests/test_edge_node_overlap_normal_and_inv_edge_arrows_all_modifiers.cpp +++ b/tests/test_edge_node_overlap_normal_and_inv_edge_arrows_all_modifiers.cpp @@ -5,14 +5,11 @@ #include "test_edge_node_overlap_utilities.h" #include "test_utilities.h" -// FIXME: this test fails for the 'l' and 'r' arrow shape modifiers which do not -// handle the miter point correctly yet - TEST_CASE( "Edge node overlap for normal and inv arrow with all arrow shape modifiers", - "[!shouldfail] An edge connected to a node shall touch that node and not " - "overlap it too much, regardless of if the arrow shape is 'normal' or " - "'inv' and which arrrow shape modifier is used") { + "An edge connected to a node shall touch that node and not overlap it too " + "much, regardless of if the arrow shape is 'normal' or 'inv' and which " + "arrrow shape modifier is used") { std::string filename_base = AUTO_NAME();