MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_draggable_in_subfigure

Function test_draggable_in_subfigure

lib/matplotlib/tests/test_offsetbox.py:455–472  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

453
454
455def test_draggable_in_subfigure():
456 fig = plt.figure()
457 # Put annotation at lower left corner to make it easily pickable below.
458 ann = fig.subfigures().add_axes((0, 0, 1, 1)).annotate("foo", (0, 0))
459 ann.draggable(True)
460 fig.canvas.draw() # Texts are non-pickable until the first draw.
461 MouseEvent("button_press_event", fig.canvas, 1, 1)._process()
462 assert ann._draggable.got_artist
463 # Stop dragging the annotation.
464 MouseEvent("button_release_event", fig.canvas, 1, 1)._process()
465 assert not ann._draggable.got_artist
466 # A scroll event should not initiate a drag.
467 MouseEvent("scroll_event", fig.canvas, 1, 1)._process()
468 assert not ann._draggable.got_artist
469 # An event outside the annotation should not initiate a drag.
470 bbox = ann.get_window_extent()
471 MouseEvent("button_press_event", fig.canvas, bbox.x1+2, bbox.y1+2)._process()
472 assert not ann._draggable.got_artist
473
474
475def test_anchored_offsetbox_tuple_and_float_borderpad():

Callers

nothing calls this directly

Calls 9

MouseEventClass · 0.90
figureMethod · 0.80
annotateMethod · 0.80
add_axesMethod · 0.80
subfiguresMethod · 0.80
draggableMethod · 0.80
_processMethod · 0.80
drawMethod · 0.45
get_window_extentMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…