summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-05-06 15:16:38 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-09 07:25:27 (GMT)
commitebaf32ff5b28c3d7cd0c29e3a4a47063ef45d617 (patch)
tree5e066bd7a816c74c178be0033acb457a57cb0c8e /tests
parent6d76e943dab0971d376cebb15fe531efc60622ac (diff)
downloadQt-ebaf32ff5b28c3d7cd0c29e3a4a47063ef45d617.zip
Qt-ebaf32ff5b28c3d7cd0c29e3a4a47063ef45d617.tar.gz
Qt-ebaf32ff5b28c3d7cd0c29e3a4a47063ef45d617.tar.bz2
Fix tst_QStyleSheetStyle::toolTip().
Use the correct palette and enforce plain Windows 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> (cherry picked from qtbase/7a2547164d207119468abbfa4c0eb594948bb608)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 49ab282..f0df24e 100644
--- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -1334,10 +1334,28 @@ 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;
+#ifdef Q_OS_WIN32
+ // Ensure plain "Windows" style to prevent the Vista style from clobbering the tooltip palette in polish().
+ QStyle *windowsStyle = QStyleFactory::create(QLatin1String("windows"));
+ QVERIFY(windowsStyle);
+ ApplicationStyleSetter as(windowsStyle);
+#endif // Q_OS_WIN32
QHBoxLayout layout(&w);
w.setLayout(&layout);
@@ -1368,7 +1386,7 @@ void tst_QStyleSheetStyle::toolTip()
w.show();
QTest::qWait(100);
- QColor normalToolTip = qApp->palette().toolTipBase().color();
+ const QColor normalToolTip = QToolTip::palette().color(QPalette::Inactive, QPalette::ToolTipBase);
QList<QWidget *> widgets;
QList<QColor> colors;