From 1b0bc13c14083d6146517ba1d8a63a6a503733b9 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 23 Jul 2010 19:04:42 +0200 Subject: Stabilize tst_qlineedit.cpp --- tests/auto/qlineedit/tst_qlineedit.cpp | 26 +++++++++++++++++--------- 1 file 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) -- cgit v0.12