|
3 | 3 | importoperator
|
4 | 4 | fromunittestimportmock
|
5 | 5 |
|
6 |
| -frommatplotlib.backend_basesimportMouseEvent |
| 6 | +frommatplotlib.backend_basesimportMouseEvent,DrawEvent |
7 | 7 | importmatplotlib.colorsasmcolors
|
8 | 8 | importmatplotlib.widgetsaswidgets
|
9 | 9 | importmatplotlib.pyplotasplt
|
@@ -1757,3 +1757,26 @@ def test_MultiCursor(horizOn, vertOn):
|
1757 | 1757 | assertl.get_xdata()== (.5,.5)
|
1758 | 1758 | forlinmulti.hlines:
|
1759 | 1759 | assertl.get_ydata()== (.25,.25)
|
| 1760 | + |
| 1761 | + |
| 1762 | +deftest_parent_axes_removal(): |
| 1763 | + |
| 1764 | +fig, (ax_radio,ax_checks)=plt.subplots(1,2) |
| 1765 | + |
| 1766 | +radio=widgets.RadioButtons(ax_radio, ['1','2'],0) |
| 1767 | +checks=widgets.CheckButtons(ax_checks, ['1','2'], [True,False]) |
| 1768 | + |
| 1769 | +ax_checks.remove() |
| 1770 | +ax_radio.remove() |
| 1771 | +withio.BytesIO()asout: |
| 1772 | +# verify that saving does not raise |
| 1773 | +fig.savefig(out,format='raw') |
| 1774 | + |
| 1775 | +# verify that this method which is triggered by a draw_event callback when |
| 1776 | +# blitting is enabled does not raise. Calling private methods is simpler |
| 1777 | +# than trying to force blitting to be enabled with Agg or use a GUI |
| 1778 | +# framework. |
| 1779 | +renderer=fig._get_renderer() |
| 1780 | +evt=DrawEvent('draw_event',fig.canvas,renderer) |
| 1781 | +radio._clear(evt) |
| 1782 | +checks._clear(evt) |