]> granicus.if.org Git - graphviz/commitdiff
tests: test_rankdir: add checking of relative position of edge and each node
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Wed, 17 Aug 2022 20:10:28 +0000 (22:10 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Tue, 23 Aug 2022 06:19:35 +0000 (08:19 +0200)
tests/test_rankdir.cpp

index 16f4c885c8528676e58fa2eb42a3d3d1e22824d6..e023c39d0c227f6a6eb4e8fca58cae98f0cf57fd 100644 (file)
@@ -44,11 +44,19 @@ TEST_CASE("Graph rankdir", "Test that the Graphviz `rankdir` attribute affects "
   const auto edge_ab = graph.edge("a->b");
   if (rankdir == "TB") {
     CHECK(node_a.center().is_higher_than(node_b.center()));
+    CHECK(node_a.center().is_higher_than(edge_ab.center()));
+    CHECK(edge_ab.center().is_higher_than(node_b.center()));
   } else if (rankdir == "BT") {
     CHECK(node_a.center().is_lower_than(node_b.center()));
+    CHECK(node_a.center().is_lower_than(edge_ab.center()));
+    CHECK(edge_ab.center().is_lower_than(node_b.center()));
   } else if (rankdir == "LR") {
     CHECK(node_a.center().is_more_left_than(node_b.center()));
+    CHECK(node_a.center().is_more_left_than(edge_ab.center()));
+    CHECK(edge_ab.center().is_more_left_than(node_b.center()));
   } else if (rankdir == "RL") {
     CHECK(node_a.center().is_more_right_than(node_b.center()));
+    CHECK(node_a.center().is_more_right_than(edge_ab.center()));
+    CHECK(edge_ab.center().is_more_right_than(node_b.center()));
   }
 }