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

Function test_polygon_selector_redraw

lib/matplotlib/tests/test_widgets.py:1634–1653  ·  view source on GitHub ↗
(ax, draw_bounding_box)

Source from the content-addressed store, hash-verified

1632
1633@pytest.mark.parametrize('draw_bounding_box', [False, True])
1634def test_polygon_selector_redraw(ax, draw_bounding_box):
1635 verts = [(50, 50), (150, 50), (50, 150)]
1636 event_sequence = [
1637 *polygon_place_vertex(ax, verts[0]),
1638 *polygon_place_vertex(ax, verts[1]),
1639 *polygon_place_vertex(ax, verts[2]),
1640 *polygon_place_vertex(ax, verts[0]),
1641 # Polygon completed, now remove first two verts.
1642 *polygon_remove_vertex(ax, verts[1]),
1643 *polygon_remove_vertex(ax, verts[2]),
1644 # At this point the tool should be reset so we can add more vertices.
1645 *polygon_place_vertex(ax, verts[1]),
1646 ]
1647
1648 tool = widgets.PolygonSelector(ax, draw_bounding_box=draw_bounding_box)
1649 for event in event_sequence:
1650 event._process()
1651 # After removing two verts, only one remains, and the
1652 # selector should be automatically reset
1653 assert tool.verts == verts[0:2]
1654
1655
1656@pytest.mark.parametrize('draw_bounding_box', [False, True])

Callers

nothing calls this directly

Calls 3

polygon_place_vertexFunction · 0.85
polygon_remove_vertexFunction · 0.85
_processMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…