summaryrefslogtreecommitdiffstats
path: root/tests/auto/qstylesheetstyle
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-06-25 15:49:53 +0200
committerJason Barron <jbarron@trolltech.com>2009-06-25 15:49:53 +0200
commitdb8f05e257019694f5e8076845626008f2adc3dd (patch)
tree05d3959403cf15ac5f702091439e028af01f343b /tests/auto/qstylesheetstyle
parent8aafaa65a1d16f8b982279f5aceedf1e281ddb5a (diff)
parent796a5a2c7d8c91a46ac761dde18b7da2ec6c177b (diff)
Merge commit 'qt/master-stable' into 4.6-stable
Bring Qt 4.6 into the Qt-S60 repo. Conflicts: configure.exe mkspecs/features/qttest_p4.prf qmake/generators/makefile.cpp src/corelib/io/qdir.cpp src/corelib/io/qprocess.h src/corelib/kernel/qcoreevent.h src/corelib/kernel/qobject.cpp src/corelib/kernel/qsharedmemory_unix.cpp src/corelib/thread/qthread_p.h src/corelib/tools/qvector.h src/gui/dialogs/qdialog.cpp src/gui/dialogs/qfiledialog.cpp src/gui/dialogs/qfiledialog_p.h src/gui/dialogs/qmessagebox.cpp src/gui/graphicsview/qgraphicsitem.cpp src/gui/graphicsview/qgraphicsview.cpp src/gui/image/qpixmapcache.cpp src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication_p.h src/gui/kernel/qwidget.cpp src/gui/kernel/qwidget_p.h src/gui/painting/qdrawhelper.cpp src/gui/painting/qpaintengine_raster.cpp src/gui/text/qfontengine_qpf.cpp src/gui/widgets/qmenubar.cpp src/network/socket/qlocalserver.cpp src/testlib/qtestcase.cpp src/testlib/testlib.pro tests/auto/qimagereader/tst_qimagereader.cpp tests/auto/qitemdelegate/tst_qitemdelegate.cpp tests/auto/qnetworkreply/tst_qnetworkreply.cpp tests/auto/qpixmap/qpixmap.pro
Diffstat (limited to 'tests/auto/qstylesheetstyle')
-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 24ccecf8ad..1a4b639a36 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();
@@ -760,6 +761,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
@@ -809,6 +811,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
@@ -1378,8 +1430,6 @@ void tst_QStyleSheetStyle::task188195_baseBackground()
QVERIFY(!testForColors(image, QColor(0xab, 0x12, 0x51)));
}
-
-
QTEST_MAIN(tst_QStyleSheetStyle)
#include "tst_qstylesheetstyle.moc"