From be0d5daac3f9230c8446c27ef863291bb39a3991 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sun, 28 Nov 2021 13:49:21 +0000 Subject: [PATCH] Backport PR #21758: FIX: Make sure a renderer gets attached to figure after draw --- lib/matplotlib/backends/backend_macosx.py | 2 +- lib/matplotlib/tests/test_backend_macosx.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 lib/matplotlib/tests/test_backend_macosx.py diff --git a/lib/matplotlib/backends/backend_macosx.py b/lib/matplotlib/backends/backend_macosx.py index 25619104134f..4450d44b02c4 100644 --- a/lib/matplotlib/backends/backend_macosx.py +++ b/lib/matplotlib/backends/backend_macosx.py @@ -43,7 +43,7 @@ def _draw(self): def draw(self): # docstring inherited - self.draw_idle() + self._draw() self.flush_events() # draw_idle is provided by _macosx.FigureCanvas diff --git a/lib/matplotlib/tests/test_backend_macosx.py b/lib/matplotlib/tests/test_backend_macosx.py new file mode 100644 index 000000000000..df1066e54d84 --- /dev/null +++ b/lib/matplotlib/tests/test_backend_macosx.py @@ -0,0 +1,20 @@ +import pytest + +import matplotlib.pyplot as plt + + +pytest.importorskip("matplotlib.backends.backend_macosx", + reason="These are mac only tests") + + +@pytest.mark.backend('macosx') +def test_cached_renderer(): + # Make sure that figures have an associated renderer after + # a fig.canvas.draw() call + fig = plt.figure(1) + fig.canvas.draw() + assert fig._cachedRenderer is not None + + fig = plt.figure(2) + fig.draw_without_rendering() + assert fig._cachedRenderer is not None pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy