Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d2d2ce1

Browse files
committed
Use multiple start/end corners for rectangle resize test
1 parent ab8b1d7 commit d2d2ce1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/matplotlib/tests/test_widgets.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,16 @@ def test_rectangle_selector_set_props_handle_props(ax):
155155
assert artist.get_alpha() == 0.3
156156

157157

158-
def test_rectangle_resize(ax):
158+
# Should give same results if rectangle is created from any two
159+
# opposite corners
160+
@pytest.mark.parametrize('start, end', [[(0, 10), (100, 120)],
161+
[(100, 120), (0, 10)],
162+
[(0, 120), (100, 10)],
163+
[(100, 10), (0, 120)]])
164+
def test_rectangle_resize(ax, start, end):
159165
tool = widgets.RectangleSelector(ax, onselect=noop, interactive=True)
160166
# Create rectangle
161-
click_and_drag(tool, start=(0, 10), end=(100, 120))
167+
click_and_drag(tool, start=start, end=end)
162168
assert_allclose(tool.extents, (0.0, 100.0, 10.0, 120.0))
163169

164170
# resize NE handle

0 commit comments

Comments
 (0)