]> granicus.if.org Git - graphviz/commitdiff
Add regression test case for gml2gv
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Mon, 9 Nov 2020 17:28:53 +0000 (18:28 +0100)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Sun, 22 Nov 2020 15:16:45 +0000 (16:16 +0100)
Related to #1869.

rtest/1869-1.gml [new file with mode: 0644]
rtest/1869-2.gml [new file with mode: 0644]
rtest/test_regression.py

diff --git a/rtest/1869-1.gml b/rtest/1869-1.gml
new file mode 100644 (file)
index 0000000..1c19c28
--- /dev/null
@@ -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 (file)
index 0000000..9711775
--- /dev/null
@@ -0,0 +1,12 @@
+graph [
+  version 2
+  directed 0
+  node [
+    id 0
+    name "a"
+    graphics [
+      outlineWidth 2
+      outlineStyle "dashed"
+    ]
+  ]
+]
index 62c9f211f18d72af9e2b03958ea61a20b8f1e7eb..c1f6fa993e3ce0580b69150d1896bd6c4ed05554 100644 (file)
@@ -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'