diff options
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r-- | tests/auto/corelib/io/qdir/Info.plist | 41 | ||||
-rw-r--r-- | tests/auto/corelib/io/qdir/qdir.pro | 1 | ||||
-rw-r--r-- | tests/auto/corelib/io/qdir/tst_qdir.cpp | 14 | ||||
-rw-r--r-- | tests/auto/corelib/io/qurl/tst_qurl.cpp | 36 |
4 files changed, 83 insertions, 9 deletions
diff --git a/tests/auto/corelib/io/qdir/Info.plist b/tests/auto/corelib/io/qdir/Info.plist new file mode 100644 index 0000000000..7dc5622bde --- /dev/null +++ b/tests/auto/corelib/io/qdir/Info.plist @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDisplayName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleGetInfoString</key> + <string>Created by Qt/QMake</string> + <key>CFBundleIconFile</key> + <string>${ASSETCATALOG_COMPILER_APPICON_NAME}</string> + <key>CFBundleIdentifier</key> + <string>${PRODUCT_BUNDLE_IDENTIFIER}</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>${QMAKE_SHORT_VERSION}</string> + <key>CFBundleSignature</key> + <string>${QMAKE_PKGINFO_TYPEINFO}</string> + <key>CFBundleVersion</key> + <string>${QMAKE_FULL_VERSION}</string> + <key>LSRequiresIPhoneOS</key> + <true/> + <key>MinimumOSVersion</key> + <string>${IPHONEOS_DEPLOYMENT_TARGET}</string> + <key>UILaunchStoryboardName</key> + <string>LaunchScreen</string> + <key>UISupportedInterfaceOrientations</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationPortraitUpsideDown</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> + <key>NSPhotoLibraryUsageDescription</key> + <string>Enables use of assets file engine</string> +</dict> +</plist> diff --git a/tests/auto/corelib/io/qdir/qdir.pro b/tests/auto/corelib/io/qdir/qdir.pro index 2252e71cd8..a8b106e250 100644 --- a/tests/auto/corelib/io/qdir/qdir.pro +++ b/tests/auto/corelib/io/qdir/qdir.pro @@ -3,6 +3,7 @@ TARGET = tst_qdir QT = core core-private testlib SOURCES = tst_qdir.cpp RESOURCES += qdir.qrc +ios: QMAKE_INFO_PLIST = Info.plist TESTDATA += testdir testData searchdir resources entrylist types tst_qdir.cpp diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 30f0e447ad..34588b19bc 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -62,12 +62,7 @@ #endif #ifdef QT_BUILD_INTERNAL - -QT_BEGIN_NAMESPACE -extern Q_AUTOTEST_EXPORT QString - qt_normalizePathSegments(const QString &path, bool allowUncPaths, bool *ok = nullptr); -QT_END_NAMESPACE - +#include "private/qdir_p.h" #endif static QByteArray msgDoesNotExist(const QString &name) @@ -1376,7 +1371,7 @@ void tst_QDir::normalizePathSegments() QFETCH(QString, path); QFETCH(UncHandling, uncHandling); QFETCH(QString, expected); - QString cleaned = qt_normalizePathSegments(path, uncHandling == HandleUnc); + QString cleaned = qt_normalizePathSegments(path, uncHandling == HandleUnc ? QDirPrivate::AllowUncPaths : QDirPrivate::DefaultNormalization); QCOMPARE(cleaned, expected); if (path == expected) QVERIFY2(path.isSharedWith(cleaned), "Strings are same but data is not shared"); @@ -1528,6 +1523,11 @@ void tst_QDir::filePath_data() QTest::newRow("rel-rel") << "relative" << "path" << "relative/path"; QTest::newRow("empty-empty") << "" << "" << "."; QTest::newRow("resource") << ":/prefix" << "foo.bar" << ":/prefix/foo.bar"; +#ifdef Q_OS_IOS + QTest::newRow("assets-rel") << "assets-library:/" << "foo/bar.baz" << "assets-library:/foo/bar.baz"; + QTest::newRow("assets-abs") << "assets-library:/" << "/foo/bar.baz" << "/foo/bar.baz"; + QTest::newRow("abs-assets") << "/some/path" << "assets-library:/foo/bar.baz" << "assets-library:/foo/bar.baz"; +#endif #ifdef Q_OS_WIN QTest::newRow("abs-LTUNC") << "Q:/path" << "\\/leaning\\tooth/pick" << "\\/leaning\\tooth/pick"; QTest::newRow("LTUNC-slash") << "\\/leaning\\tooth/pick" << "/path" << "//leaning/tooth/path"; diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 84af1c255a..4f173d2dfd 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -182,6 +182,8 @@ private slots: void matches(); void ipv6_zoneId_data(); void ipv6_zoneId(); + void normalizeRemotePaths_data(); + void normalizeRemotePaths(); private: void testThreadingHelper(); @@ -323,7 +325,7 @@ void tst_QUrl::comparison() QUrl url3bis = QUrl::fromEncoded("example://a/b/c/%7Bfoo%7D/"); QUrl url3bisNoSlash = QUrl::fromEncoded("example://a/b/c/%7Bfoo%7D"); - QUrl url4bis = QUrl::fromEncoded("example://a/.//b/../b/c//%7Bfoo%7D/"); + QUrl url4bis = QUrl::fromEncoded("example://a/./b/../b/c/%7Bfoo%7D/"); QCOMPARE(url4bis.adjusted(QUrl::NormalizePathSegments), url3bis); QCOMPARE(url4bis.adjusted(QUrl::NormalizePathSegments | QUrl::StripTrailingSlash), url3bisNoSlash); QVERIFY(url3bis.matches(url4bis, QUrl::NormalizePathSegments)); @@ -335,7 +337,7 @@ void tst_QUrl::comparison() QCOMPARE(url4EncodedDots.path(QUrl::FullyDecoded), QString("/.//b/..//b/c/")); QCOMPARE(QString::fromLatin1(url4EncodedDots.toEncoded()), QString::fromLatin1("example://a/.//b/..%2F/b/c/")); QCOMPARE(url4EncodedDots.toString(), QString("example://a/.//b/..%2F/b/c/")); - QCOMPARE(url4EncodedDots.adjusted(QUrl::NormalizePathSegments).toString(), QString("example://a/b/..%2F/b/c/")); + QCOMPARE(url4EncodedDots.adjusted(QUrl::NormalizePathSegments).toString(), QString("example://a//b/..%2F/b/c/")); // 6.2.2.1 Make sure hexdecimal characters in percent encoding are // treated case-insensitively @@ -4201,6 +4203,36 @@ void tst_QUrl::ipv6_zoneId() QCOMPARE(url.toString(QUrl::FullyEncoded), "x://[" + encodedHost + "]"); } +void tst_QUrl::normalizeRemotePaths_data() +{ + QTest::addColumn<QUrl>("url"); + QTest::addColumn<QString>("expected"); + + QTest::newRow("dotdot-slashslash") << QUrl("http://qt-project.org/some/long/..//path") << "http://qt-project.org/some//path"; + QTest::newRow("slashslash-dotdot") << QUrl("http://qt-project.org/some//../path") << "http://qt-project.org/some/path"; + QTest::newRow("slashslash-dotdot2") << QUrl("http://qt-project.org/some//path/../") << "http://qt-project.org/some//"; + QTest::newRow("dot-slash") << QUrl("http://qt-project.org/some/./path") << "http://qt-project.org/some/path"; + QTest::newRow("slashslash-dot-slashslash") << QUrl("http://qt-project.org/some//.//path") << "http://qt-project.org/some///path"; + QTest::newRow("dot-slashslash") << QUrl("http://qt-project.org/some/.//path") << "http://qt-project.org/some//path"; + QTest::newRow("multiple-slashes") << QUrl("http://qt-project.org/some//path") << "http://qt-project.org/some//path"; + QTest::newRow("multiple-slashes4") << QUrl("http://qt-project.org/some////path") << "http://qt-project.org/some////path"; + QTest::newRow("slashes-at-end") << QUrl("http://qt-project.org/some//") << "http://qt-project.org/some//"; + QTest::newRow("dot-dotdot") << QUrl("http://qt-project.org/path/./../") << "http://qt-project.org/"; + QTest::newRow("slash-dot-slash-dot-slash") << QUrl("http://qt-project.org/path//.//.//") << "http://qt-project.org/path////"; + QTest::newRow("dotdot") << QUrl("http://qt-project.org/../") << "http://qt-project.org/"; + QTest::newRow("dotdot-dotdot") << QUrl("http://qt-project.org/path/../../") << "http://qt-project.org/"; + QTest::newRow("dot-dotdot-tail") << QUrl("http://qt-project.org/stem/path/./../tail") << "http://qt-project.org/stem/tail"; + QTest::newRow("slash-dotdot-slash-tail") << QUrl("http://qt-project.org/stem/path//..//tail") << "http://qt-project.org/stem/path//tail"; +} + +void tst_QUrl::normalizeRemotePaths() +{ + QFETCH(QUrl, url); + QFETCH(QString, expected); + + QCOMPARE(url.adjusted(QUrl::NormalizePathSegments).toString(), expected); +} + QTEST_MAIN(tst_QUrl) #include "tst_qurl.moc" |