(ax, drag_from_anywhere, new_center)
| 133 | [[True, (60, 75)], |
| 134 | [False, (30, 20)]]) |
| 135 | def 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 | |
| 156 | def test_rectangle_selector_set_props_handle_props(ax): |
nothing calls this directly
no test coverage detected
searching dependent graphs…