diff options
author | Pierre Rossi <pierre.rossi@nokia.com> | 2010-07-23 12:53:58 (GMT) |
---|---|---|
committer | Toby Tomkins <toby.tomkins@nokia.com> | 2010-07-27 00:10:00 (GMT) |
commit | a38bfb1807cb36240e0102935b23fe1ac474d035 (patch) | |
tree | 4702674ab981e6976140938a80d0952634d46222 /tests | |
parent | 18a2e097f09ecd68e9ea2a2a515d9358729188c2 (diff) | |
download | Qt-a38bfb1807cb36240e0102935b23fe1ac474d035.zip Qt-a38bfb1807cb36240e0102935b23fe1ac474d035.tar.gz Qt-a38bfb1807cb36240e0102935b23fe1ac474d035.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
(cherry picked from commit 24cdab32de2abd8669f281dd54c8da1124514915)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qlineedit/tst_qlineedit.cpp | 18 |
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" |