Skip to content

Commit 39bb813

Browse files
committed
test(shapes,labels): add visual baselines for the outline toggle (#748)
Add PlotTester golden-baseline tests covering the render output of the outline bool toggle: outline=True draws an outline, outline=False suppresses it. Baselines to be generated from CI artifacts.
1 parent da53b58 commit 39bb813

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

tests/pl/test_render_labels.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,17 @@ def test_plot_can_control_label_outline(self, sdata_blobs: SpatialData):
340340
contour_px=15,
341341
).pl.show()
342342

343+
def test_plot_outline_toggle_true_draws_outline(self, sdata_blobs: SpatialData):
344+
# #748: outline=True is a shortcut for outline_alpha=1 (must draw a contour).
345+
sdata_blobs.pl.render_labels("blobs_labels", outline=True, fill_alpha=0.0, contour_px=15).pl.show()
346+
347+
def test_plot_outline_toggle_false_suppresses_outline(self, sdata_blobs: SpatialData):
348+
# #748: outline=False wins over the outline_* params (no contour drawn).
349+
with pytest.warns(UserWarning, match="outline=False"):
350+
sdata_blobs.pl.render_labels(
351+
"blobs_labels", outline=False, outline_color="red", outline_alpha=1.0, contour_px=15
352+
).pl.show()
353+
343354
def test_plot_can_control_label_infill(self, sdata_blobs: SpatialData):
344355
sdata_blobs.pl.render_labels(
345356
"blobs_labels",

tests/pl/test_render_shapes.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,17 @@ def test_plot_can_render_polygons(self, sdata_blobs: SpatialData):
108108
def test_plot_can_render_polygons_with_outline(self, sdata_blobs: SpatialData):
109109
sdata_blobs.pl.render_shapes(element="blobs_polygons", outline_alpha=1).pl.show()
110110

111+
def test_plot_outline_toggle_true_draws_outline(self, sdata_blobs: SpatialData):
112+
# #748: outline=True is a shortcut for outline_alpha=1 (must draw an outline).
113+
sdata_blobs.pl.render_shapes(element="blobs_polygons", outline=True).pl.show()
114+
115+
def test_plot_outline_toggle_false_suppresses_outline(self, sdata_blobs: SpatialData):
116+
# #748: outline=False wins over the outline_* params (no outline drawn).
117+
with pytest.warns(UserWarning, match="outline=False"):
118+
sdata_blobs.pl.render_shapes(
119+
element="blobs_polygons", outline=False, outline_color="red", outline_alpha=1
120+
).pl.show()
121+
111122
def test_plot_can_render_polygons_with_str_colored_outline(self, sdata_blobs: SpatialData):
112123
sdata_blobs.pl.render_shapes(element="blobs_polygons", outline_alpha=1, outline_color="red").pl.show()
113124

0 commit comments

Comments
 (0)