diff options
Diffstat (limited to 'tests/auto/qstylesheetstyle')
-rw-r--r-- | tests/auto/qstylesheetstyle/qstylesheetstyle.pro | 13 | ||||
-rw-r--r-- | tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp | 59 |
2 files changed, 57 insertions, 15 deletions
diff --git a/tests/auto/qstylesheetstyle/qstylesheetstyle.pro b/tests/auto/qstylesheetstyle/qstylesheetstyle.pro index 6acb0b4..eada969 100644 --- a/tests/auto/qstylesheetstyle/qstylesheetstyle.pro +++ b/tests/auto/qstylesheetstyle/qstylesheetstyle.pro @@ -1,15 +1,6 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Wed Apr 26 13:53:24 2006 -###################################################################### - -TEMPLATE = app -TARGET = tst_qstylesheetstyle -DEPENDPATH += . -INCLUDEPATH += . .. - -CONFIG += console qtestlib -contains(QT_CONFIG, qt3support): QT += qt3support +load(qttest_p4) # Input SOURCES += tst_qstylesheetstyle.cpp RESOURCES += resources.qrc +requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index d55206d..4c8f689 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 @@ -1158,6 +1210,7 @@ void tst_QStyleSheetStyle::proxyStyle() QTest::qWait(100); delete w; delete proxy; + delete newProxy; } void tst_QStyleSheetStyle::dialogButtonBox() @@ -1348,7 +1401,7 @@ void tst_QStyleSheetStyle::opaquePaintEvent() QWidget tl; QWidget cl(&tl); cl.setAttribute(Qt::WA_OpaquePaintEvent, true); - cl.setAutoFillBackground(true); + cl.setAutoFillBackground(true); cl.setStyleSheet(stylesheet); cl.ensurePolished(); QCOMPARE(cl.testAttribute(Qt::WA_OpaquePaintEvent), !transparent); @@ -1363,7 +1416,7 @@ void tst_QStyleSheetStyle::task188195_baseBackground() tree.show(); QTest::qWait(20); QImage image(tree.width(), tree.height(), QImage::Format_ARGB32); - + tree.render(&image); QVERIFY(testForColors(image, tree.palette().base().color())); QVERIFY(!testForColors(image, QColor(0xab, 0x12, 0x51))); @@ -1378,8 +1431,6 @@ void tst_QStyleSheetStyle::task188195_baseBackground() QVERIFY(!testForColors(image, QColor(0xab, 0x12, 0x51))); } - - QTEST_MAIN(tst_QStyleSheetStyle) #include "tst_qstylesheetstyle.moc" |