diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-07-01 11:05:26 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-07-01 11:05:26 +0200 |
commit | 0aa2d318b1524cdab42ab9988270779ddcc1922a (patch) | |
tree | 695c70702763ba2c66eb398ae9d545fc712a9e2d /tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | |
parent | 6251d4dafc86bcbec09d1962050af9924249d419 (diff) | |
parent | 49049d90470eb3e94bda77d19ab7f7c57a0bd57f (diff) |
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
src/corelib/global/qglobal.cpp
src/corelib/global/qglobal.h
src/corelib/global/qsysinfo.h
src/corelib/global/qsystemdetection.h
src/corelib/kernel/qobjectdefs.h
src/plugins/plugins.pro
tests/auto/widgets/itemviews/qlistview/qlistview.pro
Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
Diffstat (limited to 'tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp')
-rw-r--r-- | tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index b78ff7ed80..a0434aa8ee 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -62,6 +62,7 @@ private slots: void removePath(); void addPaths(); void removePaths(); + void removePathsFilesInSameDirectory(); void watchFileAndItsDirectory_data() { basicTest_data(); } void watchFileAndItsDirectory(); @@ -460,6 +461,31 @@ void tst_QFileSystemWatcher::removePaths() watcher.removePaths(paths); } +void tst_QFileSystemWatcher::removePathsFilesInSameDirectory() +{ + // QTBUG-46449/Windows: Check the return values of removePaths(). + // When adding the 1st file, a thread is started to watch the temp path. + // After adding and removing the 2nd file, the thread is still running and + // success should be reported. + QTemporaryFile file1(m_tempDirPattern); + QTemporaryFile file2(m_tempDirPattern); + QVERIFY2(file1.open(), qPrintable(file1.errorString())); + QVERIFY2(file2.open(), qPrintable(file1.errorString())); + const QString path1 = file1.fileName(); + const QString path2 = file2.fileName(); + file1.close(); + file2.close(); + QFileSystemWatcher watcher; + QVERIFY(watcher.addPath(path1)); + QCOMPARE(watcher.files().size(), 1); + QVERIFY(watcher.addPath(path2)); + QCOMPARE(watcher.files().size(), 2); + QVERIFY(watcher.removePath(path1)); + QCOMPARE(watcher.files().size(), 1); + QVERIFY(watcher.removePath(path2)); + QCOMPARE(watcher.files().size(), 0); +} + static QByteArray msgFileOperationFailed(const char *what, const QFile &f) { return what + QByteArrayLiteral(" failed on \"") |