@@ -170,35 +170,19 @@ def custom_handler(signum, frame):
170
170
[
171
171
("Key_A" , ["ShiftModifier" ], "A" ),
172
172
("Key_A" , [], "a" ),
173
- (
174
- "Key_A" ,
175
- ["ControlModifier" ],
176
- ("ctrl+a" if sys .platform != "darwin" else "cmd+a" ),
177
- ),
173
+ ("Key_A" , ["ControlModifier" ], ("ctrl+a" )),
178
174
(
179
175
"Key_Aacute" ,
180
176
["ShiftModifier" ],
181
- "\N{LATIN CAPITAL LETTER A WITH ACUTE} "
177
+ "\N{LATIN CAPITAL LETTER A WITH ACUTE} " ,
182
178
),
183
179
("Key_Aacute" , [], "\N{LATIN SMALL LETTER A WITH ACUTE} " ),
184
- (
185
- "Key_Control" ,
186
- ["AltModifier" ],
187
- ("alt+control" if sys .platform != "darwin" else "alt+cmd" ),
188
- ),
189
- (
190
- "Key_Alt" ,
191
- ["ControlModifier" ],
192
- "ctrl+alt" if sys .platform != "darwin" else "cmd+alt" ,
193
- ),
180
+ ("Key_Control" , ["AltModifier" ], ("alt+ctrl" )),
181
+ ("Key_Alt" , ["ControlModifier" ], "ctrl+alt" ),
194
182
(
195
183
"Key_Aacute" ,
196
184
["ControlModifier" , "AltModifier" , "MetaModifier" ],
197
- (
198
- "ctrl+alt+meta+\N{LATIN SMALL LETTER A WITH ACUTE} "
199
- if sys .platform != "darwin"
200
- else "cmd+alt+ctrl+\N{LATIN SMALL LETTER A WITH ACUTE} "
201
- ),
185
+ ("ctrl+alt+meta+\N{LATIN SMALL LETTER A WITH ACUTE} " ),
202
186
),
203
187
# We do not currently map the media keys, this may change in the
204
188
# future. This means the callback will never fire
@@ -207,7 +191,7 @@ def custom_handler(signum, frame):
207
191
(
208
192
"Key_Backspace" ,
209
193
["ControlModifier" ],
210
- "ctrl+backspace" if sys . platform != "darwin" else "cmd+backspace" ,
194
+ "ctrl+backspace" ,
211
195
),
212
196
],
213
197
ids = [
@@ -241,6 +225,10 @@ def test_correct_key(backend, qt_core, qt_key, qt_mods, answer):
241
225
Assert sent and caught keys are the same.
242
226
"""
243
227
from matplotlib .backends .qt_compat import _enum , _to_int
228
+
229
+ if sys .platform == "darwin" and answer is not None :
230
+ answer = answer .replace ("ctrl" , "cmd" )
231
+ answer = answer .replace ("meta" , "ctrl" )
244
232
result = None
245
233
qt_mod = _enum ("QtCore.Qt.KeyboardModifier" ).NoModifier
246
234
for mod in qt_mods :
0 commit comments