summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-11-06 10:59:32 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2019-11-07 10:35:03 +0100
commite6a0a945c591da3e3e66a6d7a350b4befd77a459 (patch)
tree4361b2fb469d9a62c25604b32e6adf5875d25839 /tests/auto/widgets/dialogs
parent1c4626f8309376b8ee661f172958a8698c269112 (diff)
Simplify two complex test conditions
Since the test was fatuous for i == 0, iterate from i = 1, instead. Change-Id: I9b9c1b7b10639aefdd74f48051d592da4f84dc85 Reviewed-by: Jesus Fernandez <jsfdez@gmail.com> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/widgets/dialogs')
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index f8f40e8488..590b3502f1 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -1030,15 +1030,13 @@ void tst_QFileSystemModel::dirsBeforeFiles()
// Wait for model to be notified by the file system watcher
QTRY_COMPARE(model->rowCount(root), 2 * itemCount);
- // ensure that no file occurs before a directory
- for (int i = 0; i < model->rowCount(root); ++i) {
+ // Ensure that no file occurs before any directory:
+ for (int i = 1; i < model->rowCount(root); ++i) {
#ifndef Q_OS_MAC
- QVERIFY(i == 0 ||
- !(model->fileInfo(model->index(i - 1, 0, root)).isFile()
+ QVERIFY(!(model->fileInfo(model->index(i - 1, 0, root)).isFile()
&& model->fileInfo(model->index(i, 0, root)).isDir()));
#else
- QVERIFY(i == 0 ||
- model->fileInfo(model->index(i - 1, 0, root)).fileName() <
+ QVERIFY(model->fileInfo(model->index(i - 1, 0, root)).fileName() <
model->fileInfo(model->index(i, 0, root)).fileName());
#endif
}