diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2012-02-29 09:18:59 +1000 |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2012-02-29 09:23:14 +1000 |
commit | 98dd1781d9256f68025d2a2db408f4f5947f3214 (patch) | |
tree | dbe1424abd90014edb5546c920ca585ed62b46e3 /tests/auto/widgets/kernel/qaction/tst_qaction.cpp | |
parent | 6c1bdc1854a7700c2b3a345b95f6a2fdca84037d (diff) | |
parent | fa1b9070af66edb81b2a3735c1951f78b22bd666 (diff) |
Merge master -> api_changes
Includes fixes for tst_qfiledialog2, tst_qtextedit autotests on mac.
Change-Id: I49cac26894d31291a8339ccc1eb80b6a940f0827
Diffstat (limited to 'tests/auto/widgets/kernel/qaction/tst_qaction.cpp')
-rw-r--r-- | tests/auto/widgets/kernel/qaction/tst_qaction.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp index 47aad21074..51123af953 100644 --- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp +++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp @@ -46,6 +46,8 @@ #include <qevent.h> #include <qaction.h> #include <qmenu.h> +#include <qplatformtheme_qpa.h> +#include <private/qguiapplication_p.h> class tst_QAction : public QObject { @@ -77,6 +79,7 @@ private slots: private: int m_lastEventType; + int m_keyboardScheme; QAction *m_lastAction; QWidget *m_tstWidget; }; @@ -121,8 +124,10 @@ private: tst_QAction *tst; }; -tst_QAction::tst_QAction() +tst_QAction::tst_QAction() : m_keyboardScheme(QPlatformTheme::WindowsKeyboardScheme) { + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) + m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt(); } tst_QAction::~tst_QAction() @@ -237,13 +242,21 @@ void tst_QAction::setStandardKeys() QVERIFY(act.shortcut() == act.shortcuts().first()); QList<QKeySequence> expected; -#if defined(Q_OS_MAC) - expected << QKeySequence("CTRL+C"); -#else - expected << QKeySequence("CTRL+C") << QKeySequence("CTRL+INSERT"); -#endif -// Qt/Embedded on Windows: expected << QKeySequence("CTRL+C") << QKeySequence("F16") << QKeySequence("CTRL+INSERT"); - QVERIFY(act.shortcuts() == expected); + const QKeySequence ctrlC = QKeySequence(QStringLiteral("CTRL+C")); + const QKeySequence ctrlInsert = QKeySequence(QStringLiteral("CTRL+INSERT")); + switch (m_keyboardScheme) { + case QPlatformTheme::MacKeyboardScheme: + expected << ctrlC; + break; + case QPlatformTheme::WindowsKeyboardScheme: + expected << ctrlC << ctrlInsert; + break; + default: // X11 + expected << ctrlC << QKeySequence(QStringLiteral("F16")) << ctrlInsert; + break; + } + + QCOMPARE(act.shortcuts(), expected); } |