diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index 897608bca83..76b12d7aead 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp @@ -1636,6 +1636,7 @@ void tst_QCompleter::QTBUG_14292_filesystem() // to pop up the completion list due to file changed signals. FileSystem fs; QFileSystemModel model; + QSignalSpy filesAddedSpy(&model, &QAbstractItemModel::rowsInserted); model.setRootPath(fs.path()); QVERIFY(fs.createDirectory(QLatin1String(testDir1))); @@ -1672,13 +1673,16 @@ void tst_QCompleter::QTBUG_14292_filesystem() QTest::keyClick(&edit, 'r'); QTRY_VERIFY(!comp.popup()->isVisible()); QVERIFY(fs.createDirectory(QStringLiteral("hero"))); + if (!filesAddedSpy.wait()) + QSKIP("File system model didn't notify about new directory, skipping tests"); QTRY_VERIFY(comp.popup()->isVisible()); QCOMPARE(comp.popup()->model()->rowCount(), 1); QTest::keyClick(comp.popup(), Qt::Key_Escape); QTRY_VERIFY(!comp.popup()->isVisible()); QVERIFY(fs.createDirectory(QStringLiteral("nothingThere"))); //there is no reason creating a file should open a popup, it did in Qt 4.7.0 - QTest::qWait(60); + if (!filesAddedSpy.wait()) + QSKIP("File system model didn't notify about new file, skipping tests"); QVERIFY(!comp.popup()->isVisible()); QTest::keyClick(&edit, Qt::Key_Backspace); @@ -1696,7 +1700,8 @@ void tst_QCompleter::QTBUG_14292_filesystem() QVERIFY(fs.createDirectory(QStringLiteral("hemo"))); //there is no reason creating a file should open a popup, it did in Qt 4.7.0 - QTest::qWait(60); + if (!filesAddedSpy.wait()) + QSKIP("File system model didn't notify about new file, skipping tests"); QVERIFY(!comp.popup()->isVisible()); }