@@ -1533,14 +1533,22 @@ def convert_lim(dmin, dmax):
1533
1533
assert z_center != pytest .approx (z_center0 )
1534
1534
1535
1535
1536
- @pytest .mark .parametrize ("tool,button,expected" ,
1537
- [("zoom" , MouseButton .LEFT , # zoom in
1536
+ @pytest .mark .parametrize ("tool,button,key, expected" ,
1537
+ [("zoom" , MouseButton .LEFT , None , # zoom in
1538
1538
((0.03 , 0.61 ), (0.27 , 0.71 ), (0.32 , 0.89 ))),
1539
- ("zoom" , MouseButton .RIGHT , # zoom out
1539
+ ("zoom" , MouseButton .LEFT , 'x' , # zoom in
1540
+ ((0.17 , 0.73 ), (0.09 , 0.43 ), (- 0.06 , 0.06 ))),
1541
+ ("zoom" , MouseButton .LEFT , 'y' , # zoom in
1542
+ ((- 0.23 , - 0.03 ), (0.07 , 0.37 ), (0.32 , 0.89 ))),
1543
+ ("zoom" , MouseButton .RIGHT , None , # zoom out
1540
1544
((0.29 , 0.35 ), (0.44 , 0.53 ), (0.57 , 0.64 ))),
1541
- ("pan" , MouseButton .LEFT ,
1542
- ((- 0.70 , - 0.58 ), (- 1.03 , - 0.91 ), (- 1.27 , - 1.15 )))])
1543
- def test_toolbar_zoom_pan (tool , button , expected ):
1545
+ ("pan" , MouseButton .LEFT , None ,
1546
+ ((- 0.70 , - 0.58 ), (- 1.03 , - 0.91 ), (- 1.27 , - 1.15 ))),
1547
+ ("pan" , MouseButton .LEFT , 'x' ,
1548
+ ((- 0.96 , - 0.84 ), (- 0.58 , - 0.46 ), (- 0.06 , 0.06 ))),
1549
+ ("pan" , MouseButton .LEFT , 'y' ,
1550
+ ((0.20 , 0.32 ), (- 0.51 , - 0.39 ), (- 1.27 , - 1.15 )))])
1551
+ def test_toolbar_zoom_pan (tool , button , key , expected ):
1544
1552
# NOTE: The expected zoom values are rough ballparks of moving in the view
1545
1553
# to make sure we are getting the right direction of motion.
1546
1554
# The specific values can and should change if the zoom movement
@@ -1561,9 +1569,9 @@ def test_toolbar_zoom_pan(tool, button, expected):
1561
1569
1562
1570
# Set up the mouse movements
1563
1571
start_event = MouseEvent (
1564
- "button_press_event" , fig .canvas , * s0 , button )
1572
+ "button_press_event" , fig .canvas , * s0 , button , key = key )
1565
1573
stop_event = MouseEvent (
1566
- "button_release_event" , fig .canvas , * s1 , button )
1574
+ "button_release_event" , fig .canvas , * s1 , button , key = key )
1567
1575
1568
1576
tb = NavigationToolbar2 (fig .canvas )
1569
1577
if tool == "zoom" :
0 commit comments