summaryrefslogtreecommitdiff
path: root/tests/auto/qlineedit/tst_qlineedit.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-07-23 19:04:42 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2010-07-23 19:04:42 +0200
commit1b0bc13c14083d6146517ba1d8a63a6a503733b9 (patch)
tree4fad794544701b5ca5358a400a9d8459bb81cd53 /tests/auto/qlineedit/tst_qlineedit.cpp
parent9d2760f619782145e0861300901531a56c12991a (diff)
downloadqt4-tools-1b0bc13c14083d6146517ba1d8a63a6a503733b9.tar.gz
Stabilize tst_qlineedit.cpp
Diffstat (limited to 'tests/auto/qlineedit/tst_qlineedit.cpp')
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index e0747f8101..895113009b 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)