Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dab005d

Browse filesBrowse files
Merge pull request #12482 from timhoffm/test-slider-orientation
Test slider orientation
2 parents 0f7367c + 3ae82d9 commit dab005d
Copy full SHA for dab005d

File tree

Expand file treeCollapse file tree

1 file changed

+14
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-8
lines changed

‎lib/matplotlib/tests/test_widgets.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_widgets.py
+14-8Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -321,16 +321,22 @@ def test_slider_valmin_valmax():
321321

322322
def test_slider_horizontal_vertical():
323323
fig, ax = plt.subplots()
324-
slider = widgets.Slider(ax=ax, label='', valmin=0.0, valmax=24.0,
325-
valinit=12.0, orientation='horizontal')
326-
slider.set_val(10.0)
327-
assert slider.val == 10.0
324+
slider = widgets.Slider(ax=ax, label='', valmin=0, valmax=24,
325+
valinit=12, orientation='horizontal')
326+
slider.set_val(10)
327+
assert slider.val == 10
328+
# check the dimension of the slider patch in axes units
329+
box = slider.poly.get_extents().transformed(ax.transAxes.inverted())
330+
assert_allclose(box.bounds, [0, 0, 10/24, 1])
328331

329332
fig, ax = plt.subplots()
330-
slider = widgets.Slider(ax=ax, label='', valmin=0.0, valmax=24.0,
331-
valinit=12.0, orientation='vertical')
332-
slider.set_val(10.0)
333-
assert slider.val == 10.0
333+
slider = widgets.Slider(ax=ax, label='', valmin=0, valmax=24,
334+
valinit=12, orientation='vertical')
335+
slider.set_val(10)
336+
assert slider.val == 10
337+
# check the dimension of the slider patch in axes units
338+
box = slider.poly.get_extents().transformed(ax.transAxes.inverted())
339+
assert_allclose(box.bounds, [0, 0, 1, 10/24])
334340

335341

336342
def check_polygon_selector(event_sequence, expected_result, selections_count):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.