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

Skip to content

Commit 489005d

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

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

lib/matplotlib/tests/test_widgets.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
except ImportError:
88
import mock
99

10+
import numpy as np
11+
1012
import matplotlib.widgets as widgets
1113
import matplotlib.pyplot as plt
12-
from matplotlib.testing.decorators import cleanup
14+
from matplotlib.testing.decorators import cleanup, image_comparison
1315

1416
from numpy.testing import assert_allclose
1517

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

0 commit comments

Comments
 (0)