summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfilesystemwatcher
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qfilesystemwatcher')
-rw-r--r--tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index 7138905..a26e34d 100644
--- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -79,6 +79,8 @@ private slots:
void nonExistingFile();
+ void removeFileAndUnWatch();
+
void cleanup();
private:
QStringList do_force_engines;
@@ -532,5 +534,28 @@ void tst_QFileSystemWatcher::nonExistingFile()
QVERIFY(true);
}
+void tst_QFileSystemWatcher::removeFileAndUnWatch()
+{
+ static const char * const filename = "foo.txt";
+ QFileSystemWatcher watcher;
+
+ {
+ QFile testFile(filename);
+ testFile.open(QIODevice::WriteOnly);
+ testFile.close();
+ }
+ watcher.addPath(filename);
+
+ QFile::remove(filename);
+ watcher.removePath(filename);
+
+ {
+ QFile testFile(filename);
+ testFile.open(QIODevice::WriteOnly);
+ testFile.close();
+ }
+ watcher.addPath(filename);
+}
+
QTEST_MAIN(tst_QFileSystemWatcher)
#include "tst_qfilesystemwatcher.moc"