(direction)
| 867 | |
| 868 | @pytest.mark.parametrize('direction', ("horizontal", "vertical")) |
| 869 | def test_span_selector_bound(direction): |
| 870 | fig, ax = plt.subplots(1, 1) |
| 871 | ax.plot([10, 20], [10, 30]) |
| 872 | fig.canvas.draw() |
| 873 | x_bound = ax.get_xbound() |
| 874 | y_bound = ax.get_ybound() |
| 875 | |
| 876 | tool = widgets.SpanSelector(ax, print, direction, interactive=True) |
| 877 | assert ax.get_xbound() == x_bound |
| 878 | assert ax.get_ybound() == y_bound |
| 879 | |
| 880 | bound = x_bound if direction == 'horizontal' else y_bound |
| 881 | assert tool._edge_handles.positions == list(bound) |
| 882 | |
| 883 | press_data = (10.5, 11.5) |
| 884 | move_data = (11, 13) # Updating selector is done in onmove |
| 885 | release_data = move_data |
| 886 | click_and_drag(tool, start=press_data, end=move_data) |
| 887 | |
| 888 | assert ax.get_xbound() == x_bound |
| 889 | assert ax.get_ybound() == y_bound |
| 890 | |
| 891 | index = 0 if direction == 'horizontal' else 1 |
| 892 | handle_positions = [press_data[index], release_data[index]] |
| 893 | assert tool._edge_handles.positions == handle_positions |
| 894 | |
| 895 | |
| 896 | @pytest.mark.backend('QtAgg', skip_on_importerror=True) |
nothing calls this directly
no test coverage detected
searching dependent graphs…