summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs/qmessagebox
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-02-21 15:36:01 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-22 17:28:51 +0100
commit541949aed23ea14a71a7d4391bac244b623add0a (patch)
treef123b0cfb7d4c42f7b83a378ae670c8b51003057 /tests/auto/widgets/dialogs/qmessagebox
parent53bb87d1d274a80b94595f6cd31bfa7a8ae81dc3 (diff)
Add further theme hints to QPlatformTheme.
- Add hints for QDialog/QDialogButtonBox. - Add hint for available popup-menu area. - Add keyboard scheme hint replacing QGuiApplicationPrivate::currentKeyPlatform() Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com> Task-number: QTBUG-24204 Task-number: QTBUG-24315 Change-Id: I6653786b0dcb49a6fc264d3b9891dbfee502bd3e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests/auto/widgets/dialogs/qmessagebox')
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro2
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp15
2 files changed, 8 insertions, 9 deletions
diff --git a/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro b/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro
index f25ed650c3..5b8f796485 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro
+++ b/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
TEMPLATE = app
TARGET = tst_qmessagebox
-QT += widgets testlib
+QT += gui-private core-private widgets testlib
DEPENDPATH += .
INCLUDEPATH += .
diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
index 7fc752488d..1d391a1c09 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
@@ -48,6 +48,8 @@
#include <QApplication>
#include <QPushButton>
#include <QDialogButtonBox>
+#include <QPlatformTheme>
+#include <private/qguiapplication_p.h>
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
#include <QMacStyle>
#endif
@@ -407,15 +409,12 @@ void tst_QMessageBox::staticSourceCompat()
sendKeySoon();
ret = QMessageBox::information(0, "title", "text", QMessageBox::Yes, QMessageBox::No);
int expectedButton = int(QMessageBox::Yes);
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
- if (qobject_cast<QMacStyle *>(qApp->style()))
- expectedButton = int(QMessageBox::No);
-#elif !defined(QT_NO_STYLE_CLEANLOOKS)
- if (qobject_cast<QCleanlooksStyle *>(qApp->style())) {
- QEXPECT_FAIL("", "Special handling of QMessageBox::information buttons for Cleanlooks not implemented yet, QTBUG-24315", Continue);
- expectedButton = int(QMessageBox::No);
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
+ const int dialogButtonBoxLayout = theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt();
+ if (dialogButtonBoxLayout == QDialogButtonBox::MacLayout
+ || dialogButtonBoxLayout == QDialogButtonBox::GnomeLayout)
+ expectedButton = int(QMessageBox::No);
}
-#endif
QCOMPARE(ret, expectedButton);
QCOMPARE(keyToSend, -1);