Test rotating using the left mouse button.
(style)
| 1997 | @pytest.mark.parametrize('style', |
| 1998 | ('azel', 'trackball', 'sphere', 'arcball')) |
| 1999 | def test_rotate(style): |
| 2000 | """Test rotating using the left mouse button.""" |
| 2001 | if style == 'azel': |
| 2002 | s = 0.5 |
| 2003 | else: |
| 2004 | s = mpl.rcParams['axes3d.trackballsize'] / 2 |
| 2005 | s *= 0.5 |
| 2006 | mpl.rcParams['axes3d.trackballborder'] = 0 |
| 2007 | with mpl.rc_context({'axes3d.mouserotationstyle': style}): |
| 2008 | for roll, dx, dy in [ |
| 2009 | [0, 1, 0], |
| 2010 | [30, 1, 0], |
| 2011 | [0, 0, 1], |
| 2012 | [30, 0, 1], |
| 2013 | [0, 0.5, np.sqrt(3)/2], |
| 2014 | [30, 0.5, np.sqrt(3)/2], |
| 2015 | [0, 2, 0]]: |
| 2016 | fig = plt.figure() |
| 2017 | ax = fig.add_subplot(1, 1, 1, projection='3d') |
| 2018 | ax.view_init(0, 0, roll) |
| 2019 | ax.figure.canvas.draw() |
| 2020 | |
| 2021 | # drag mouse to change orientation |
| 2022 | MouseEvent._from_ax_coords( |
| 2023 | "button_press_event", ax, (0, 0), MouseButton.LEFT)._process() |
| 2024 | MouseEvent._from_ax_coords( |
| 2025 | "motion_notify_event", ax, (s*dx*ax._pseudo_w, s*dy*ax._pseudo_h), |
| 2026 | MouseButton.LEFT)._process() |
| 2027 | ax.figure.canvas.draw() |
| 2028 | |
| 2029 | c = np.sqrt(3)/2 |
| 2030 | expectations = { |
| 2031 | ('azel', 0, 1, 0): (0, -45, 0), |
| 2032 | ('azel', 0, 0, 1): (-45, 0, 0), |
| 2033 | ('azel', 0, 0.5, c): (-38.971143, -22.5, 0), |
| 2034 | ('azel', 0, 2, 0): (0, -90, 0), |
| 2035 | ('azel', 30, 1, 0): (22.5, -38.971143, 30), |
| 2036 | ('azel', 30, 0, 1): (-38.971143, -22.5, 30), |
| 2037 | ('azel', 30, 0.5, c): (-22.5, -38.971143, 30), |
| 2038 | |
| 2039 | ('trackball', 0, 1, 0): (0, -28.64789, 0), |
| 2040 | ('trackball', 0, 0, 1): (-28.64789, 0, 0), |
| 2041 | ('trackball', 0, 0.5, c): (-24.531578, -15.277726, 3.340403), |
| 2042 | ('trackball', 0, 2, 0): (0, -180/np.pi, 0), |
| 2043 | ('trackball', 30, 1, 0): (13.869588, -25.319385, 26.87008), |
| 2044 | ('trackball', 30, 0, 1): (-24.531578, -15.277726, 33.340403), |
| 2045 | ('trackball', 30, 0.5, c): (-13.869588, -25.319385, 33.129920), |
| 2046 | |
| 2047 | ('sphere', 0, 1, 0): (0, -30, 0), |
| 2048 | ('sphere', 0, 0, 1): (-30, 0, 0), |
| 2049 | ('sphere', 0, 0.5, c): (-25.658906, -16.102114, 3.690068), |
| 2050 | ('sphere', 0, 2, 0): (0, -90, 0), |
| 2051 | ('sphere', 30, 1, 0): (14.477512, -26.565051, 26.565051), |
| 2052 | ('sphere', 30, 0, 1): (-25.658906, -16.102114, 33.690068), |
| 2053 | ('sphere', 30, 0.5, c): (-14.477512, -26.565051, 33.434949), |
| 2054 | |
| 2055 | ('arcball', 0, 1, 0): (0, -60, 0), |
| 2056 | ('arcball', 0, 0, 1): (-60, 0, 0), |
nothing calls this directly
no test coverage detected
searching dependent graphs…