Fix flakiness in tst_QDoubleSpinBox / editingFinished
setFocus() was called on a double spinbox without calling show() first. That causes flakiness on XCB when checking focus afterwards. The test can still fail, when focus is acquired by e.g. a system popup. This patch adds a show() call before setFocus() to stabilize normal behavior. In case the double spin box is shown, but cannot acquire focus, the test is skipped. Fixes: QTBUG-70088 Change-Id: If02e88800a31b09a1da63dcc074eb8bb1b0df391 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This commit is contained in:
parent
2937cf91c7
commit
b1054d45e9
@ -857,8 +857,15 @@ void tst_QDoubleSpinBox::editingFinished()
|
||||
testFocusWidget.show();
|
||||
testFocusWidget.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&testFocusWidget));
|
||||
|
||||
box->show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(box));
|
||||
box->setFocus();
|
||||
QTRY_VERIFY(box->hasFocus());
|
||||
|
||||
// Box may fail to acquire focus due to a system popup
|
||||
// it is fair in that case to skip the test
|
||||
if (!QTest::qWaitForWindowActive(box))
|
||||
QSKIP("Focus acquisition failed.");
|
||||
|
||||
QSignalSpy editingFinishedSpy1(box, SIGNAL(editingFinished()));
|
||||
QSignalSpy editingFinishedSpy2(box2, SIGNAL(editingFinished()));
|
||||
|
Loading…
Reference in New Issue
Block a user