From: Matthew Fernandez Date: Mon, 15 Aug 2022 03:21:13 +0000 (-0700) Subject: add a test case for #2258 X-Git-Tag: 5.0.1~5^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cc8e2d3aa5d84d8a6f87d8bcea296a5c3abe2f3d;p=graphviz add a test case for #2258 --- 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"