8000 Add image comparison tests for CheckButtons and RadioButtons · matplotlib/matplotlib@71a0495 · GitHub
[go: up one dir, main page]

Skip to content

Commit 71a0495

Browse files
committed
Add image comparison tests for CheckButtons and RadioButtons
1 parent 13f35e1 commit 71a0495

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed
Loading
Loading

lib/matplotlib/tests/test_widgets.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import matplotlib.widgets as widgets
1111
import matplotlib.pyplot as plt
12-
from matplotlib.testing.decorators import cleanup
12+
from matplotlib.testing.decorators import cleanup, image_comparison
1313

1414
from numpy.testing import assert_allclose
1515

@@ -271,3 +271,21 @@ def clicked_function():
271271
pass
272272
cid = check.on_clicked(clicked_function)
273273
check.disconnect(cid)
274+
275+
276+
@image_comparison(baseline_images=['radio_buttons'], extensions=['png'])
277+
def test_radio_buttons_image():
278+
ax = get_ax()
279+
plt.subplots_adjust(left=0.3)
280+
axcolor = 'lightgoldenrodyellow'
281+
rax = plt.axes([0.05, 0.7, 0.15, 0.15], facecolor=axcolor)
282+
widgets.RadioButtons(rax, ('Radio 1', 'Radio 2', 'Radio 3'))
283+
284+
285+
@image_comparison(baseline_images=['check_buttons'], extensions=['png'])
286+
def test_check_buttons_image():
287+
ax = get_ax()
288+
plt.subplots_adjust(left=0.3)
289+
axcolor = 'lightgoldenrodyellow'
290+
rax = plt.axes([0.05, 0.7, 0.15, 0.15], facecolor=axcolor)
291+
widgets.CheckButtons(rax, ('Check 1', 'Check 2', 'Check 3'), (False, True, True))

0 commit comments

Comments
 (0)
0