Skip to content

Commit

Permalink
MNT: Debug fig_size change after window close
Browse files Browse the repository at this point in the history
  • Loading branch information
timhoffm committed Nov 13, 2024
1 parent ca39d41 commit 3bfb0ab
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/matplotlib/tests/test_backends_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,12 @@ def check_alt_backend(alt_backend):
fig.canvas.mpl_connect("draw_event", lambda event: timer.start())
fig.canvas.mpl_connect("close_event", print)

plt.show()

size_inches = fig.get_size_inches()
result = io.BytesIO()
fig.savefig(result, format='png')

plt.show()

# Ensure that the window is really closed.
plt.pause(0.5)

Expand All @@ -229,6 +230,8 @@ def check_alt_backend(alt_backend):
result_after = io.BytesIO()
fig.savefig(result_after, format='png')

assert tuple(fig.get_size_inches()) == tuple(size_inches), \
f"{fig.get_size_inches()}, {size_inches}"
assert result.getvalue() == result_after.getvalue()


Expand Down

0 comments on commit 3bfb0ab

Please sign in to comment.