diff options
Diffstat (limited to 'tests/auto/corelib/io')
55 files changed, 318 insertions, 165 deletions
diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro index 3c93fd5e1f..eee2c0e30d 100644 --- a/tests/auto/corelib/io/io.pro +++ b/tests/auto/corelib/io/io.pro @@ -65,6 +65,9 @@ win32:!qtConfig(private_tests): SUBDIRS -= \ qprocess \ qprocess-noapplication +!qtConfig(settings): SUBDIRS -= \ + qsettings + winrt: SUBDIRS -= \ qstorageinfo 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..2aebc67dcf 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) @@ -354,21 +349,21 @@ void tst_QDir::mkdirRmdir_data() QTest::addColumn<QString>("path"); QTest::addColumn<bool>("recurse"); - QStringList dirs; - dirs << "testdir/one" - << "testdir/two/three/four" - << "testdir/../testdir/three"; - QTest::newRow("plain") << QDir::currentPath() + "/" + dirs.at(0) << false; - QTest::newRow("recursive") << QDir::currentPath() + "/" + dirs.at(1) << true; - QTest::newRow("with-..") << QDir::currentPath() + "/" + dirs.at(2) << false; - - QTest::newRow("relative-plain") << dirs.at(0) << false; - QTest::newRow("relative-recursive") << dirs.at(1) << true; - QTest::newRow("relative-with-..") << dirs.at(2) << false; - - // Ensure that none of these directories already exist - for (int i = 0; i < dirs.count(); ++i) - QVERIFY(!QFile::exists(dirs.at(i))); + const struct { + const char *name; // shall have a prefix added + const char *path; // relative + bool recurse; + } cases[] = { + { "plain", "testdir/one", false }, + { "recursive", "testdir/two/three/four", true }, + { "with-..", "testdir/../testdir/three", false }, + }; + + for (const auto &it : cases) { + QVERIFY(!QFile::exists(it.path)); + QTest::addRow("absolute-%s", it.name) << (QDir::currentPath() + "/") + it.path << it.recurse; + QTest::addRow("relative-%s", it.name) << QString::fromLatin1(it.path) << it.recurse; + } } void tst_QDir::mkdirRmdir() @@ -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"; @@ -2045,7 +2045,7 @@ void tst_QDir::detachingOperations() QCOMPARE(dir2.nameFilters(), nameFilters); QCOMPARE(dir2.sorting(), sorting); - dir2 = path1; + dir2.setPath(path1); QCOMPARE(dir2.path(), path1); QCOMPARE(dir2.filter(), filter); QCOMPARE(dir2.nameFilters(), nameFilters); diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 3e29475636..714c96b5e5 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -2022,7 +2022,7 @@ static void stateCheck(const QFileInfo &info, const QString &dirname, const QStr QVERIFY(!info.isRoot()); QCOMPARE(info.isNativePath(), !filename.isEmpty()); - QCOMPARE(info.readLink(), QString()); + QCOMPARE(info.symLinkTarget(), QString()); QCOMPARE(info.ownerId(), uint(-2)); QCOMPARE(info.groupId(), uint(-2)); QCOMPARE(info.owner(), QString()); diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index fed05698fd..da5327594c 100644 --- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -209,9 +209,6 @@ void tst_QIODevice::read_QByteArray() //-------------------------------------------------------------------- void tst_QIODevice::unget() { -#if defined(Q_OS_MAC) - QSKIP("The unget network test is unstable on Mac. See QTBUG-39983."); -#endif QBuffer buffer; buffer.open(QBuffer::ReadWrite); buffer.write("ZXCV"); diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.pro b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.pro index 3ac3be9c9b..97135d279e 100644 --- a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.pro +++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.pro @@ -1,7 +1,6 @@ TARGET = qlockfile_test_helper SOURCES += qlockfile_test_helper.cpp -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline QT = core DESTDIR = ./ diff --git a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp index 11a9b3f189..08635d34c5 100644 --- a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp +++ b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp @@ -369,11 +369,9 @@ private slots: } Q_LOGGING_CATEGORY(TST_MACRO_1, "tst.macro.1") -#ifdef Q_COMPILER_VARIADIC_MACROS Q_LOGGING_CATEGORY(TST_MACRO_2, "tst.macro.2", QtDebugMsg) Q_LOGGING_CATEGORY(TST_MACRO_3, "tst.macro.3", QtFatalMsg) Q_LOGGING_CATEGORY(TST_MACRO_4, "tst.macro.4", QtInfoMsg) -#endif void QLoggingCategoryMacro() { @@ -384,7 +382,6 @@ private slots: QCOMPARE(cat1.isWarningEnabled(), true); QCOMPARE(cat1.isCriticalEnabled(), true); -#ifdef Q_COMPILER_VARIADIC_MACROS const QLoggingCategory &cat2 = TST_MACRO_2(); QCOMPARE(cat2.categoryName(), "tst.macro.2"); QCOMPARE(cat2.isDebugEnabled(), true); @@ -405,7 +402,6 @@ private slots: QCOMPARE(cat4.isInfoEnabled(), true); QCOMPARE(cat4.isWarningEnabled(), true); QCOMPARE(cat4.isCriticalEnabled(), true); -#endif } void qCDebugMacros() diff --git a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp index 17c51eaaf4..569c610e24 100644 --- a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp +++ b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp @@ -53,6 +53,7 @@ void tst_QNoDebug::noDebugOutput() const // should do nothing qDebug() << "foo"; qCDebug(cat) << "foo"; + qCDebug(cat, "foo"); // qWarning still works, though QTest::ignoreMessage(QtWarningMsg, "bar"); diff --git a/tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro b/tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro index 947dc916f2..2744491151 100644 --- a/tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro +++ b/tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro @@ -1,5 +1,4 @@ SOURCES = main.cpp -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline QT = core DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testDetached/testDetached.pro b/tests/auto/corelib/io/qprocess/testDetached/testDetached.pro index 8d1fcba624..3d80b668df 100644 --- a/tests/auto/corelib/io/qprocess/testDetached/testDetached.pro +++ b/tests/auto/corelib/io/qprocess/testDetached/testDetached.pro @@ -1,6 +1,5 @@ SOURCES = main.cpp QT = core -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline INSTALLS = DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro b/tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro index b08371804f..5eaf8dc881 100644 --- a/tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro +++ b/tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro @@ -1,5 +1,5 @@ SOURCES += main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testForwarding/testForwarding.pro b/tests/auto/corelib/io/qprocess/testForwarding/testForwarding.pro index 45b498c32a..4d91e0cf36 100644 --- a/tests/auto/corelib/io/qprocess/testForwarding/testForwarding.pro +++ b/tests/auto/corelib/io/qprocess/testForwarding/testForwarding.pro @@ -1,5 +1,4 @@ SOURCES = main.cpp -CONFIG -= app_bundle -CONFIG += console +CONFIG += cmdline DESTDIR = ./ QT = core diff --git a/tests/auto/corelib/io/qprocess/testForwardingHelper/testForwardingHelper.pro b/tests/auto/corelib/io/qprocess/testForwardingHelper/testForwardingHelper.pro index e236e05c7d..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testForwardingHelper/testForwardingHelper.pro +++ b/tests/auto/corelib/io/qprocess/testForwardingHelper/testForwardingHelper.pro @@ -1,4 +1,4 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro b/tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro index 8778da7ffe..ef438d6399 100644 --- a/tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro +++ b/tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro @@ -1,5 +1,4 @@ SOURCES += main.cpp QT += widgets -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro b/tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro index 7ccc976efc..640ce4cd09 100644 --- a/tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro +++ b/tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro @@ -1,5 +1,5 @@ SOURCES = main.cpp -CONFIG += console -CONFIG -= qt app_bundle +CONFIG += cmdline +CONFIG -= qt DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro b/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro index fbb3411d47..c7be60a82d 100644 --- a/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro +++ b/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro @@ -1,5 +1,5 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro b/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro index 98fe78c8b9..ab1394a5c9 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro @@ -1,6 +1,6 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline win32:!mingw:!equals(TEMPLATE_PREFIX, "vc"):QMAKE_CXXFLAGS += /GS- DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro b/tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro index e236e05c7d..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro @@ -1,4 +1,4 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro b/tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro index e236e05c7d..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro @@ -1,4 +1,4 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro b/tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro index e236e05c7d..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro @@ -1,4 +1,4 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro b/tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro index a07ae00605..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro @@ -1,8 +1,4 @@ SOURCES = main.cpp CONFIG -= qt -CONFIG += console +CONFIG += cmdline DESTDIR = ./ - -mac { - CONFIG -= app_bundle -} diff --git a/tests/auto/corelib/io/qprocess/testProcessHang/testProcessHang.pro b/tests/auto/corelib/io/qprocess/testProcessHang/testProcessHang.pro index e236e05c7d..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testProcessHang/testProcessHang.pro +++ b/tests/auto/corelib/io/qprocess/testProcessHang/testProcessHang.pro @@ -1,4 +1,4 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro b/tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro index c6db9d1bac..7e1119c117 100644 --- a/tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro +++ b/tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro @@ -1,6 +1,6 @@ SOURCES = main.cpp -CONFIG += console -CONFIG -= qt app_bundle +CONFIG += cmdline +CONFIG -= qt DESTDIR = ./ QT = core diff --git a/tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro b/tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro index 95191098bd..0bbb6b3c0e 100644 --- a/tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro +++ b/tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro @@ -1,5 +1,5 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ QT = core diff --git a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/nospace.pro b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/nospace.pro index dd7e8e4a85..7954a2f74b 100644 --- a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/nospace.pro +++ b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/nospace.pro @@ -1,6 +1,6 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ OBJECTS_DIR = $${OBJECTS_DIR}-nospace DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/onespace.pro b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/onespace.pro index d18a683e1c..44a365c9a5 100644 --- a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/onespace.pro +++ b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/onespace.pro @@ -1,6 +1,6 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ OBJECTS_DIR = $${OBJECTS_DIR}-onespace diff --git a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/twospaces.pro b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/twospaces.pro index 8b16f65e34..bd2db9fb6d 100644 --- a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/twospaces.pro +++ b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/twospaces.pro @@ -1,6 +1,6 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ OBJECTS_DIR = $${OBJECTS_DIR}-twospaces diff --git a/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro b/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro index e236e05c7d..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro +++ b/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro @@ -1,4 +1,4 @@ SOURCES = main.cpp -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ diff --git a/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro b/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro index 21a115b536..4d91e0cf36 100644 --- a/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro +++ b/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro @@ -1,5 +1,4 @@ SOURCES = main.cpp -CONFIG += console -CONFIG -= app_bundle +CONFIG += cmdline DESTDIR = ./ QT = core diff --git a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro index 80e8bcad98..2cfcb4794e 100644 --- a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro +++ b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro @@ -6,7 +6,7 @@ unix { SOURCES = main_unix.cpp } -CONFIG -= qt app_bundle -CONFIG += console +CONFIG -= qt +CONFIG += cmdline DESTDIR = ./ QT = core diff --git a/tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro b/tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro index afa4f32a85..48f28c4c8b 100644 --- a/tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro +++ b/tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro @@ -1,9 +1,5 @@ SOURCES = main.cpp CONFIG -= qt -CONFIG += console +CONFIG += cmdline DESTDIR = "../test Space In Name" - -mac { - CONFIG -= app_bundle -} QT = core diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index e0aa577154..c51994c1c1 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -185,12 +185,12 @@ void tst_QProcess::getSetCheck() { QProcess obj1; // ProcessChannelMode QProcess::readChannelMode() - // void QProcess::setReadChannelMode(ProcessChannelMode) - obj1.setReadChannelMode(QProcess::ProcessChannelMode(QProcess::SeparateChannels)); + // void QProcess::setProcessChannelMode(ProcessChannelMode) + obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::SeparateChannels)); QCOMPARE(QProcess::ProcessChannelMode(QProcess::SeparateChannels), obj1.readChannelMode()); - obj1.setReadChannelMode(QProcess::ProcessChannelMode(QProcess::MergedChannels)); + obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::MergedChannels)); QCOMPARE(QProcess::ProcessChannelMode(QProcess::MergedChannels), obj1.readChannelMode()); - obj1.setReadChannelMode(QProcess::ProcessChannelMode(QProcess::ForwardedChannels)); + obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::ForwardedChannels)); QCOMPARE(QProcess::ProcessChannelMode(QProcess::ForwardedChannels), obj1.readChannelMode()); // ProcessChannel QProcess::readChannel() @@ -913,7 +913,7 @@ public: switch (n) { case 0: - setReadChannelMode(QProcess::MergedChannels); + setProcessChannelMode(QProcess::MergedChannels); connect(this, &QIODevice::readyRead, this, &SoftExitProcess::terminateSlot); break; case 1: @@ -929,7 +929,7 @@ public: this, &SoftExitProcess::terminateSlot); break; case 4: - setReadChannelMode(QProcess::MergedChannels); + setProcessChannelMode(QProcess::MergedChannels); connect(this, SIGNAL(channelReadyRead(int)), this, SLOT(terminateSlot())); break; default: @@ -1025,7 +1025,7 @@ void tst_QProcess::softExitInSlots() void tst_QProcess::mergedChannels() { QProcess process; - process.setReadChannelMode(QProcess::MergedChannels); + process.setProcessChannelMode(QProcess::MergedChannels); QCOMPARE(process.readChannelMode(), QProcess::MergedChannels); process.start("testProcessEcho2/testProcessEcho2"); @@ -1951,7 +1951,7 @@ void tst_QProcess::setStandardOutputFile() // run the process QProcess process; - process.setReadChannelMode(channelMode); + process.setProcessChannelMode(channelMode); if (channelToTest == QProcess::StandardOutput) process.setStandardOutputFile(file.fileName(), mode); else @@ -2037,7 +2037,7 @@ void tst_QProcess::setStandardOutputProcess() QFETCH(bool, merged); QFETCH(bool, waitForBytesWritten); - source.setReadChannelMode(merged ? QProcess::MergedChannels : QProcess::SeparateChannels); + source.setProcessChannelMode(merged ? QProcess::MergedChannels : QProcess::SeparateChannels); source.setStandardOutputProcess(&sink); source.start("testProcessEcho2/testProcessEcho2"); diff --git a/tests/auto/corelib/io/qresourceengine/.gitattributes b/tests/auto/corelib/io/qresourceengine/.gitattributes index add3716d81..88edd3681a 100644 --- a/tests/auto/corelib/io/qresourceengine/.gitattributes +++ b/tests/auto/corelib/io/qresourceengine/.gitattributes @@ -1 +1,2 @@ testqrc/test.qrc -crlf +*.txt -crlf diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/aliasdir/aliasdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/aliasdir/aliasdir.txt index 21a3dfa0b8..dcf7937f0a 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/aliasdir/aliasdir.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/aliasdir/aliasdir.txt @@ -1 +1 @@ -"This is a korean text file" +"This is a korean text file" diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/blahblah.txt b/tests/auto/corelib/io/qresourceengine/testqrc/blahblah.txt index 436c4d11c3..19f0805d8d 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/blahblah.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/blahblah.txt @@ -1 +1 @@ -qwerty +qwerty diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/currentdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/currentdir.txt index 38e389979a..65f1f43def 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/currentdir.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/currentdir.txt @@ -1 +1 @@ -"This is the current dir" +"This is the current dir" diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/currentdir2.txt b/tests/auto/corelib/io/qresourceengine/testqrc/currentdir2.txt index 6ac16a3306..7d89108011 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/currentdir2.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/currentdir2.txt @@ -1 +1 @@ -"This is also the current dir" +"This is also the current dir" diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/otherdir/otherdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/otherdir/otherdir.txt index b0e4a124ee..e1b430f33b 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/otherdir/otherdir.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/otherdir/otherdir.txt @@ -1 +1 @@ -"This is the other dir" +"This is the other dir" diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/subdir/subdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/subdir/subdir.txt index b6115207a2..4506acf413 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/subdir/subdir.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/subdir/subdir.txt @@ -1 +1 @@ -"This is in the sub directory" +"This is in the sub directory" diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test1.txt b/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test1.txt index adc01d1354..8baef1b4ab 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test1.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test1.txt @@ -1 +1 @@ -abc +abc diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test2.txt b/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test2.txt index 3f48e3cdc3..24c5735c3e 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test2.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test2.txt @@ -1 +1 @@ -def +def diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir.txt index 40ee68dccb..b8cb3a8c01 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir.txt @@ -1 +1 @@ -"This is in the test directory" +"This is in the test directory" diff --git a/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir2.txt b/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir2.txt index 051430298a..dccfdc9bcf 100644 --- a/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir2.txt +++ b/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir2.txt @@ -1 +1 @@ -"This is another file in this directory" +"This is another file in this directory" diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp index ab49dea6d8..0b50c391b8 100644 --- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -104,7 +105,7 @@ void tst_QResourceEngine::cleanupTestCase() void tst_QResourceEngine::checkStructure_data() { QTest::addColumn<QString>("pathName"); - QTest::addColumn<QString>("contents"); + QTest::addColumn<QByteArray>("contents"); QTest::addColumn<QStringList>("containedFiles"); QTest::addColumn<QStringList>("containedDirs"); QTest::addColumn<QLocale>("locale"); @@ -134,7 +135,7 @@ void tst_QResourceEngine::checkStructure_data() QTest::newRow("root dir") << QString(":/") - << QString() + << QByteArray() << (QStringList() #if defined(BUILTIN_TESTDATA) << "parentdir.txt" @@ -146,7 +147,7 @@ void tst_QResourceEngine::checkStructure_data() << qlonglong(0); QTest::newRow("secondary root") << QString(":/secondary_root/") - << QString() + << QByteArray() << QStringList() << (QStringList() << QLatin1String("runtime_resource")) << QLocale::c() @@ -157,73 +158,73 @@ void tst_QResourceEngine::checkStructure_data() for(int i = 0; i < roots.size(); ++i) { const QString root = roots.at(i); - QTest::newRow(QString(root + "prefix dir").toLatin1().constData()) << QString(root + "test/abc/123/+++") - << QString() + QTest::addRow("%s prefix dir", qPrintable(root)) << QString(root + "test/abc/123/+++") + << QByteArray() << (QStringList() << QLatin1String("currentdir.txt") << QLatin1String("currentdir2.txt") << QLatin1String("parentdir.txt")) << (QStringList() << QLatin1String("subdir")) << QLocale::c() << qlonglong(0); - QTest::newRow(QString(root + "parent to prefix").toLatin1().constData()) << QString(root + "test/abc/123") - << QString() + QTest::addRow("%s parent to prefix", qPrintable(root)) << QString(root + "test/abc/123") + << QByteArray() << QStringList() << (QStringList() << QLatin1String("+++")) << QLocale::c() << qlonglong(0); - QTest::newRow(QString(root + "two parents prefix").toLatin1().constData()) << QString(root + "test/abc") - << QString() + QTest::addRow("%s two parents prefix", qPrintable(root)) << QString(root + "test/abc") + << QByteArray() << QStringList() << QStringList(QLatin1String("123")) << QLocale::c() << qlonglong(0); - QTest::newRow(QString(root + "test dir ").toLatin1().constData()) << QString(root + "test") - << QString() + QTest::addRow("%s test dir ", qPrintable(root)) << QString(root + "test") + << QByteArray() << (QStringList() << QLatin1String("testdir.txt")) << (QStringList() << QLatin1String("abc") << QLatin1String("test")) << QLocale::c() << qlonglong(0); - QTest::newRow(QString(root + "prefix no slashes").toLatin1().constData()) << QString(root + "withoutslashes") - << QString() + QTest::addRow("%s prefix no slashes", qPrintable(root)) << QString(root + "withoutslashes") + << QByteArray() << QStringList("blahblah.txt") << QStringList() << QLocale::c() << qlonglong(0); - QTest::newRow(QString(root + "other dir").toLatin1().constData()) << QString(root + "otherdir") - << QString() + QTest::addRow("%s other dir", qPrintable(root)) << QString(root + "otherdir") + << QByteArray() << QStringList(QLatin1String("otherdir.txt")) << QStringList() << QLocale::c() << qlonglong(0); - QTest::newRow(QString(root + "alias dir").toLatin1().constData()) << QString(root + "aliasdir") - << QString() + QTest::addRow("%s alias dir", qPrintable(root)) << QString(root + "aliasdir") + << QByteArray() << QStringList(QLatin1String("aliasdir.txt")) << QStringList() << QLocale::c() << qlonglong(0); - QTest::newRow(QString(root + "second test dir").toLatin1().constData()) << QString(root + "test/test") - << QString() + QTest::addRow("%s second test dir", qPrintable(root)) << QString(root + "test/test") + << QByteArray() << (QStringList() << QLatin1String("test1.txt") << QLatin1String("test2.txt")) << QStringList() << QLocale::c() << qlonglong(0); info = QFileInfo(QFINDTESTDATA("testqrc/test/test/test1.txt")); - QTest::newRow(QString(root + "test1 text").toLatin1().constData()) << QString(root + "test/test/test1.txt") - << QString("abc") + QTest::addRow("%s test1 text", qPrintable(root)) << QString(root + "test/test/test1.txt") + << QByteArray("abc\n") << QStringList() << QStringList() << QLocale::c() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/blahblah.txt")); - QTest::newRow(QString(root + "text no slashes").toLatin1().constData()) << QString(root + "withoutslashes/blahblah.txt") - << QString("qwerty") + QTest::addRow("%s text no slashes", qPrintable(root)) << QString(root + "withoutslashes/blahblah.txt") + << QByteArray("qwerty\n") << QStringList() << QStringList() << QLocale::c() @@ -231,96 +232,96 @@ void tst_QResourceEngine::checkStructure_data() info = QFileInfo(QFINDTESTDATA("testqrc/test/test/test2.txt")); - QTest::newRow(QString(root + "test1 text").toLatin1().constData()) << QString(root + "test/test/test2.txt") - << QString("def") + QTest::addRow("%s test1 text", qPrintable(root)) << QString(root + "test/test/test2.txt") + << QByteArray("def\n") << QStringList() << QStringList() << QLocale::c() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/currentdir.txt")); - QTest::newRow(QString(root + "currentdir text").toLatin1().constData()) << QString(root + "test/abc/123/+++/currentdir.txt") - << QString("\"This is the current dir\" ") + QTest::addRow("%s currentdir text", qPrintable(root)) << QString(root + "test/abc/123/+++/currentdir.txt") + << QByteArray("\"This is the current dir\"\n") << QStringList() << QStringList() << QLocale::c() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/currentdir2.txt")); - QTest::newRow(QString(root + "currentdir text2").toLatin1().constData()) << QString(root + "test/abc/123/+++/currentdir2.txt") - << QString("\"This is also the current dir\" ") + QTest::addRow("%s currentdir text2", qPrintable(root)) << QString(root + "test/abc/123/+++/currentdir2.txt") + << QByteArray("\"This is also the current dir\"\n") << QStringList() << QStringList() << QLocale::c() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("parentdir.txt")); - QTest::newRow(QString(root + "parentdir text").toLatin1().constData()) << QString(root + "test/abc/123/+++/parentdir.txt") - << QString("abcdefgihklmnopqrstuvwxyz ") + QTest::addRow("%s parentdir text", qPrintable(root)) << QString(root + "test/abc/123/+++/parentdir.txt") + << QByteArray("abcdefgihklmnopqrstuvwxyz \n") << QStringList() << QStringList() << QLocale::c() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/subdir/subdir.txt")); - QTest::newRow(QString(root + "subdir text").toLatin1().constData()) << QString(root + "test/abc/123/+++/subdir/subdir.txt") - << QString("\"This is in the sub directory\" ") + QTest::addRow("%s subdir text", qPrintable(root)) << QString(root + "test/abc/123/+++/subdir/subdir.txt") + << QByteArray("\"This is in the sub directory\"\n") << QStringList() << QStringList() << QLocale::c() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/test/testdir.txt")); - QTest::newRow(QString(root + "testdir text").toLatin1().constData()) << QString(root + "test/testdir.txt") - << QString("\"This is in the test directory\" ") + QTest::addRow("%s testdir text", qPrintable(root)) << QString(root + "test/testdir.txt") + << QByteArray("\"This is in the test directory\"\n") << QStringList() << QStringList() << QLocale::c() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/otherdir/otherdir.txt")); - QTest::newRow(QString(root + "otherdir text").toLatin1().constData()) << QString(root + "otherdir/otherdir.txt") - << QString("\"This is the other dir\" ") + QTest::addRow("%s otherdir text", qPrintable(root)) << QString(root + "otherdir/otherdir.txt") + << QByteArray("\"This is the other dir\"\n") << QStringList() << QStringList() << QLocale::c() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/test/testdir2.txt")); - QTest::newRow(QString(root + "alias text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") - << QString("\"This is another file in this directory\" ") + QTest::addRow("%s alias text", qPrintable(root)) << QString(root + "aliasdir/aliasdir.txt") + << QByteArray("\"This is another file in this directory\"\n") << QStringList() << QStringList() << QLocale::c() << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/aliasdir.txt")); - QTest::newRow(QString(root + "korean text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") - << QString("\"This is a korean text file\" ") + QTest::addRow("%s korean text", qPrintable(root)) << QString(root + "aliasdir/aliasdir.txt") + << QByteArray("\"This is a korean text file\"\n") << QStringList() << QStringList() << QLocale("ko") << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/aliasdir.txt")); - QTest::newRow(QString(root + "korean text 2").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") - << QString("\"This is a korean text file\" ") + QTest::addRow("%s korean text 2", qPrintable(root)) << QString(root + "aliasdir/aliasdir.txt") + << QByteArray("\"This is a korean text file\"\n") << QStringList() << QStringList() << QLocale("ko_KR") << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/test/german.txt")); - QTest::newRow(QString(root + "german text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") - << QString("Deutsch") + QTest::addRow("%s german text", qPrintable(root)) << QString(root + "aliasdir/aliasdir.txt") + << QByteArray("Deutsch\n") << QStringList() << QStringList() << QLocale("de") << qlonglong(info.size()); info = QFileInfo(QFINDTESTDATA("testqrc/test/german.txt")); - QTest::newRow(QString(root + "german text 2").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") - << QString("Deutsch") + QTest::addRow("%s german text 2", qPrintable(root)) << QString(root + "aliasdir/aliasdir.txt") + << QByteArray("Deutsch\n") << QStringList() << QStringList() << QLocale("de_DE") @@ -329,8 +330,8 @@ void tst_QResourceEngine::checkStructure_data() QFile file(QFINDTESTDATA("testqrc/aliasdir/compressme.txt")); file.open(QFile::ReadOnly); info = QFileInfo(QFINDTESTDATA("testqrc/aliasdir/compressme.txt")); - QTest::newRow(QString(root + "compressed text").toLatin1().constData()) << QString(root + "aliasdir/aliasdir.txt") - << QString(file.readAll()) + QTest::addRow("%s compressed text", qPrintable(root)) << QString(root + "aliasdir/aliasdir.txt") + << file.readAll() << QStringList() << QStringList() << QLocale("de_CH") @@ -341,7 +342,7 @@ void tst_QResourceEngine::checkStructure_data() void tst_QResourceEngine::checkStructure() { QFETCH(QString, pathName); - QFETCH(QString, contents); + QFETCH(QByteArray, contents); QFETCH(QStringList, containedFiles); QFETCH(QStringList, containedDirs); QFETCH(QLocale, locale); @@ -401,8 +402,18 @@ void tst_QResourceEngine::checkStructure() QFile file(pathName); QVERIFY(file.open(QFile::ReadOnly)); - QByteArray ba = file.readAll(); - QVERIFY(QString(ba).startsWith(contents)); + // check contents + QCOMPARE(file.readAll(), contents); + + // check memory map too + uchar *ptr = file.map(0, file.size(), QFile::MapPrivateOption); + QVERIFY2(ptr, qPrintable(file.errorString())); + QByteArray ba = QByteArray::fromRawData(reinterpret_cast<const char *>(ptr), file.size()); + QCOMPARE(ba, contents); + + // check that it is still valid after closing the file + file.close(); + QCOMPARE(ba, contents); } QLocale::setDefault(QLocale::system()); } diff --git a/tests/auto/corelib/io/qsettings/BLACKLIST b/tests/auto/corelib/io/qsettings/BLACKLIST deleted file mode 100644 index 36d68bd918..0000000000 --- a/tests/auto/corelib/io/qsettings/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[isWritable:native] -osx-10.11 diff --git a/tests/auto/corelib/io/qsettings/qsettings.qrc b/tests/auto/corelib/io/qsettings/qsettings.qrc index c664a6f68c..db1d8c663f 100644 --- a/tests/auto/corelib/io/qsettings/qsettings.qrc +++ b/tests/auto/corelib/io/qsettings/qsettings.qrc @@ -7,5 +7,6 @@ <file>resourcefile5.ini</file> <file>resourcefile6.plist</file> <file>bom.ini</file> + <file>withcomments.ini</file> </qresource> </RCC> diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 5357194406..8b69518ef7 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -187,6 +187,7 @@ private slots: void bom(); void embeddedZeroByte_data(); void embeddedZeroByte(); + void spaceAfterComment(); void testXdg(); private: @@ -764,6 +765,34 @@ void tst_QSettings::embeddedZeroByte() } } +void tst_QSettings::spaceAfterComment() +{ + QSettings settings(QFINDTESTDATA("withcomments.ini"), QSettings::IniFormat); + QCOMPARE(settings.status(), QSettings::NoError); + + QStringList groups = settings.childGroups(); + QVERIFY(groups.contains("Regular")); + QVERIFY(groups.contains("WithSpaces")); + QVERIFY(groups.contains("WithTab")); + QVERIFY(groups.contains("SpacedGroup")); + + settings.beginGroup("Regular"); + QCOMPARE(settings.value("bar"), QVariant(2)); + settings.endGroup(); + + settings.beginGroup("WithSpaces"); + QCOMPARE(settings.value("bar"), QVariant(4)); + settings.endGroup(); + + settings.beginGroup("WithTab"); + QCOMPARE(settings.value("bar"), QVariant(6)); + settings.endGroup(); + + settings.beginGroup("SpacedGroup"); + QCOMPARE(settings.value("bar"), QVariant(7)); + settings.endGroup(); +} + void tst_QSettings::testErrorHandling_data() { QTest::addColumn<int>("filePerms"); // -1 means file should not exist diff --git a/tests/auto/corelib/io/qsettings/withcomments.ini b/tests/auto/corelib/io/qsettings/withcomments.ini new file mode 100644 index 0000000000..d2de3a356b --- /dev/null +++ b/tests/auto/corelib/io/qsettings/withcomments.ini @@ -0,0 +1,19 @@ +; -*- conf -*- +; If you edit this file, make sure, that "WithSpaces" has spaces and that +; "WithTab" has one tab + +[Regular] +;bar = 1 +bar = 2 + +[WithSpaces] +;bar = 3 + bar = 4 + +[WithTab] +;bar = 5 + bar = 6 + +; [SpacedGroup] + [SpacedGroup] + bar = 7 diff --git a/tests/auto/corelib/io/qstandardpaths/BLACKLIST b/tests/auto/corelib/io/qstandardpaths/BLACKLIST deleted file mode 100644 index d5ee9650cd..0000000000 --- a/tests/auto/corelib/io/qstandardpaths/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -[testFindExecutable] -# QTBUG-64404 -b2qt 64bit diff --git a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro index 9fd7047405..44b1ce8dd8 100644 --- a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro +++ b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro @@ -5,3 +5,6 @@ INCLUDEPATH += ../../../../shared/ HEADERS += ../../../../shared/emulationdetector.h SOURCES = tst_qstandardpaths.cpp TESTDATA += tst_qstandardpaths.cpp qstandardpaths.pro + +# QTBUG-64404 +boot2qt: DEFINES+=SKIP_FINDEXECUTABLE diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index 5cb130f631..1379c788d1 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -371,6 +371,12 @@ static inline QFileInfo findSh() void tst_qstandardpaths::testFindExecutable_data() { +#ifdef SKIP_FINDEXECUTABLE + // Test needs to be skipped or Q_ASSERT below will cancel the test + // and report FAIL regardless of BLACKLIST contents + QSKIP("QTBUG-64404"); +#endif + QTest::addColumn<QString>("directory"); QTest::addColumn<QString>("needle"); QTest::addColumn<QString>("expected"); diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index dbc3d68e93..67d8c55b04 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -215,7 +215,7 @@ void tst_QTemporaryFile::fileTemplate() if (!fileTemplate.isEmpty()) file.setFileTemplate(fileTemplate); - QCOMPARE(file.open(), true); + QVERIFY2(file.open(), qPrintable(file.errorString())); QString fileName = QFileInfo(file).fileName(); if (prefix.length()) @@ -376,7 +376,7 @@ void tst_QTemporaryFile::io() before.setSecsSinceEpoch(before.toSecsSinceEpoch()); QVERIFY(file.open()); - QVERIFY(file.readLink().isEmpty()); // it's not a link! + QVERIFY(file.symLinkTarget().isEmpty()); // it's not a link! QFile::Permissions perm = file.permissions(); QVERIFY(perm & QFile::ReadOwner); QVERIFY(file.setPermissions(perm)); diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 84af1c255a..9c106c7f58 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -47,6 +47,7 @@ class tst_QUrl : public QObject private slots: void initTestCase(); + void cleanupTestCase(); void effectiveTLDs_data(); void effectiveTLDs(); void getSetCheck(); @@ -182,10 +183,13 @@ private slots: void matches(); void ipv6_zoneId_data(); void ipv6_zoneId(); + void normalizeRemotePaths_data(); + void normalizeRemotePaths(); private: void testThreadingHelper(); + const QString m_currentPath = QDir::currentPath(); QTemporaryDir m_tempDir; }; @@ -194,6 +198,12 @@ void tst_QUrl::initTestCase() QVERIFY2(m_tempDir.isValid(), qPrintable(m_tempDir.errorString())); } +void tst_QUrl::cleanupTestCase() +{ + // Restore working directory changed in fromUserInputWithCwd() + QDir::setCurrent(m_currentPath); +} + // Testing get/set functions void tst_QUrl::getSetCheck() { @@ -323,7 +333,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 +345,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 @@ -3400,6 +3410,21 @@ void tst_QUrl::effectiveTLDs_data() QTest::newRow("yes16") << QUrl::fromEncoded("http://anything.pagespeedmobilizer.com") << ".pagespeedmobilizer.com"; QTest::newRow("yes17") << QUrl::fromEncoded("http://anything.eu-central-1.compute.amazonaws.com") << ".eu-central-1.compute.amazonaws.com"; QTest::newRow("yes18") << QUrl::fromEncoded("http://anything.ltd.hk") << ".ltd.hk"; + QTest::newRow("trentino.it") + << QUrl::fromEncoded("http://any.thing.trentino.it") << ".trentino.it"; + QTest::newRow("net.ni") << QUrl::fromEncoded("http://test.net.ni") << ".net.ni"; + QTest::newRow("dyn.cosidns.de") + << QUrl::fromEncoded("http://test.dyn.cosidns.de") << ".dyn.cosidns.de"; + QTest::newRow("freeddns.org") + << QUrl::fromEncoded("http://test.freeddns.org") << ".freeddns.org"; + QTest::newRow("app.os.stg.fedoraproject.org") + << QUrl::fromEncoded("http://test.app.os.stg.fedoraproject.org") + << ".app.os.stg.fedoraproject.org"; + QTest::newRow("development.run") << QUrl::fromEncoded("http://test.development.run") << ".development.run"; + QTest::newRow("crafting.xyz") << QUrl::fromEncoded("http://test.crafting.xyz") << ".crafting.xyz"; + QTest::newRow("nym.ie") << QUrl::fromEncoded("http://shamus.nym.ie") << ".nym.ie"; + QTest::newRow("vapor.cloud") << QUrl::fromEncoded("http://test.vapor.cloud") << ".vapor.cloud"; + QTest::newRow("official.academy") << QUrl::fromEncoded("http://acredited.official.academy") << ".official.academy"; } void tst_QUrl::effectiveTLDs() @@ -4201,6 +4226,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" diff --git a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp index d839141091..25d392b37e 100644 --- a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp +++ b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp @@ -233,6 +233,14 @@ void tst_QUrlQuery::constructing() query += qMakePair(QString("prosent"), QString("%")); copy.setQueryItems(query); QVERIFY(!copy.isEmpty()); + + QUrlQuery fromList = { + {QString("type"), QString("login")}, + {QString("name"), QString::fromUtf8("åge nissemannsen")}, + {QString("ole&du"), QString::fromUtf8("anne+jørgen=sant")}, + {QString("prosent"), QString("%")} + }; + QCOMPARE(fromList, copy); } void tst_QUrlQuery::addRemove() |