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

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 11 additions & 21 deletions lib/matplotlib/tests/test_backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,18 +540,7 @@ def test_interactive_pan_zoom_events(tool, button, patch_vis, forward_nav, t_s):
ylim_b = init_ylim

tb.zoom()
tb.press_zoom(start_event)
tb.drag_zoom(drag_event)
tb.release_zoom(stop_event)

assert ax_t.get_xlim() == pytest.approx(xlim_t, abs=0.15)
assert ax_t.get_ylim() == pytest.approx(ylim_t, abs=0.15)
assert ax_b.get_xlim() == pytest.approx(xlim_b, abs=0.15)
assert ax_b.get_ylim() == pytest.approx(ylim_b, abs=0.15)

# Check if twin-axes are properly triggered
assert ax_t.get_xlim() == pytest.approx(ax_t_twin.get_xlim(), abs=0.15)
assert ax_b.get_xlim() == pytest.approx(ax_b_twin.get_xlim(), abs=0.15)
else:
# Evaluate expected limits
# (call start_pan to make sure ax._pan_start is set)
Expand All @@ -576,15 +565,16 @@ def test_interactive_pan_zoom_events(tool, button, patch_vis, forward_nav, t_s):
ylim_b = init_ylim

tb.pan()
tb.press_pan(start_event)
tb.drag_pan(drag_event)
tb.release_pan(stop_event)

assert ax_t.get_xlim() == pytest.approx(xlim_t, abs=0.15)
assert ax_t.get_ylim() == pytest.approx(ylim_t, abs=0.15)
assert ax_b.get_xlim() == pytest.approx(xlim_b, abs=0.15)
assert ax_b.get_ylim() == pytest.approx(ylim_b, abs=0.15)
start_event._process()
drag_event._process()
stop_event._process()

assert ax_t.get_xlim() == pytest.approx(xlim_t, abs=0.15)
assert ax_t.get_ylim() == pytest.approx(ylim_t, abs=0.15)
assert ax_b.get_xlim() == pytest.approx(xlim_b, abs=0.15)
assert ax_b.get_ylim() == pytest.approx(ylim_b, abs=0.15)

# Check if twin-axes are properly triggered
assert ax_t.get_xlim() == pytest.approx(ax_t_twin.get_xlim(), abs=0.15)
assert ax_b.get_xlim() == pytest.approx(ax_b_twin.get_xlim(), abs=0.15)
# Check if twin-axes are properly triggered
assert ax_t.get_xlim() == pytest.approx(ax_t_twin.get_xlim(), abs=0.15)
assert ax_b.get_xlim() == pytest.approx(ax_b_twin.get_xlim(), abs=0.15)
10 changes: 4 additions & 6 deletions lib/mpl_toolkits/mplot3d/tests/test_axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -2138,14 +2138,12 @@ def test_toolbar_zoom_pan(tool, button, key, expected):
tb = NavigationToolbar2(fig.canvas)
if tool == "zoom":
tb.zoom()
tb.press_zoom(start_event)
tb.drag_zoom(drag_event)
tb.release_zoom(stop_event)
else:
tb.pan()
tb.press_pan(start_event)
tb.drag_pan(drag_event)
tb.release_pan(stop_event)

start_event._process()
drag_event._process()
stop_event._process()

# Should be close, but won't be exact due to screen integer resolution
xlim, ylim, zlim = expected
Expand Down
Loading