diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-06-13 13:42:01 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-04 12:54:58 +0200 |
commit | 6e8dddadd877ec8e9a8f6006e7beaa183d5da452 (patch) | |
tree | 4fe30d28ae1bad9b74e9d148002e7001f1b8452a /tests/auto/corelib/io/qfilesystemwatcher | |
parent | 1cd8ae21155bf131e2a52d6b22bd4d93f60c80a7 (diff) |
Use case insensitive matching for hashes QFileSystemWatcher/Win.
Do not lower case file names to generate hash keys since
QString::toLower() converts some characters with context
which the Windows file system will not.
Task-number: QTBUG-31341
Change-Id: I285bfedef3c1ca9d59083229e61974dd378c72ae
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'tests/auto/corelib/io/qfilesystemwatcher')
-rw-r--r-- | tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index a96d8706ee..2756fcce50 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -94,20 +94,31 @@ tst_QFileSystemWatcher::tst_QFileSystemWatcher() void tst_QFileSystemWatcher::basicTest_data() { QTest::addColumn<QString>("backend"); - QTest::newRow("native backend") << "native"; - QTest::newRow("poller backend") << "poller"; + QTest::addColumn<QString>("testFileName"); + const QString testFile = QStringLiteral("testfile.txt"); + // QTBUG-31341: Test the UNICODE capabilities; ensure no QString::toLower() + // is in the code path since that will lower case for example + // LATIN_CAPITAL_LETTER_I_WITH_DOT_ABOVE with context, whereas the Windows file + // system will not. + const QString specialCharacterFile = + QString(QChar(ushort(0x130))) // LATIN_CAPITAL_LETTER_I_WITH_DOT_ABOVE + + QChar(ushort(0x00DC)) // LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS + + QStringLiteral(".txt"); + + QTest::newRow("native backend-testfile") << "native" << testFile; + QTest::newRow("poller backend-testfile") << "poller" << testFile; + QTest::newRow("native backend-specialchars") << "native" << specialCharacterFile; } void tst_QFileSystemWatcher::basicTest() { QFETCH(QString, backend); + QFETCH(QString, testFileName); // create test file QTemporaryDir temporaryDirectory(m_tempDirPattern); QVERIFY(temporaryDirectory.isValid()); - QFile testFile(temporaryDirectory.path() + QStringLiteral("/testfile.txt")); - testFile.setPermissions(QFile::ReadOwner | QFile::WriteOwner); - testFile.remove(); + QFile testFile(temporaryDirectory.path() + QLatin1Char('/') + testFileName); QVERIFY(testFile.open(QIODevice::WriteOnly | QIODevice::Truncate)); testFile.write(QByteArray("hello")); testFile.close(); |