From: Matthew Fernandez Date: Sun, 29 Jan 2023 01:18:51 +0000 (-0800) Subject: add a test case for HSV with an alpha channel X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e2593310222373f5165b83c6e26fd4cef7efefe2;p=graphviz add a test case for HSV with an alpha channel Gitlab: #510 --- diff --git a/tests/test_regression.py b/tests/test_regression.py index de2009a36..a486f82d7 100644 --- a/tests/test_regression.py +++ b/tests/test_regression.py @@ -325,6 +325,28 @@ def test_358(): assert m is not None, \ f"font characteristic {1 << i} not enabled in xdot 1.7" +@pytest.mark.xfail(strict=True) +def test_510(): + """ + HSV colors should also support an alpha channel + https://gitlab.com/graphviz/graphviz/-/issues/510 + """ + + # a graph with a turquoise, partially transparent node + source = 'digraph { a [color="0.482 0.714 0.878 0.5"]; }' + + # process this with dot + svg = dot("svg", source=source) + + # see if we can locate an opacity adjustment + m = re.search(r'\bstroke-opacity="(?P\d*.\d*)"', svg) + assert m is not None, "no stroke-opacity set; alpha channel ignored?" + + # it should be something in-between transparent and opaque + opacity = float(m.group("opacity")) + assert opacity > 0, "node set transparent; misinterpreted alpha channel?" + assert opacity < 1, "node set opaque; misinterpreted alpha channel?" + @pytest.mark.skipif(which("gv2gxl") is None or which("gxl2gv") is None, reason="GXL tools not available") def test_517():