Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 508bd68

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

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

lib/matplotlib/tests/test_widgets.py

Lines changed: 20 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,22 @@ 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+
style='default')
278+
def test_radio_buttons_image():
279+
get_ax()
280+
plt.subplots_adjust(left=0.3)
281+
rax = plt.axes([0.05, 0.7, 0.15, 0.15])
282+
widgets.RadioButtons(rax, ('Radio 1', 'Radio 2', 'Radio 3'))
283+
284+
285+
@image_comparison(baseline_images=['check_buttons'], extensions=['png'],
286+
style='default')
287+
def test_check_buttons_image():
288+
get_ax()
289+
plt.subplots_adjust(left=0.3)
290+
rax = plt.axes([0.05, 0.7, 0.15, 0.15])
291+
widgets.CheckButtons(rax, ('Check 1', 'Check 2', 'Check 3'),
292+
(False, True, True))

0 commit comments

Comments
 (0)