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

Function test_ellipse

lib/matplotlib/tests/test_widgets.py:531–555  ·  view source on GitHub ↗

For ellipse, test out the key modifiers

(ax)

Source from the content-addressed store, hash-verified

529
530
531def test_ellipse(ax):
532 """For ellipse, test out the key modifiers"""
533 tool = widgets.EllipseSelector(ax, grab_range=10, interactive=True)
534 tool.extents = (100, 150, 100, 150)
535
536 # drag the rectangle
537 click_and_drag(tool, start=(125, 125), end=(145, 145))
538 assert tool.extents == (120, 170, 120, 170)
539
540 # create from center
541 click_and_drag(tool, start=(100, 100), end=(125, 125), key='control')
542 assert tool.extents == (75, 125, 75, 125)
543
544 # create a square
545 click_and_drag(tool, start=(10, 10), end=(35, 30), key='shift')
546 extents = [int(e) for e in tool.extents]
547 assert extents == [10, 35, 10, 35]
548
549 # create a square from center
550 click_and_drag(tool, start=(100, 100), end=(125, 130), key='ctrl+shift')
551 extents = [int(e) for e in tool.extents]
552 assert extents == [70, 130, 70, 130]
553
554 assert tool.geometry.shape == (2, 73)
555 assert_allclose(tool.geometry[:, 0], [70., 100])
556
557
558def test_rectangle_handles(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…