Make the test a bit more sane.

Unactivating a window is not really supported, nor has it ever really
been, so activate another window instead. This incidentally
also makes the test work cross platform.

Change-Id: I6e593e9b7972dd5c5038c8d18a42be90bf19248c
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
bb10
Gunnar Sletta 2013-06-19 15:33:14 +02:00 committed by The Qt Project
parent 9f763d2fbe
commit a1f9b2b2b0
1 changed files with 6 additions and 3 deletions

View File

@ -3673,8 +3673,6 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut()
void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup()
{
if (m_keyboardScheme != QPlatformTheme::X11KeyboardScheme)
QSKIP("Only tested on X11");
QLineEdit le;
le.setText(" ");
QPalette p = le.palette();
@ -3692,7 +3690,12 @@ void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup()
QImage img(le.size(),QImage::Format_ARGB32 );
le.render(&img);
QCOMPARE(img.pixel(10, le.height()/2), QColor(Qt::green).rgb());
QApplication::setActiveWindow(0);
QWindow window;
window.resize(100, 50);
window.show();
window.requestActivate();
QVERIFY(QTest::qWaitForWindowActive(&window));
le.render(&img);
QCOMPARE(img.pixel(10, le.height()/2), QColor(Qt::red).rgb());
}