summaryrefslogtreecommitdiffstats
path: root/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp')
-rw-r--r--tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp54
1 files changed, 52 insertions, 2 deletions
diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
index aa63753..33f85d5 100644
--- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -81,6 +81,7 @@ private slots:
void onWidgetDestroyed();
void fontPrecedence();
void focusColors();
+ void hoverColors();
void background();
void tabAlignement();
void attributesList();
@@ -759,6 +760,7 @@ void tst_QStyleSheetStyle::focusColors()
combobox->setEditable(true);
combobox->addItems(QStringList() << "TESTING");
widgets << combobox;
+ widgets << new QLabel("TESTING");
#ifdef Q_WS_QWS
// QWS has its own special focus logic which is slightly different
@@ -808,6 +810,56 @@ void tst_QStyleSheetStyle::focusColors()
// }
}
+
+void tst_QStyleSheetStyle::hoverColors()
+{
+ QList<QWidget *> widgets;
+ widgets << new QPushButton("TESTING");
+ widgets << new QLineEdit("TESTING");
+ widgets << new QLabel("TESTING");
+ QSpinBox *spinbox = new QSpinBox;
+ spinbox->setValue(8888);
+ widgets << spinbox;
+ QComboBox *combobox = new QComboBox;
+ combobox->setEditable(true);
+ combobox->addItems(QStringList() << "TESTING");
+ widgets << combobox;
+ widgets << new QLabel("<b>TESTING</b>");
+
+ foreach (QWidget *widget, widgets) {
+ QDialog frame;
+ QLayout* layout = new QGridLayout;
+
+ QLineEdit* dummy = new QLineEdit;
+
+ widget->setStyleSheet("*:hover { border:none; background: #e8ff66; color: #ff0084 }");
+
+ layout->addWidget(dummy);
+ layout->addWidget(widget);
+ frame.setLayout(layout);
+
+ frame.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&frame);
+#endif
+ QApplication::setActiveWindow(&frame);
+ QTest::qWait(60);
+ QTest::mouseMove ( widget, QPoint(5,5));
+ QTest::qWait(60);
+
+ QImage image(frame.width(), frame.height(), QImage::Format_ARGB32);
+ frame.render(&image);
+
+ QVERIFY2(testForColors(image, QColor(0xe8, 0xff, 0x66)),
+ (QString::fromLatin1(widget->metaObject()->className())
+ + " did not contain background color #e8ff66").toLocal8Bit().constData());
+ QVERIFY2(testForColors(image, QColor(0xff, 0x00, 0x84)),
+ (QString::fromLatin1(widget->metaObject()->className())
+ + " did not contain text color #ff0084").toLocal8Bit().constData());
+ }
+
+}
+
class SingleInheritanceDialog : public QDialog
{
Q_OBJECT
@@ -1377,8 +1429,6 @@ void tst_QStyleSheetStyle::task188195_baseBackground()
QVERIFY(!testForColors(image, QColor(0xab, 0x12, 0x51)));
}
-
-
QTEST_MAIN(tst_QStyleSheetStyle)
#include "tst_qstylesheetstyle.moc"