]> granicus.if.org Git - graphviz/commitdiff
add a test case for lacking transparency in SVG text
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 17 Jun 2022 00:20:10 +0000 (17:20 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 22 Jun 2022 02:05:01 +0000 (19:05 -0700)
Gitlab: #146

tests/test_regression.py

index 7de0a646b1f26c9fb3bbc21828188a5b1a0cd932..0a0c60f2aa772a33215029bf29872568ebbebd77 100644 (file)
@@ -173,6 +173,29 @@ def test_144(testcase: str):
   # this should be consistent with the direction the edge is drawn
   assert routed_up == head_is_top, "heap/tail confusion"
 
+@pytest.mark.xfail(strict=True)
+def test_146():
+  """
+  dot should respect an alpha channel value of 0 when writing SVG
+  https://gitlab.com/graphviz/graphviz/-/issues/146
+  """
+
+  # a graph using white text but with 0 alpha
+  source = 'graph {\n'                                                         \
+           '  n[style="filled", fontcolor="#FFFFFF00", label="hello world"];\n'\
+           '}'
+
+  # ask Graphviz to process this
+  svg = dot("svg", source=source)
+
+  # the SVG should be setting opacity
+  opacity = re.search(r'\bfill-opacity="(\d+(\.\d+)?)"', svg)
+  assert opacity is not None, "transparency not set for alpha=0 color"
+
+  # it should be zeroed
+  assert float(opacity.group(1)) == 0, \
+    "alpha=0 color set to something non-transparent"
+
 def test_165():
   """
   dot should be able to produce properly escaped xdot output