From 8469b2671ee2d47ca749a9d11238710b4c911d8e Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Mon, 22 Sep 2025 17:02:49 -0700 Subject: [PATCH] add a test case for empty images Though this passes on all current platforms, this will hopefully serve as a canary when upgrading to Fedora 43 where this problem exists. Gitlab: #2732 Reported-by: FeRD (Frank Dana) --- tests/test_regression.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/test_regression.py b/tests/test_regression.py index 4de0ae900b..5e2a7a7284 100644 --- a/tests/test_regression.py +++ b/tests/test_regression.py @@ -6092,6 +6092,38 @@ def test_2731(): assert result.strip() != "", "gvpr output missing" +@pytest.mark.parametrize( + "fmt", + ( + "png", + pytest.param( + "png:cairo:gdk", + marks=pytest.mark.skipif( + is_macos() or platform.system() == "Windows", + reason="GDK plugin not supported", + ), + ), + "jpg", + "jpg:cairo:gd", + ), +) +def test_2732(fmt: str): + """ + back ends should not produce empty files + https://gitlab.com/graphviz/graphviz/-/issues/2732 + + Args: + fmt: Format to pass to dot’s `-T…`. + """ + + # an arbitrary, trivial graph + source = "graph G { a -- b; }" + + # confirm this produces non-empty output + output = dot(fmt, source=source) + assert output != b"", "empty output produced for valid graph" + + @pytest.mark.parametrize("package", ("Tcldot", "Tclpathplan")) @pytest.mark.skipif(shutil.which("tclsh") is None, reason="tclsh not available") @pytest.mark.xfail( -- GitLab