Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

test for issue #1683

  • Loading branch information...
commit 75a92df91a059f87fe3be956adef44765346c9e2 1 parent 3d3f8c3
@tacaswell authored
Showing with 17 additions and 2 deletions.
  1. +17 −2 lib/matplotlib/tests/test_backend_qt4.py
View
19 lib/matplotlib/tests/test_backend_qt4.py
@@ -1,10 +1,25 @@
from matplotlib import rcParams
from matplotlib import pyplot as plt
from matplotlib.testing.decorators import cleanup
+from matplotlib._pylab_helpers import Gcf
+import copy
+
@cleanup
def test_fig_close():
- rcParams['backend'] = 'qt4agg'
+ # force switch to the Qt4 backend
+ plt.switch_backend('Qt4Agg')
+
+ #save the state of Gcf.figs
+ init_figs = copy.copy(Gcf.figs)
+ # make a figure using pyplot interface
fig = plt.figure()
- fig.close()
+
+ # simulate user clicking the close button by reaching in
+ # and calling close on the underlying Qt object
+ fig.canvas.manager.window.close()
+
+ # assert that we have removed the reference to the FigureManager
+ # that got added by plt.figure()
+ assert(init_figs == Gcf.figs)
Please sign in to comment.
Something went wrong with that request. Please try again.