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

Skip to content

Commit 80b08a3

Browse files
Test 3d toolbar navigation
1 parent f6a3d2e commit 80b08a3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,7 @@ def test_toolbar_zoom_pan(tool, button, key, expected):
16601660
ax = fig.add_subplot(projection='3d')
16611661
ax.scatter(0, 0, 0)
16621662
fig.canvas.draw()
1663+
xlim0, ylim0, zlim0 = ax.get_xlim3d(), ax.get_ylim3d(), ax.get_zlim3d()
16631664

16641665
# Mouse from (0, 0) to (1, 1)
16651666
d0 = (0, 0)
@@ -1694,6 +1695,22 @@ def test_toolbar_zoom_pan(tool, button, key, expected):
16941695
assert ax.get_ylim3d() == pytest.approx(ylim, abs=0.01)
16951696
assert ax.get_zlim3d() == pytest.approx(zlim, abs=0.01)
16961697

1698+
# Ensure that back, forward, and home buttons work
1699+
tb.back()
1700+
assert ax.get_xlim3d() == pytest.approx(xlim0, abs=0.0001)
1701+
assert ax.get_ylim3d() == pytest.approx(ylim0, abs=0.0001)
1702+
assert ax.get_zlim3d() == pytest.approx(zlim0, abs=0.0001)
1703+
1704+
tb.forward()
1705+
assert ax.get_xlim3d() == pytest.approx(xlim, abs=0.01)
1706+
assert ax.get_ylim3d() == pytest.approx(ylim, abs=0.01)
1707+
assert ax.get_zlim3d() == pytest.approx(zlim, abs=0.01)
1708+
1709+
tb.home()
1710+
assert ax.get_xlim3d() == pytest.approx(xlim0, abs=0.0001)
1711+
assert ax.get_ylim3d() == pytest.approx(ylim0, abs=0.0001)
1712+
assert ax.get_zlim3d() == pytest.approx(zlim0, abs=0.0001)
1713+
16971714

16981715
@mpl.style.context('default')
16991716
@check_figures_equal(extensions=["png"])

0 commit comments

Comments
 (0)