@@ -1717,6 +1717,44 @@ def test_polygon_selector_box(ax):
17171717 tool ._box .extents , (20.0 , 40.0 , 30.0 , 40.0 ))
17181718
17191719
1720+ def test_polygon_selector_box_props_handle_props (ax ):
1721+ props = dict (color = 'r' )
1722+ handle_props = dict (marker = 'o' , markerfacecolor = 'w' , markeredgecolor = 'r' )
1723+ box_props = dict (linestyle = ':' , facecolor = 'c' , edgecolor = 'b' )
1724+ box_handle_props = dict (markeredgecolor = 'y' )
1725+
1726+ tool = widgets .PolygonSelector (
1727+ ax , draw_bounding_box = True ,
1728+ props = props , handle_props = handle_props ,
1729+ box_props = box_props , box_handle_props = box_handle_props )
1730+
1731+ for event in [
1732+ * polygon_place_vertex (ax , (50 , 50 )),
1733+ * polygon_place_vertex (ax , (150 , 50 )),
1734+ * polygon_place_vertex (ax , (50 , 150 )),
1735+ * polygon_place_vertex (ax , (50 , 50 )),
1736+ ]:
1737+ event ._process ()
1738+
1739+ artist = tool ._selection_artist
1740+ assert artist .get_color () == 'r'
1741+ for artist in tool ._handles_artists :
1742+ assert artist .get_marker () == 'o'
1743+ assert artist .get_markerfacecolor () == 'w'
1744+ assert artist .get_markeredgecolor () == 'r'
1745+
1746+ box_artist = tool ._box ._selection_artist
1747+ assert box_artist .get_linestyle () == ':'
1748+ assert box_artist .get_facecolor () == mcolors .to_rgba ('c' )
1749+ assert box_artist .get_edgecolor () == mcolors .to_rgba ('b' )
1750+ for artist in tool ._box ._handles_artists :
1751+ # marker and markerfacecolor are inherited from handle_props
1752+ # markeredgecolor is overridden by box_handle_props.
1753+ assert artist .get_marker () == 'o'
1754+ assert artist .get_markerfacecolor () == 'w'
1755+ assert artist .get_markeredgecolor () == 'y'
1756+
1757+
17201758def test_polygon_selector_clear_method (ax ):
17211759 onselect = mock .Mock (spec = noop , return_value = None )
17221760 tool = widgets .PolygonSelector (ax , onselect )
0 commit comments