From 437b4f6d44beeb48679da86a0a8eb825ba86c7db Mon Sep 17 00:00:00 2001
From: Olivier Goffart <ogoffart@trolltech.com>
Date: Thu, 3 Sep 2009 20:21:08 +0200
Subject: QStyleSheetStyle test: test that the widget loose their style when
 they are not hovered

---
 .../auto/qstylesheetstyle/tst_qstylesheetstyle.cpp | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 4c8f689..55b6e96 100644
--- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -845,6 +845,7 @@ void tst_QStyleSheetStyle::hoverColors()
 #endif
         QApplication::setActiveWindow(&frame);
         QTest::qWait(60);
+        //move the mouse inside the widget, it should be colored
         QTest::mouseMove ( widget, QPoint(5,5));
         QTest::qWait(60);
 
@@ -857,6 +858,32 @@ void tst_QStyleSheetStyle::hoverColors()
         QVERIFY2(testForColors(image, QColor(0xff, 0x00, 0x84)),
                  (QString::fromLatin1(widget->metaObject()->className())
                   + " did not contain text color #ff0084").toLocal8Bit().constData());
+
+        //move the mouse outside the widget, it should NOT be colored
+        QTest::mouseMove ( dummy, QPoint(5,5));
+        QTest::qWait(60);
+
+        frame.render(&image);
+
+        QVERIFY2(!testForColors(image, QColor(0xe8, 0xff, 0x66)),
+                  (QString::fromLatin1(widget->metaObject()->className())
+                  + " did contain background color #e8ff66").toLocal8Bit().constData());
+        QVERIFY2(!testForColors(image, QColor(0xff, 0x00, 0x84)),
+                 (QString::fromLatin1(widget->metaObject()->className())
+                  + " did contain text color #ff0084").toLocal8Bit().constData());
+
+        //move the mouse again inside the widget, it should be colored
+        QTest::mouseMove (widget, QPoint(5,5));
+        QTest::qWait(60);
+
+        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());
     }
 
 }
-- 
cgit v0.12