diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-01-26 16:29:57 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-01-26 21:41:26 +0100 |
commit | 8a485894de36f4e3de27c208547ce4235bafb220 (patch) | |
tree | ac779d23dcdeb5b150e754edacb77c434dae5cdf /tests/auto | |
parent | bac93541ba324e75c532c1987e861109e1c5b131 (diff) |
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 <mitch.curtis@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qml/qquickfolderlistmodel/BLACKLIST | 4 | ||||
-rw-r--r-- | tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
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(); |