summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlineedit
diff options
context:
space:
mode:
authorPierre Rossi <pierre.rossi@nokia.com>2010-07-23 12:53:58 (GMT)
committerPierre Rossi <pierre.rossi@nokia.com>2010-07-23 13:41:28 (GMT)
commit24cdab32de2abd8669f281dd54c8da1124514915 (patch)
treea55d4dc2a0fd8a5570d11efb458cbf9a7a67f78c /tests/auto/qlineedit
parent3124d14be27766ddf3c86528c913165e09317111 (diff)
downloadQt-24cdab32de2abd8669f281dd54c8da1124514915.zip
Qt-24cdab32de2abd8669f281dd54c8da1124514915.tar.gz
Qt-24cdab32de2abd8669f281dd54c8da1124514915.tar.bz2
Fix QLineEdit's Highlight color when inactive.
This commit also updates QPalette's documentation regarding the current ColorGroup and operator==. Task-number: QTBUG-697 Reviewed-by: ogoffart
Diffstat (limited to 'tests/auto/qlineedit')
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index b34e559..e0747f8 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -66,7 +66,6 @@
#include <qspinbox.h>
#include <qdebug.h>
-
//TESTED_CLASS=
//TESTED_FILES=
@@ -275,6 +274,7 @@ private slots:
void taskQTBUG_7902_contextMenuCrash();
#endif
void taskQTBUG_7395_readOnlyShortcut();
+ void QTBUG697_paletteCurrentColorGroup();
#ifdef QT3_SUPPORT
void validateAndSet_data();
@@ -3714,5 +3714,21 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut()
QCOMPARE(spy.count(), 1);
}
+void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup()
+{
+ testWidget->setText(" ");
+ QPalette p = testWidget->palette();
+ p.setBrush(QPalette::Active, QPalette::Highlight, Qt::green);
+ p.setBrush(QPalette::Inactive, QPalette::Highlight, Qt::red);
+ testWidget->setPalette(p);
+ testWidget->selectAll();
+ QImage img(testWidget->rect().size(),QImage::Format_ARGB32 );
+ testWidget->render(&img);
+ QCOMPARE(img.pixel(10, testWidget->height()/2), QColor(Qt::green).rgb());
+ QApplication::setActiveWindow(0);
+ testWidget->render(&img);
+ QCOMPARE(img.pixel(10, testWidget->height()/2), QColor(Qt::red).rgb());
+}
+
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"