diff options
Diffstat (limited to 'tests')
4 files changed, 28 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index f71bc7e7eb..cfb25d7acb 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -1269,6 +1269,8 @@ tst_QDir::cleanPath_data() QTest::newRow("unc-server-up") << "//server/path/.." << "//server"; QTest::newRow("unc-server-above-root") << "//server/.." << "//server/.."; QTest::newRow("longpath") << "\\\\?\\d:\\" << "d:/"; + QTest::newRow("unc-network-share") << uR"(\\?\UNC\localhost\c$\tmp.txt)"_qs + << u"//localhost/c$/tmp.txt"_qs; #else QTest::newRow("data15") << "//c:/foo" << "/c:/foo"; #endif // non-windows @@ -1744,6 +1746,8 @@ void tst_QDir::nativeSeparators() QCOMPARE(QDir::fromNativeSeparators(QLatin1String("/")), QString("/")); QCOMPARE(QDir::fromNativeSeparators(QLatin1String("\\")), QString("/")); QCOMPARE(QDir::fromNativeSeparators(QLatin1String("\\\\?\\C:\\")), QString("C:/")); + QCOMPARE(QDir::fromNativeSeparators(uR"(\\?\UNC\localhost\c$\tmp.txt)"_qs), + u"//localhost/c$/tmp.txt"_qs); #else QCOMPARE(QDir::toNativeSeparators(QLatin1String("/")), QString("/")); QCOMPARE(QDir::toNativeSeparators(QLatin1String("\\")), QString("\\")); diff --git a/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp b/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp index 30c38b20f9..a9ae848251 100644 --- a/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp +++ b/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp @@ -104,6 +104,17 @@ void tst_QFileSystemEntry::getSetCheck_data() << QString("A:dir\\without\\leading\\backslash.bat") << absPrefix + QString("A:\\dir\\without\\leading\\backslash.bat") << "A:dir/without/leading/backslash.bat" << "backslash.bat" << "backslash" << "backslash" << "bat" << "bat" << false << false; + + QTest::newRow("longpath") + << uR"(\\?\D:\)"_qs + << absPrefix + QLatin1String(R"(D:\)") + << "D:/" << "" << "" << "" << "" << "" << true << false; + + QTest::newRow("uncprefix") + << uR"(\\?\UNC\localhost\C$\tmp.txt)"_qs + << absPrefix + QLatin1String(R"(UNC\localhost\C$\tmp.txt)") + << "//localhost/C$/tmp.txt" << "tmp.txt" << "tmp" << "tmp" << "txt" << "txt" << true + << false; } void tst_QFileSystemEntry::getSetCheck() @@ -137,7 +148,7 @@ void tst_QFileSystemEntry::getSetCheck() QCOMPARE(entry2.isRelative(), relative); QCOMPARE(entry2.filePath(), filepath); // Since this entry was created using the native path, - // the object shouldnot change nativeFilePath. + // the object shouldn't change nativeFilePath. QCOMPARE(entry2.nativeFilePath(), nativeFilePath); QCOMPARE(entry2.fileName(), filename); QCOMPARE(entry2.baseName(), baseName); diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp index 4969c0e6e3..db07f80495 100644 --- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp +++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp @@ -157,6 +157,12 @@ void tst_QTemporaryDir::fileTemplate_data() prefix = "qt_" + hanTestText(); QTest::newRow("Chinese") << (prefix + "XXXXXX" + umlautTestText()) << prefix << umlautTestText(); } + +#ifdef Q_OS_WIN + const auto tmp = QDir::toNativeSeparators(QDir::tempPath()).sliced(QDir::rootPath().size()); + QTest::newRow("UNC") << uR"(\\localhost\C$\)"_qs + tmp + uR"(\UNC.XXXXXX.tmpDir)"_qs + << "UNC." << ".tmpDir"; +#endif } void tst_QTemporaryDir::fileTemplate() diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index 331558255f..bb938e9695 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -206,6 +206,12 @@ void tst_QTemporaryFile::fileTemplate_data() prefix = "qt_" + hanTestText(); QTest::newRow("Chinese characters") << (prefix + "XXXXXX") << prefix << QString() << QString(); } + +#ifdef Q_OS_WIN + const auto tmp = QDir::toNativeSeparators(QDir::tempPath()).sliced(QDir::rootPath().size()); + QTest::newRow("UNC") << uR"(\\localhost\C$\)"_qs + tmp + uR"(\QTBUG-74291.XXXXXX.tmpFile)"_qs + << "QTBUG-74291." << ".tmpFile" << ""; +#endif } void tst_QTemporaryFile::fileTemplate() |