diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-07-23 17:04:42 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-07-23 17:04:42 (GMT) |
commit | 1b0bc13c14083d6146517ba1d8a63a6a503733b9 (patch) | |
tree | 4fad794544701b5ca5358a400a9d8459bb81cd53 /tests/auto/qlineedit | |
parent | 9d2760f619782145e0861300901531a56c12991a (diff) | |
download | Qt-1b0bc13c14083d6146517ba1d8a63a6a503733b9.zip Qt-1b0bc13c14083d6146517ba1d8a63a6a503733b9.tar.gz Qt-1b0bc13c14083d6146517ba1d8a63a6a503733b9.tar.bz2 |
Stabilize tst_qlineedit.cpp
Diffstat (limited to 'tests/auto/qlineedit')
-rw-r--r-- | tests/auto/qlineedit/tst_qlineedit.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index e0747f8..8951130 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -3716,18 +3716,26 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut() void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup() { - testWidget->setText(" "); - QPalette p = testWidget->palette(); + QLineEdit le; + le.setText(" "); + QPalette p = le.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()); + le.setPalette(p); + + le.show(); + QApplication::setActiveWindow(&le); + QTest::qWaitForWindowShown(&le); + le.setFocus(); + QTRY_VERIFY(le.hasFocus()); + le.selectAll(); + + QImage img(le.size(),QImage::Format_ARGB32 ); + le.render(&img); + QCOMPARE(img.pixel(10, le.height()/2), QColor(Qt::green).rgb()); QApplication::setActiveWindow(0); - testWidget->render(&img); - QCOMPARE(img.pixel(10, testWidget->height()/2), QColor(Qt::red).rgb()); + le.render(&img); + QCOMPARE(img.pixel(10, le.height()/2), QColor(Qt::red).rgb()); } QTEST_MAIN(tst_QLineEdit) |