From: Magnus Jacobsson Date: Wed, 17 Aug 2022 12:59:04 +0000 (+0200) Subject: tests: test_rankdir: add checking of relative position of nodes X-Git-Tag: 6.0.1~32^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a60770cbdfb1b4cc90791ab0914979c3fb85809;p=graphviz tests: test_rankdir: add checking of relative position of nodes --- diff --git a/tests/test_rankdir.cpp b/tests/test_rankdir.cpp index 2b39d5276..c474d0f5d 100644 --- a/tests/test_rankdir.cpp +++ b/tests/test_rankdir.cpp @@ -41,4 +41,13 @@ TEST_CASE("Graph rankdir", "Test that the Graphviz `rankdir` attribute affects " const auto &graph = svgAnalyzer.graphs().back(); const auto node_a = graph.node("a"); const auto node_b = graph.node("b"); + if (rankdir == "TB") { + CHECK(node_a.center().is_higher_than(node_b.center())); + } else if (rankdir == "BT") { + CHECK(node_a.center().is_lower_than(node_b.center())); + } else if (rankdir == "LR") { + CHECK(node_a.center().is_more_left_than(node_b.center())); + } else if (rankdir == "RL") { + CHECK(node_a.center().is_more_right_than(node_b.center())); + } }