diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-09-29 11:59:01 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-10-24 15:10:42 +0000 |
commit | f6eb570c7dee2ec92383607c614db91f31804707 (patch) | |
tree | ca94a9474e2b9bfc60949c898ec1b0b8806bd751 | |
parent | 592614ea3ecd90ede2ae1b8e6579d1b898f474ec (diff) |
Darwin: normalize all watched paths to composed from
This will be done by all POSIX APIs for strings coming in that way, but
because other code (like NSWhateverViews) will most likely return
decomposed form, we make sure that those are in composed form too.
Task-number: QTBUG-55896
Change-Id: I065e11cee6b59706d4346ed20d4b59b9b95163b8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r-- | src/corelib/io/qfilesystemwatcher_fsevents.mm | 2 | ||||
-rw-r--r-- | tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm index c6fa6c9846..6af9e5f5ef 100644 --- a/src/corelib/io/qfilesystemwatcher_fsevents.mm +++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm @@ -343,7 +343,7 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths, QStringList p = paths; QMutableListIterator<QString> it(p); while (it.hasNext()) { - QString origPath = it.next(); + QString origPath = it.next().normalized(QString::NormalizationForm_C); QString realPath = origPath; if (realPath.endsWith(QDir::separator())) realPath = realPath.mid(0, realPath.size() - 1); diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 026743257c..4ede1e69f3 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -78,6 +78,8 @@ private slots: void signalsEmittedAfterFileMoved(); + void watchUnicodeCharacters(); + private: QString m_tempDirPattern; #endif // QT_NO_FILESYSTEMWATCHER @@ -763,6 +765,25 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved() QVERIFY2(changedSpy.count() <= fileCount, changedSpy.receivedFilesMessage()); QTRY_COMPARE(changedSpy.count(), fileCount); } + +void tst_QFileSystemWatcher::watchUnicodeCharacters() +{ + QTemporaryDir temporaryDirectory(m_tempDirPattern); + QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString())); + + QDir testDir(temporaryDirectory.path()); + const QString subDir(QString::fromLatin1("caf\xe9")); + QVERIFY(testDir.mkdir(subDir)); + testDir = QDir(temporaryDirectory.path() + QDir::separator() + subDir); + + QFileSystemWatcher watcher; + QVERIFY(watcher.addPath(testDir.path())); + + FileSystemWatcherSpy changedSpy(&watcher, FileSystemWatcherSpy::SpyOnDirectoryChanged); + QCOMPARE(changedSpy.count(), 0); + QVERIFY(testDir.mkdir("creme")); + QTRY_COMPARE(changedSpy.count(), 1); +} #endif // QT_NO_FILESYSTEMWATCHER QTEST_MAIN(tst_QFileSystemWatcher) |