From cc8e2d3aa5d84d8a6f87d8bcea296a5c3abe2f3d Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 14 Aug 2022 20:21:13 -0700 Subject: [PATCH] add a test case for #2258 --- tests/2258.dot | 13 +++++++++++++ tests/test_regression.py | 25 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/2258.dot diff --git a/tests/2258.dot b/tests/2258.dot new file mode 100644 index 000000000..84c631926 --- /dev/null +++ b/tests/2258.dot @@ -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=" "] +} diff --git a/tests/test_regression.py b/tests/test_regression.py index 1073bcaf9..ae0c31530 100644 --- a/tests/test_regression.py +++ b/tests/test_regression.py @@ -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" -- 2.40.0