From a3fe4ba38fe380733f22e5093c29ad1df4972f95 Mon Sep 17 00:00:00 2001 From: Magnus Jacobsson Date: Mon, 9 Nov 2020 18:28:53 +0100 Subject: [PATCH] Add regression test case for gml2gv Related to #1869. --- rtest/1869-1.gml | 12 ++++++++++++ rtest/1869-2.gml | 12 ++++++++++++ rtest/test_regression.py | 21 +++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 rtest/1869-1.gml create mode 100644 rtest/1869-2.gml diff --git a/rtest/1869-1.gml b/rtest/1869-1.gml new file mode 100644 index 000000000..1c19c2851 --- /dev/null +++ b/rtest/1869-1.gml @@ -0,0 +1,12 @@ +graph [ + version 2 + directed 0 + node [ + id 0 + name "a" + graphics [ + width 2.0 + style "dashed" + ] + ] +] diff --git a/rtest/1869-2.gml b/rtest/1869-2.gml new file mode 100644 index 000000000..971177539 --- /dev/null +++ b/rtest/1869-2.gml @@ -0,0 +1,12 @@ +graph [ + version 2 + directed 0 + node [ + id 0 + name "a" + graphics [ + outlineWidth 2 + outlineStyle "dashed" + ] + ] +] diff --git a/rtest/test_regression.py b/rtest/test_regression.py index 62c9f211f..c1f6fa993 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -486,3 +486,24 @@ def test_html(src: str): # otherwise, expect it to succeed assert p.returncode == 0 assert stderr == '' + +@pytest.mark.parametrize('variant', [1, 2]) +@pytest.mark.skipif(shutil.which('gml2gv') is None, reason='gml2gv not available') +def test_1869(variant: int): + ''' + gml2gv should be able to parse the style, outlineStyle, width and + outlineWidth GML attributes and map them to the DOT attributes + style and penwidth respectively + https://gitlab.com/graphviz/graphviz/-/issues/1869 + ''' + + # locate our associated test case in this directory + input = os.path.join(os.path.dirname(__file__), '1869-{}.gml'.format(variant)) + assert os.path.exists(input), 'unexpectedly missing test case' + + # ask gml2gv to translate it to DOT + output = subprocess.check_output(['gml2gv', input], + universal_newlines=True) + + assert 'style=dashed' in output, 'style=dashed not found in DOT output' + assert 'penwidth=2' in output, 'penwidth=2 not found in DOT output' -- 2.40.0