path: root/tests/auto
diff options
authorErik Verbruggen <>2014-02-26 15:32:01 +0100
committerThe Qt Project <>2014-03-27 17:51:21 +0100
commitdd453adbe7611900ff20ee77141229c01fe1bc98 (patch)
tree92665155cb918068ed110574328d700051920984 /tests/auto
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 <> Reviewed-by: Morten Johan Sørvig <>
Diffstat (limited to 'tests/auto')
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 =;
QCOMPARE(fileName, testDir.absolutePath());
+ // flush pending signals (like the one from the rmdir above)
+ timer.start(5000);
+ eventLoop.exec();
// recreate the file, we should not get any notification