Skip to content

Commit 1d7bbf9

Browse files
committed
Explicitly test set figure width/height
1 parent 5cd30d2 commit 1d7bbf9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/matplotlib/tests/test_backend_qt.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import matplotlib
66
from matplotlib import pyplot as plt
7+
from matplotlib import rcParams
78
from matplotlib._pylab_helpers import Gcf
89

910
import pytest
@@ -281,10 +282,14 @@ def test_double_resize():
281282
fig.canvas.draw()
282283
window = fig.canvas.manager.window
283284

284-
fig.set_size_inches(2, 2)
285+
w, h = 3, 2
286+
fig.set_size_inches(w, h)
287+
assert fig.canvas.width() == w * rcParams['figure.dpi']
288+
assert fig.canvas.height() == h * rcParams['figure.dpi']
289+
285290
old_width = window.width()
286291
old_height = window.height()
287292

288-
fig.set_size_inches(2, 2)
293+
fig.set_size_inches(w, h)
289294
assert window.width() == old_width
290295
assert window.height() == old_height

0 commit comments

Comments
 (0)