(ax, kwargs)
| 68 | dict(props=dict(fill=True)), |
| 69 | ]) |
| 70 | def test_rectangle_selector(ax, kwargs): |
| 71 | onselect = mock.Mock(spec=noop, return_value=None) |
| 72 | |
| 73 | tool = widgets.RectangleSelector(ax, onselect=onselect, **kwargs) |
| 74 | MouseEvent._from_ax_coords("button_press_event", ax, (100, 100), 1)._process() |
| 75 | MouseEvent._from_ax_coords("motion_notify_event", ax, (199, 199), 1)._process() |
| 76 | # purposely drag outside of axis for release |
| 77 | MouseEvent._from_ax_coords("button_release_event", ax, (250, 250), 1)._process() |
| 78 | |
| 79 | if kwargs.get('drawtype', None) not in ['line', 'none']: |
| 80 | assert_allclose(tool.geometry, |
| 81 | [[100., 100, 199, 199, 100], |
| 82 | [100, 199, 199, 100, 100]], |
| 83 | err_msg=tool.geometry) |
| 84 | |
| 85 | onselect.assert_called_once() |
| 86 | (epress, erelease), kwargs = onselect.call_args |
| 87 | assert epress.xdata == 100 |
| 88 | assert epress.ydata == 100 |
| 89 | assert erelease.xdata == 199 |
| 90 | assert erelease.ydata == 199 |
| 91 | assert kwargs == {} |
| 92 | |
| 93 | |
| 94 | @pytest.mark.parametrize('spancoords', ['data', 'pixels']) |
nothing calls this directly
no test coverage detected
searching dependent graphs…