From 49d3bb005889b9fb5a06d6aadac23ebd5b2f9f2d Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 6 Oct 2016 11:24:38 +0200 Subject: Normalize realpath(3) output to composed form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All strings coming out of POSIX API calls are converted to composed form by QFile::decodeName. Do the same for realpath(3) output. This is especially important for HFS+, which will store file names in decomposed form, and APIs will therefore return strings in decomposed form. Task-number: QTBUG-55896 Change-Id: I5e51f4e5712ff26bf9644cbcf9a9603995748892 Reviewed-by: Morten Johan Sørvig --- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index d2c43f79d6..10921ea0a3 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -770,6 +770,19 @@ void tst_QFileInfo::canonicalFilePath() QDir::current().rmdir(linkTarget); } #endif + +#ifdef Q_OS_DARWIN + { + // Check if canonicalFilePath's result is in Composed normalization form. + QString path = QString::fromLatin1("caf\xe9"); + QDir dir(QDir::tempPath()); + dir.mkdir(path); + QString canonical = QFileInfo(dir.filePath(path)).canonicalFilePath(); + QString roundtrip = QFile::decodeName(QFile::encodeName(canonical)); + QCOMPARE(canonical, roundtrip); + dir.rmdir(path); + } +#endif } void tst_QFileInfo::fileName_data() -- cgit v1.2.3