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

Function test_rectangle_drag

lib/matplotlib/tests/test_widgets.py:135–153  ·  view source on GitHub ↗
(ax, drag_from_anywhere, new_center)

Source from the content-addressed store, hash-verified

133 [[True, (60, 75)],
134 [False, (30, 20)]])
135def test_rectangle_drag(ax, drag_from_anywhere, new_center):
136 tool = widgets.RectangleSelector(ax, interactive=True,
137 drag_from_anywhere=drag_from_anywhere)
138 # Create rectangle
139 click_and_drag(tool, start=(10, 10), end=(90, 120))
140 assert tool.center == (50, 65)
141 # Drag inside rectangle, but away from centre handle
142 #
143 # If drag_from_anywhere == True, this will move the rectangle by (10, 10),
144 # giving it a new center of (60, 75)
145 #
146 # If drag_from_anywhere == False, this will create a new rectangle with
147 # center (30, 20)
148 click_and_drag(tool, start=(25, 15), end=(35, 25))
149 assert tool.center == new_center
150 # Check that in both cases, dragging outside the rectangle draws a new
151 # rectangle
152 click_and_drag(tool, start=(175, 185), end=(185, 195))
153 assert tool.center == (180, 190)
154
155
156def test_rectangle_selector_set_props_handle_props(ax):

Callers

nothing calls this directly

Calls 1

click_and_dragFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…