From 541949aed23ea14a71a7d4391bac244b623add0a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 21 Feb 2012 15:36:01 +0100 Subject: Add further theme hints to QPlatformTheme. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add hints for QDialog/QDialogButtonBox. - Add hint for available popup-menu area. - Add keyboard scheme hint replacing QGuiApplicationPrivate::currentKeyPlatform() Reviewed-by: Samuel Rødal Reviewed-by: Morten Johan Sørvig Task-number: QTBUG-24204 Task-number: QTBUG-24315 Change-Id: I6653786b0dcb49a6fc264d3b9891dbfee502bd3e Reviewed-by: Friedemann Kleint --- tests/auto/widgets/kernel/qaction/tst_qaction.cpp | 29 ++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'tests/auto/widgets/kernel/qaction/tst_qaction.cpp') 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 #include #include +#include +#include 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 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); } -- cgit v1.2.3