tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
--- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -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"