diff options
Diffstat (limited to 'tests/auto/widgets/dialogs/qmessagebox')
-rw-r--r-- | tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro | 2 | ||||
-rw-r--r-- | tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp | 15 |
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); |