From 8a485894de36f4e3de27c208547ce4235bafb220 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 26 Jan 2021 16:29:57 +0100 Subject: Make the nameFilters test resilient to file system changes The test failed reliably when the directory in which the test started had the same number of files as the directory that the test wants to read. That's because the QTRY_COMPARE matches immediately and doesn't process events, which leaves queued signal emissions pending. So, count tests passed - for the wrong reason - and follow up tests failed. To make the test robust, start with an invalid directory, which we know is empty. Once switching into the test directroy, the test will have to process events. Remove the BLACKLIST file. Fixes: QTBUG-90468 Change-Id: I9b3c4dc1a15b0b5ab6c632c12752b038164b9d9d Reviewed-by: Mitch Curtis Reviewed-by: Qt CI Bot Reviewed-by: Fabian Kosmale --- tests/auto/qml/qquickfolderlistmodel/BLACKLIST | 4 ---- tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 tests/auto/qml/qquickfolderlistmodel/BLACKLIST (limited to 'tests/auto') diff --git a/tests/auto/qml/qquickfolderlistmodel/BLACKLIST b/tests/auto/qml/qquickfolderlistmodel/BLACKLIST deleted file mode 100644 index f7bdb9c422..0000000000 --- a/tests/auto/qml/qquickfolderlistmodel/BLACKLIST +++ /dev/null @@ -1,4 +0,0 @@ -[nameFilters] -macos ci # QTBUG-90468 -msvc-2015 -msvc-2017 diff --git a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp index 5e5dab3f34..10c5382455 100644 --- a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp +++ b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp @@ -196,7 +196,11 @@ void tst_qquickfolderlistmodel::nameFilters() this, SLOT(removed(QModelIndex,int,int))); QTRY_VERIFY(flm->rowCount() > 0); + // read an invalid directory first... + flm->setProperty("folder", testFileUrl("nosuchdirectory")); + QTRY_COMPARE(flm->property("count").toInt(),0); flm->setProperty("folder", testFileUrl("resetfiltering")); + // so that the QTRY_COMPARE for 3 entries will process queued signals QTRY_COMPARE(flm->property("count").toInt(),3); // all files visible int count = flm->rowCount(); -- cgit v1.2.3