summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2009-08-06 12:29:54 (GMT)
committerLeonardo Sobral Cunha <leo.cunha@nokia.com>2009-08-06 12:33:22 (GMT)
commit2228e670ca89d3292452673f2630aa2f88e1873b (patch)
tree8157abb9831331aaf8fccd4515c97c0be52c81df /tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
parent8dbc32699dec7aa928eb9518c05437f481d11a43 (diff)
downloadQt-2228e670ca89d3292452673f2630aa2f88e1873b.zip
Qt-2228e670ca89d3292452673f2630aa2f88e1873b.tar.gz
Qt-2228e670ca89d3292452673f2630aa2f88e1873b.tar.bz2
Fixes autotests in QFileSystemWatcher: watchFileAndItsDirectory
dnotify is something from older linux kernels and cannot be trusted, therefore we skip some tests. Also we cannot guarantee that 1 operation on the file give only 1 notification in general, so we relaxed the conditions. Reviewed-by: paul
Diffstat (limited to 'tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp')
-rw-r--r--tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index c883c63..b89890e 100644
--- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -399,6 +399,15 @@ void tst_QFileSystemWatcher::removePaths()
watcher.removePaths(paths);
}
+#if 0
+class SignalTest : public QObject {
+ Q_OBJECT;
+ public slots:
+ void fileSlot(const QString &file) { qDebug() << "file " << file;}
+ void dirSlot(const QString &dir) { qDebug() << "dir" << dir;}
+};
+#endif
+
void tst_QFileSystemWatcher::watchFileAndItsDirectory()
{
QFETCH(QString, backend);
@@ -423,6 +432,12 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
watcher.addPath(testDir.dirName());
watcher.addPath(testFileName);
+ /*
+ SignalTest signalTest;
+ QObject::connect(&watcher, SIGNAL(fileChanged(const QString &)), &signalTest, SLOT(fileSlot(const QString &)));
+ QObject::connect(&watcher, SIGNAL(directoryChanged(const QString &)), &signalTest, SLOT(dirSlot(const QString &)));
+ */
+
QSignalSpy fileChangedSpy(&watcher, SIGNAL(fileChanged(const QString &)));
QSignalSpy dirChangedSpy(&watcher, SIGNAL(directoryChanged(const QString &)));
QEventLoop eventLoop;
@@ -440,9 +455,12 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
timer.start(3000);
eventLoop.exec();
- QCOMPARE(fileChangedSpy.count(), 1);
+ QVERIFY(fileChangedSpy.count() > 0);
QCOMPARE(dirChangedSpy.count(), 0);
+ if (backend == "dnotify")
+ QSKIP("dnotify is broken, skipping the rest of the test.", SkipSingle);
+
fileChangedSpy.clear();
QFile secondFile(secondFileName);
secondFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
@@ -460,7 +478,7 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
timer.start(3000);
eventLoop.exec();
- QCOMPARE(fileChangedSpy.count(), 1);
+ QVERIFY(fileChangedSpy.count() > 0);
QCOMPARE(dirChangedSpy.count(), 1);
fileChangedSpy.clear();