diff --git a/lib/matplotlib/tests/test_backend_qt.py b/lib/matplotlib/tests/test_backend_qt.py index 044e720c3e76..80a2cc7533a5 100644 --- a/lib/matplotlib/tests/test_backend_qt.py +++ b/lib/matplotlib/tests/test_backend_qt.py @@ -106,7 +106,9 @@ def CustomHandler(signum, frame): ('Key_Control', ['AltModifier'], 'alt+control'), ('Key_Alt', ['ControlModifier'], 'ctrl+alt'), ('Key_Aacute', ['ControlModifier', 'AltModifier', 'MetaModifier'], - 'ctrl+alt+super+\N{LATIN SMALL LETTER A WITH ACUTE}'), + 'ctrl+alt+meta+\N{LATIN SMALL LETTER A WITH ACUTE}'), + # We do not currently map the media keys, this may change in the + # future. This means the callback will never fire ('Key_Play', [], None), ('Key_Backspace', [], 'backspace'), ('Key_Backspace', ['ControlModifier'], 'ctrl+backspace'), @@ -142,6 +144,7 @@ def test_correct_key(backend, qt_core, qt_key, qt_mods, answer): Assert sent and caught keys are the same. """ from matplotlib.backends.qt_compat import _enum, _to_int + result = None qt_mod = _enum("QtCore.Qt.KeyboardModifier").NoModifier for mod in qt_mods: qt_mod |= getattr(_enum("QtCore.Qt.KeyboardModifier"), mod) @@ -152,11 +155,13 @@ def key(self): return _to_int(getattr(_enum("QtCore.Qt.Key"), qt_key)) def modifiers(self): return qt_mod def on_key_press(event): - assert event.key == answer + nonlocal result + result = event.key qt_canvas = plt.figure().canvas qt_canvas.mpl_connect('key_press_event', on_key_press) qt_canvas.keyPressEvent(_Event()) + assert result == answer @pytest.mark.backend('QtAgg', skip_on_importerror=True) 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