]> granicus.if.org Git - graphviz/commitdiff
add a test case for #2258
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 15 Aug 2022 03:21:13 +0000 (20:21 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 18 Aug 2022 14:25:57 +0000 (07:25 -0700)
tests/2258.dot [new file with mode: 0644]
tests/test_regression.py

diff --git a/tests/2258.dot b/tests/2258.dot
new file mode 100644 (file)
index 0000000..84c6319
--- /dev/null
@@ -0,0 +1,13 @@
+digraph Tree {
+ overlap = false;
+ tooltip = " ";
+ id = "G2";
+ bgcolor = "#ffffff00";
+ e17e21fbdb233f2d9c26769c3e5 [shape=box style=filled fillcolor="beige: yellow" gradientangle=315 label="xxx
+xxx
+xxx" tooltip=" "  href="xxx"]
+ e17e1a62c7e692fdee219e2a59f [shape=box style=filled fillcolor="beige: turquoise" gradientangle=315 label="xxx
+xxx
+xxx" tooltip=" "  href="xxx"]
+ e17e21fbdb233f2d9c26769c3e5 -> e17e1a62c7e692fdee219e2a59f [style=solid tooltip=" "]
+}
index 1073bcaf90cfae5bfa820ba181fe32610b8c23f6..ae0c3153036e7815c369b90ee522c9a166f7af23 100644 (file)
@@ -1901,3 +1901,28 @@ def test_2225():
     return
 
   p.check_returncode()
+
+@pytest.mark.xfail(strict=True)
+def test_2258():
+  """
+  'id' attribute should be propagated to all graph children in output
+  https://gitlab.com/graphviz/graphviz/-/issues/2258
+  """
+
+  # locate our associated test case in this directory
+  input = Path(__file__).parent / "2258.dot"
+  assert input.exists(), "unexpectedly missing test case"
+
+  # translate this to SVG
+  svg = dot("svg", input)
+
+  # load this as XML
+  root = ET.fromstring(svg)
+
+  # the output is expected to contain a number of linear gradients, all of which
+  # are semantic children of graph marked `id = "G2"`
+  gradients = root.findall(".//{http://www.w3.org/2000/svg}linearGradient")
+  assert len(gradients) > 0, "no gradients in output"
+
+  for gradient in gradients:
+    assert "G2" in gradient.get("id"), "ID was not applied to linear gradients"