From 1a4ef1d2696f81215d0b83d0fa40d76726c9c91b Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Wed, 23 Jun 2021 19:04:27 -0700 Subject: [PATCH] add a test case for #517 --- rtest/test_regression.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/rtest/test_regression.py b/rtest/test_regression.py index 9d3638d7d..8380564e5 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -243,6 +243,43 @@ def test_167(): # Graphviz should not have caused a segfault assert ret != -signal.SIGSEGV, "Graphviz segfaulted" +@pytest.mark.xfail(strict=True) +@pytest.mark.skipif(shutil.which("gv2gxl") is None or + shutil.which("gxl2gv") is None, + reason="GXL tools not available") +def test_517(): + """ + round tripping a graph through gv2gxl should not lose HTML labels + https://gitlab.com/graphviz/graphviz/-/issues/517 + """ + + # our test case input + input = \ + 'digraph{\n' \ + ' A[label=<
(A)
>]\n' \ + ' B[label="
(B)
"]\n' \ + '}' + + # translate it to GXL + p = subprocess.Popen(["gv2gxl"], stdin=subprocess.PIPE, + stdout=subprocess.PIPE, universal_newlines=True) + gxl, _ = p.communicate(input) + assert p.returncode == 0 + + # translate this back to Dot + p = subprocess.Popen(["gxl2gv"], stdin=subprocess.PIPE, + stdout=subprocess.PIPE, universal_newlines=True) + dot, _ = p.communicate(gxl) + assert p.returncode == 0 + + # the result should have both expected labels somewhere + assert \ + "label=<
(A)
>" in dot, \ + "HTML label missing" + assert \ + 'label="
(B)
"' in dot, \ + "regular label missing" + def test_793(): """ Graphviz should not crash when using VRML output with a non-writable current -- 2.40.0