Skip to content

Commit

Permalink
test for issue matplotlib#1683
Browse files Browse the repository at this point in the history
  • Loading branch information
tacaswell committed Jan 26, 2013
1 parent 3d3f8c3 commit 75a92df
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions 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)

0 comments on commit 75a92df

Please sign in to comment.