summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2014-02-26 15:32:01 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-27 17:51:21 +0100
commitdd453adbe7611900ff20ee77141229c01fe1bc98 (patch)
tree92665155cb918068ed110574328d700051920984 /tests
parentff3dcc49c4a1912189091e35e87cb61af2f62d47 (diff)
Mac: make FSEvents-based QFileSystemWatcherEngine more robust.
- Record the last event ID with every callback. This event ID is passed to FSEventStreamCreate when restarting the stream, so the watcher will receive all events that occurred since invalidating the previous stream. - Never start with kFSEventStreamEventIdSinceNow, because this will generate a (bogus) soft-assert in FSEventStreamFlushSync in CarbonCore when no event occurred since stream creation. The last globally generated event ID is used instead to simulate the "now". - Do not dispose and recreate the stream in the callback, but use a queued signal-slot connection to schedule this on thread that owns the watcher. Change-Id: I02f5a845d9e27f9853ed97925ab9c7a5bc0dede1 Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index b681cec802..a58c7dfb4b 100644
--- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -324,6 +324,9 @@ void tst_QFileSystemWatcher::watchDirectory()
fileName = changedSpy.at(1).at(0).toString();
QCOMPARE(fileName, testDir.absolutePath());
+ // flush pending signals (like the one from the rmdir above)
+ timer.start(5000);
+ eventLoop.exec();
changedSpy.clear();
// recreate the file, we should not get any notification