]> granicus.if.org Git - graphviz/commitdiff
tests: test_rankdir: add checking of relative position of nodes
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Wed, 17 Aug 2022 12:59:04 +0000 (14:59 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Tue, 23 Aug 2022 06:19:35 +0000 (08:19 +0200)
tests/test_rankdir.cpp

index 2b39d52765fcb0a1cebc9513c09e8ce569b3f992..c474d0f5d0f9d9ba03900b6ec246feb3d23d5dbf 100644 (file)
@@ -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()));
+  }
 }