@@ -1232,46 +1232,6 @@ def onselect(vertices):
1232
1232
assert artist .get_alpha () == 0.3
1233
1233
1234
1234
1235
- @pytest .mark .parametrize (
1236
- "horizOn, vertOn" ,
1237
- [(True , True ), (True , False ), (False , True )],
1238
- )
1239
- def test_MultiCursor (horizOn , vertOn ):
1240
- fig , (ax1 , ax2 , ax3 ) = plt .subplots (3 , sharex = True )
1241
-
1242
- # useblit=false to avoid having to draw the figure to cache the renderer
1243
- multi = widgets .MultiCursor (
1244
- fig .canvas , (ax1 , ax2 ), useblit = False , horizOn = horizOn , vertOn = vertOn
1245
- )
1246
-
1247
- # Only two of the axes should have a line drawn on them.
1248
- if vertOn :
1249
- assert len (multi .vlines ) == 2
1250
- if horizOn :
1251
- assert len (multi .hlines ) == 2
1252
-
1253
- # mock a motion_notify_event
1254
- # Can't use `do_event` as that helper requires the widget
1255
- # to have a single .ax attribute.
1256
- event = mock_event (ax1 , xdata = .5 , ydata = .25 )
1257
- multi .onmove (event )
1258
-
1259
- # the lines in the first two ax should both move
1260
- for l in multi .vlines :
1261
- assert l .get_xdata () == (.5 , .5 )
1262
- for l in multi .hlines :
1263
- assert l .get_ydata () == (.25 , .25 )
1264
-
1265
- # test a move event in an axes not part of the MultiCursor
1266
- # the lines in ax1 and ax2 should not have moved.
1267
- event = mock_event (ax3 , xdata = .75 , ydata = .75 )
1268
- multi .onmove (event )
1269
- for l in multi .vlines :
1270
- assert l .get_xdata () == (.5 , .5 )
1271
- for l in multi .hlines :
1272
- assert l .get_ydata () == (.25 , .25 )
1273
-
1274
-
1275
1235
@check_figures_equal ()
1276
1236
def test_rect_visibility (fig_test , fig_ref ):
1277
1237
# Check that requesting an invisible selector makes it invisible
@@ -1338,3 +1298,43 @@ def onselect(vertices):
1338
1298
# After removing two verts, only one remains, and the
1339
1299
# selector should be automatically resete
1340
1300
assert tool .verts == verts [0 :2 ]
1301
+
1302
+
1303
+ @pytest .mark .parametrize (
1304
+ "horizOn, vertOn" ,
1305
+ [(True , True ), (True , False ), (False , True )],
1306
+ )
1307
+ def test_MultiCursor (horizOn , vertOn ):
1308
+ fig , (ax1 , ax2 , ax3 ) = plt .subplots (3 , sharex = True )
1309
+
1310
+ # useblit=false to avoid having to draw the figure to cache the renderer
1311
+ multi = widgets .MultiCursor (
1312
+ fig .canvas , (ax1 , ax2 ), useblit = False , horizOn = horizOn , vertOn = vertOn
1313
+ )
1314
+
1315
+ # Only two of the axes should have a line drawn on them.
1316
+ if vertOn :
1317
+ assert len (multi .vlines ) == 2
1318
+ if horizOn :
1319
+ assert len (multi .hlines ) == 2
1320
+
1321
+ # mock a motion_notify_event
1322
+ # Can't use `do_event` as that helper requires the widget
1323
+ # to have a single .ax attribute.
1324
+ event = mock_event (ax1 , xdata = .5 , ydata = .25 )
1325
+ multi .onmove (event )
1326
+
1327
+ # the lines in the first two ax should both move
1328
+ for l in multi .vlines :
1329
+ assert l .get_xdata () == (.5 , .5 )
1330
+ for l in multi .hlines :
1331
+ assert l .get_ydata () == (.25 , .25 )
1332
+
1333
+ # test a move event in an axes not part of the MultiCursor
1334
+ # the lines in ax1 and ax2 should not have moved.
1335
+ event = mock_event (ax3 , xdata = .75 , ydata = .75 )
1336
+ multi .onmove (event )
1337
+ for l in multi .vlines :
1338
+ assert l .get_xdata () == (.5 , .5 )
1339
+ for l in multi .hlines :
1340
+ assert l .get_ydata () == (.25 , .25 )
0 commit comments