Fix tst_QDoubleSpinBox::editingFinished failing after other tests
Wait for the spinbox to show become active in the previous test. Also use QWidget::activateWindow() instead of QApplication::setActiveWindow(). Use of the latter seemed to result in some confusion where QWidget::isActiveWindow() returned true but QWindow::isActive() on the underlying window returned false, leading qWaitForWindowActive() to fail. Also remove superfluous setting of focus. It was just set and verified. Change-Id: I023cdc2d272e23b2537b32606b7a3bf35bf671ac Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
c359df5ca6
commit
883d58dacd
@ -748,6 +748,7 @@ void tst_QDoubleSpinBox::setReadOnly()
|
||||
QDoubleSpinBox spin(0);
|
||||
spin.setValue(0.2);
|
||||
spin.show();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&spin));
|
||||
QCOMPARE(spin.value(), 0.2);
|
||||
QTest::keyClick(&spin, Qt::Key_Up);
|
||||
QCOMPARE(spin.value(), 1.2);
|
||||
@ -770,7 +771,7 @@ void tst_QDoubleSpinBox::editingFinished()
|
||||
layout->addWidget(box2);
|
||||
|
||||
testFocusWidget->show();
|
||||
QApplication::setActiveWindow(testFocusWidget);
|
||||
testFocusWidget->activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(testFocusWidget));
|
||||
box->setFocus();
|
||||
QTRY_VERIFY(box->hasFocus());
|
||||
@ -778,7 +779,6 @@ void tst_QDoubleSpinBox::editingFinished()
|
||||
QSignalSpy editingFinishedSpy1(box, SIGNAL(editingFinished()));
|
||||
QSignalSpy editingFinishedSpy2(box2, SIGNAL(editingFinished()));
|
||||
|
||||
box->setFocus();
|
||||
QTest::keyClick(box, Qt::Key_Up);
|
||||
QTest::keyClick(box, Qt::Key_Up);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user