Skip to content

Commit bbabbea

Browse files
Added handle position checks to test_widgets.py
1 parent 2566eaa commit bbabbea

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lib/matplotlib/tests/test_widgets.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,17 +1107,33 @@ def test_range_slider(orientation):
11071107

11081108
slider.set_val((0.2, 0.6))
11091109
assert_allclose(slider.val, (0.2, 0.6))
1110+
if orientation == "vertical":
1111+
assert_allclose([h.get_ydata()[0] for h in slider._handles], (0.2, 0.6))
1112+
else:
1113+
assert_allclose([h.get_xdata()[0] for h in slider._handles], (0.2, 0.6))
11101114
box = slider.poly.get_extents().transformed(ax.transAxes.inverted())
11111115
assert_allclose(box.get_points().flatten()[idx], [0.2, .25, 0.6, .75])
11121116

11131117
slider.set_val((0.2, 0.1))
11141118
assert_allclose(slider.val, (0.1, 0.2))
1119+
if orientation == "vertical":
1120+
assert_allclose([h.get_ydata()[0] for h in slider._handles], (0.1, 0.2))
1121+
else:
1122+
assert_allclose([h.get_xdata()[0] for h in slider._handles], (0.1, 0.2))
11151123

11161124
slider.set_val((-1, 10))
11171125
assert_allclose(slider.val, (0, 1))
1126+
if orientation == "vertical":
1127+
assert_allclose([h.get_ydata()[0] for h in slider._handles], (0, 1))
1128+
else:
1129+
assert_allclose([h.get_xdata()[0] for h in slider._handles], (0, 1))
11181130

11191131
slider.reset()
1120-
assert_allclose(slider.val, [0.1, 0.34])
1132+
assert_allclose(slider.val, (0.1, 0.34))
1133+
if orientation == "vertical":
1134+
assert_allclose([h.get_ydata()[0] for h in slider._handles], (0.1, 0.34))
1135+
else:
1136+
assert_allclose([h.get_xdata()[0] for h in slider._handles], (0.1, 0.34))
11211137

11221138

11231139
def check_polygon_selector(event_sequence, expected_result, selections_count,

0 commit comments

Comments
 (0)