diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-05-06 17:16:38 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-08 09:36:21 +0200 |
commit | 7a2547164d207119468abbfa4c0eb594948bb608 (patch) | |
tree | 5124632c498a0eeb907b4644b9f652468039e116 /tests/auto/widgets | |
parent | ca17c0629483842d25e9c7347882bf822d1c7423 (diff) |
Fix tst_QStyleSheetStyle::toolTip().
Use the correct palette and enforce Fusion style to prevent
the Vista style from clobbering the tooltip palette in polish().
Task-number: QTBUG-38183
Change-Id: Id19d548f818d801c4914a343e08207195c343888
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r-- | tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 86e3c51d5a..14d59d3630 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -1351,10 +1351,26 @@ void tst_QStyleSheetStyle::emptyStyleSheet() QCOMPARE(img1,img2); } +class ApplicationStyleSetter +{ +public: + explicit inline ApplicationStyleSetter(QStyle *s) : m_oldStyleName(QApplication::style()->objectName()) + { QApplication::setStyle(s); } + inline ~ApplicationStyleSetter() + { QApplication::setStyle(QStyleFactory::create(m_oldStyleName)); } + +private: + const QString m_oldStyleName; +}; + void tst_QStyleSheetStyle::toolTip() { qApp->setStyleSheet(QString()); QWidget w; + // Use "Fusion" to prevent the Vista style from clobbering the tooltip palette in polish(). + QStyle *fusionStyle = QStyleFactory::create(QLatin1String("Fusion")); + QVERIFY(fusionStyle); + ApplicationStyleSetter as(fusionStyle); QHBoxLayout layout(&w); w.setLayout(&layout); @@ -1387,7 +1403,7 @@ void tst_QStyleSheetStyle::toolTip() qApp->setActiveWindow(&w); QVERIFY(QTest::qWaitForWindowActive(&w)); - QColor normalToolTip = qApp->palette().toolTipBase().color(); + const QColor normalToolTip = QToolTip::palette().color(QPalette::Inactive, QPalette::ToolTipBase); QList<QWidget *> widgets; QList<QColor> colors; |