diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp index 6b74cca53f6..8258f3c2e64 100644 --- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp @@ -64,6 +64,10 @@ static QChar macSymbolForQtKey(int key) #endif +QT_BEGIN_NAMESPACE +extern void qt_set_sequence_auto_mnemonic(bool); +QT_END_NAMESPACE + class tst_QKeySequence : public QObject { Q_OBJECT @@ -367,9 +371,6 @@ void tst_QKeySequence::keyBindings() void tst_QKeySequence::mnemonic_data() { -#ifdef Q_OS_MAC - QSKIP("Test not applicable to OS X"); -#endif QTest::addColumn("string"); QTest::addColumn("key"); QTest::addColumn("warning"); @@ -389,11 +390,21 @@ void tst_QKeySequence::mnemonic_data() void tst_QKeySequence::mnemonic() { + const auto resetAutoMnemonic = qScopeGuard([] { #ifndef Q_OS_MAC + qt_set_sequence_auto_mnemonic(true); +#else + qt_set_sequence_auto_mnemonic(false); +#endif + }); + QFETCH(QString, string); QFETCH(QString, key); QFETCH(bool, warning); + qt_set_sequence_auto_mnemonic(false); + QCOMPARE(QKeySequence::mnemonic(string), QKeySequence()); + #ifdef QT_NO_DEBUG Q_UNUSED(warning); #else @@ -403,11 +414,9 @@ void tst_QKeySequence::mnemonic() // qWarning(qPrintable(str)); } #endif - QKeySequence seq = QKeySequence::mnemonic(string); - QKeySequence res = QKeySequence(key); - QCOMPARE(seq, res); -#endif + qt_set_sequence_auto_mnemonic(true); + QCOMPARE(QKeySequence::mnemonic(string), QKeySequence(key)); } void tst_QKeySequence::toString_data()