diff -r 93b982ccede2 -r 5daf16870df6 tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp --- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp Mon Jun 21 22:38:13 2010 +0100 +++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp Thu Jul 22 16:41:55 2010 +0100 @@ -79,6 +79,8 @@ void nonExistingFile(); + void removeFileAndUnWatch(); + void cleanup(); private: QStringList do_force_engines; @@ -405,7 +407,7 @@ #if 0 class SignalTest : public QObject { - Q_OBJECT; + Q_OBJECT public slots: void fileSlot(const QString &file) { qDebug() << "file " << file;} void dirSlot(const QString &dir) { qDebug() << "dir" << dir;} @@ -532,5 +534,28 @@ 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"