diff options
Diffstat (limited to 'tests/auto/corelib/io')
60 files changed, 1295 insertions, 230 deletions
diff --git a/tests/auto/corelib/io/.prev_CMakeLists.txt b/tests/auto/corelib/io/.prev_CMakeLists.txt new file mode 100644 index 0000000000..5baf4c35de --- /dev/null +++ b/tests/auto/corelib/io/.prev_CMakeLists.txt @@ -0,0 +1,56 @@ +# Generated from io.pro. + +if(QT_FEATURE_private_tests) + add_subdirectory(qabstractfileengine) + add_subdirectory(qfileinfo) + add_subdirectory(qipaddress) + add_subdirectory(qloggingregistry) + add_subdirectory(qurlinternal) +endif() +add_subdirectory(qbuffer) +add_subdirectory(qdataurl) +add_subdirectory(qdiriterator) +add_subdirectory(qfile) +add_subdirectory(largefile) +add_subdirectory(qfileselector) +add_subdirectory(qfilesystemmetadata) +add_subdirectory(qloggingcategory) +add_subdirectory(qnodebug) +add_subdirectory(qsavefile) +add_subdirectory(qstandardpaths) +add_subdirectory(qtemporarydir) +add_subdirectory(qtemporaryfile) +add_subdirectory(qurlquery) +if(TARGET Qt::Concurrent) + add_subdirectory(qdebug) + add_subdirectory(qlockfile) + add_subdirectory(qurl) +endif() +if(NOT ANDROID) + add_subdirectory(qdir) + add_subdirectory(qresourceengine) +endif() +if(QT_FEATURE_private_tests OR UNIX) + add_subdirectory(qfilesystementry) +endif() +if(QT_FEATURE_filesystemwatcher) + add_subdirectory(qfilesystemwatcher) +endif() +if(TARGET Qt::Network) + add_subdirectory(qiodevice) +endif() +if(QT_FEATURE_process AND TARGET Qt::Network AND NOT ANDROID) + add_subdirectory(qprocess) +endif() +if(QT_FEATURE_process) + add_subdirectory(qprocess-noapplication) +endif() +if(QT_FEATURE_processenvironment) + add_subdirectory(qprocessenvironment) +endif() +if(QT_FEATURE_settings AND TARGET Qt::Gui) + add_subdirectory(qsettings) +endif() +if(NOT WINRT) + add_subdirectory(qstorageinfo) +endif() diff --git a/tests/auto/corelib/io/CMakeLists.txt b/tests/auto/corelib/io/CMakeLists.txt new file mode 100644 index 0000000000..cb1246c3a2 --- /dev/null +++ b/tests/auto/corelib/io/CMakeLists.txt @@ -0,0 +1,56 @@ +# Generated from io.pro. + +if(QT_FEATURE_private_tests) + add_subdirectory(qabstractfileengine) + add_subdirectory(qfileinfo) + add_subdirectory(qipaddress) + add_subdirectory(qloggingregistry) + add_subdirectory(qurlinternal) +endif() +add_subdirectory(qbuffer) +add_subdirectory(qdataurl) +add_subdirectory(qdiriterator) +add_subdirectory(qfile) +add_subdirectory(largefile) +# add_subdirectory(qfileselector) # special case needs fixes +add_subdirectory(qfilesystemmetadata) +add_subdirectory(qloggingcategory) +add_subdirectory(qnodebug) +add_subdirectory(qsavefile) +add_subdirectory(qstandardpaths) +add_subdirectory(qtemporarydir) +add_subdirectory(qtemporaryfile) +add_subdirectory(qurlquery) +if(TARGET Qt::Concurrent) + add_subdirectory(qdebug) + add_subdirectory(qlockfile) + add_subdirectory(qurl) +endif() +if(NOT ANDROID) + add_subdirectory(qdir) + # add_subdirectory(qresourceengine) # special case needs fixes +endif() +if(QT_FEATURE_private_tests OR UNIX) + add_subdirectory(qfilesystementry) +endif() +if(QT_FEATURE_filesystemwatcher) + add_subdirectory(qfilesystemwatcher) +endif() +if(TARGET Qt::Network) + add_subdirectory(qiodevice) +endif() +if(QT_FEATURE_process AND TARGET Qt::Network AND NOT ANDROID) + # add_subdirectory(qprocess) # special case needs fixes +endif() +if(QT_FEATURE_process) + add_subdirectory(qprocess-noapplication) +endif() +if(QT_FEATURE_processenvironment) + add_subdirectory(qprocessenvironment) +endif() +if(QT_FEATURE_settings AND TARGET Qt::Gui) + add_subdirectory(qsettings) +endif() +if(NOT WINRT) + add_subdirectory(qstorageinfo) +endif() diff --git a/tests/auto/corelib/io/largefile/CMakeLists.txt b/tests/auto/corelib/io/largefile/CMakeLists.txt new file mode 100644 index 0000000000..cb1eba8526 --- /dev/null +++ b/tests/auto/corelib/io/largefile/CMakeLists.txt @@ -0,0 +1,13 @@ +# Generated from largefile.pro. + +##################################################################### +## tst_largefile Test: +##################################################################### + +add_qt_test(tst_largefile + SOURCES + ../../../../shared/emulationdetector.h + tst_largefile.cpp + INCLUDE_DIRECTORIES + ../../../../shared +) diff --git a/tests/auto/corelib/io/qabstractfileengine/CMakeLists.txt b/tests/auto/corelib/io/qabstractfileengine/CMakeLists.txt new file mode 100644 index 0000000000..1b7a11d657 --- /dev/null +++ b/tests/auto/corelib/io/qabstractfileengine/CMakeLists.txt @@ -0,0 +1,25 @@ +# Generated from qabstractfileengine.pro. + +##################################################################### +## tst_qabstractfileengine Test: +##################################################################### + +add_qt_test(tst_qabstractfileengine + SOURCES + tst_qabstractfileengine.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate +) + +# Resources: +set(qabstractfileengine_resource_files + "resources/" +) + +add_qt_resource(tst_qabstractfileengine "qabstractfileengine" + PREFIX + "/tst_qabstractfileengine/" + FILES + ${qabstractfileengine_resource_files} +) + diff --git a/tests/auto/corelib/io/qbuffer/CMakeLists.txt b/tests/auto/corelib/io/qbuffer/CMakeLists.txt new file mode 100644 index 0000000000..40502dd004 --- /dev/null +++ b/tests/auto/corelib/io/qbuffer/CMakeLists.txt @@ -0,0 +1,10 @@ +# Generated from qbuffer.pro. + +##################################################################### +## tst_qbuffer Test: +##################################################################### + +add_qt_test(tst_qbuffer + SOURCES + tst_qbuffer.cpp +) diff --git a/tests/auto/corelib/io/qdataurl/CMakeLists.txt b/tests/auto/corelib/io/qdataurl/CMakeLists.txt new file mode 100644 index 0000000000..507852a11e --- /dev/null +++ b/tests/auto/corelib/io/qdataurl/CMakeLists.txt @@ -0,0 +1,12 @@ +# Generated from qdataurl.pro. + +##################################################################### +## tst_qdataurl Test: +##################################################################### + +add_qt_test(tst_qdataurl + SOURCES + tst_qdataurl.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate +) diff --git a/tests/auto/corelib/io/qdebug/CMakeLists.txt b/tests/auto/corelib/io/qdebug/CMakeLists.txt new file mode 100644 index 0000000000..d7fa4fb7cd --- /dev/null +++ b/tests/auto/corelib/io/qdebug/CMakeLists.txt @@ -0,0 +1,12 @@ +# Generated from qdebug.pro. + +##################################################################### +## tst_qdebug Test: +##################################################################### + +add_qt_test(tst_qdebug + SOURCES + tst_qdebug.cpp + PUBLIC_LIBRARIES + Qt::Concurrent +) diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp index 584e66a7db..4260accfd0 100644 --- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp +++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp @@ -66,6 +66,7 @@ private slots: void resetFormat() const; void defaultMessagehandler() const; void threadSafety() const; + void toString() const; }; void tst_QDebug::assignment() const @@ -740,6 +741,28 @@ void tst_QDebug::threadSafety() const } } +void tst_QDebug::toString() const +{ + // By reference. + { + MyPoint point(3, 4); + QString expectedString; + QDebug stream(&expectedString); + stream.nospace() << point; + QCOMPARE(QDebug::toString(point), expectedString); + } + + // By pointer. + { + QObject qobject; + qobject.setObjectName("test"); + QString expectedString; + QDebug stream(&expectedString); + stream.nospace() << &qobject; + QCOMPARE(QDebug::toString(&qobject), expectedString); + } +} + // Should compile: instentiation of unrelated operator<< should not cause cause compilation // error in QDebug operators (QTBUG-47375) class TestClassA {}; diff --git a/tests/auto/corelib/io/qdir/CMakeLists.txt b/tests/auto/corelib/io/qdir/CMakeLists.txt new file mode 100644 index 0000000000..f77185bc2b --- /dev/null +++ b/tests/auto/corelib/io/qdir/CMakeLists.txt @@ -0,0 +1,99 @@ +# Generated from qdir.pro. + +##################################################################### +## tst_qdir Test: +##################################################################### + +# Collect test data +list(APPEND test_data "testdir") +list(APPEND test_data "testData") +list(APPEND test_data "searchdir") +list(APPEND test_data "resources") +list(APPEND test_data "entrylist") +list(APPEND test_data "types") +list(APPEND test_data "tst_qdir.cpp") + +add_qt_test(tst_qdir + SOURCES + tst_qdir.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate + TESTDATA ${test_data} +) + +# Resources: +set(qdir_resource_files + "resources/entryList/" +) + +add_qt_resource(tst_qdir "qdir" + PREFIX + "/tst_qdir/" + FILES + ${qdir_resource_files} +) + + +## Scopes: +##################################################################### + +#### Keys ignored in scope 2:.:.:qdir.pro:IOS: +# QMAKE_INFO_PLIST = "Info.plist" + +extend_target(tst_qdir CONDITION CONFIG___contains___builtin_testdata + DEFINES + BUILTIN_TESTDATA +) + +if(ANDROID AND NOT ANDROID_EMBEDDED) + # Resources: + set(android_testdata_resource_files + "entrylist/directory/dummy" + "entrylist/file" + "resources/entryList/file1.data" + "resources/entryList/file2.data" + "resources/entryList/file3.data" + "resources/entryList/file4.nothing" + "searchdir/subdir1/picker.png" + "searchdir/subdir2/picker.png" + "testData/empty" + "testdir/dir/qdir.pro" + "testdir/dir/qrc_qdir.cpp" + "testdir/dir/tmp/empty" + "testdir/dir/tst_qdir.cpp" + "testdir/spaces/foo. bar" + "testdir/spaces/foo.bar" + "tst_qdir.cpp" + "types/a" + "types/a.a" + "types/a.b" + "types/a.c" + "types/b" + "types/b.a" + "types/b.b" + "types/b.c" + "types/c" + "types/c.a" + "types/c.b" + "types/c.c" + "types/d.a/dummy" + "types/d.b/dummy" + "types/d.c/dummy" + "types/d/dummy" + "types/e.a/dummy" + "types/e.b/dummy" + "types/e.c/dummy" + "types/e/dummy" + "types/f.a/dummy" + "types/f.b/dummy" + "types/f.c/dummy" + "types/f/dummy" + ) + + add_qt_resource(tst_qdir "android_testdata" + PREFIX + "/android_testdata" + FILES + ${android_testdata_resource_files} + ) +endif() diff --git a/tests/auto/corelib/io/qdir/qdir.pro b/tests/auto/corelib/io/qdir/qdir.pro index a8b106e250..f6ff0d0421 100644 --- a/tests/auto/corelib/io/qdir/qdir.pro +++ b/tests/auto/corelib/io/qdir/qdir.pro @@ -12,3 +12,5 @@ contains(CONFIG, builtin_testdata): DEFINES += BUILTIN_TESTDATA android:!android-embedded { RESOURCES += android_testdata.qrc } + +qtConfig(c++17): CONFIG += c++17 diff --git a/tests/auto/corelib/io/qdir/testdir/dir/CMakeLists.txt b/tests/auto/corelib/io/qdir/testdir/dir/CMakeLists.txt new file mode 100644 index 0000000000..e50fcb60ca --- /dev/null +++ b/tests/auto/corelib/io/qdir/testdir/dir/CMakeLists.txt @@ -0,0 +1,13 @@ +# Generated from qdir.pro. + +##################################################################### +## qdir Binary: +##################################################################### + +add_qt_executable(qdir + GUI + DEFINES + QT_DISABLE_DEPRECATED_BEFORE=0 + PUBLIC_LIBRARIES + Qt::Gui +) diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 1162fb31e4..5462a63fab 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -216,6 +216,8 @@ private slots: void emptyDir(); void nonEmptyDir(); + void stdfilesystem(); + private: #ifdef BUILTIN_TESTDATA QString m_dataPath; @@ -2403,6 +2405,45 @@ void tst_QDir::nonEmptyDir() QVERIFY(!dir.isEmpty()); } +void tst_QDir::stdfilesystem() +{ +#if QT_CONFIG(cxx17_filesystem) + namespace fs = std::filesystem; + fs::path path("."); + QDir dir(path); + QCOMPARE(dir, QDir(QStringLiteral("."))); + + path = path / "testdir" / "dir"; + dir.setPath(path); + + QCOMPARE(dir, QDir(QStringLiteral("./testdir/dir"))); + + auto fsPath = dir.filesystemPath(); + QCOMPARE(QString::fromStdU16String(fsPath.u16string()), dir.path()); + fsPath = dir.filesystemAbsolutePath(); + QCOMPARE(QString::fromStdU16String(fsPath.u16string()), dir.absolutePath()); + fsPath = dir.filesystemCanonicalPath(); + QCOMPARE(QString::fromStdU16String(fsPath.u16string()), dir.canonicalPath()); + + QDir emptyPath(fs::path{}); + QCOMPARE(emptyPath, QDir(QStringLiteral("."))); + + { + // Test QDir ctor with filter and sorting reversed + QDir filteredDir(fs::path{"."} / "searchdir", "subdir*", + QDir::SortFlag::Reversed, QDir::Filter::Dirs); + QStringList entries = filteredDir.entryList(); + QCOMPARE(entries, QStringList() << "subdir2" << "subdir1"); + QCOMPARE(filteredDir.sorting(), QDir::SortFlag::Reversed); + QCOMPARE(filteredDir.filter(), QDir::Filter::Dirs); + QCOMPARE(filteredDir.nameFilters().length(), 1); + QCOMPARE(filteredDir.nameFilters().first(), "subdir*"); + } +#else + QSKIP("Not supported"); +#endif +} + QTEST_MAIN(tst_QDir) #include "tst_qdir.moc" diff --git a/tests/auto/corelib/io/qdiriterator/CMakeLists.txt b/tests/auto/corelib/io/qdiriterator/CMakeLists.txt new file mode 100644 index 0000000000..2e120b4621 --- /dev/null +++ b/tests/auto/corelib/io/qdiriterator/CMakeLists.txt @@ -0,0 +1,38 @@ +# Generated from qdiriterator.pro. + +##################################################################### +## tst_qdiriterator Test: +##################################################################### + +# Collect test data +list(APPEND test_data "entrylist") + +add_qt_test(tst_qdiriterator + SOURCES + tst_qdiriterator.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate + TESTDATA ${test_data} +) + +# Resources: +set(qdiriterator_resource_files + "entrylist/directory/dummy" + "entrylist/file" +) + +add_qt_resource(tst_qdiriterator "qdiriterator" + PREFIX + "/testdata/" + FILES + ${qdiriterator_resource_files} +) + + +## Scopes: +##################################################################### + +extend_target(tst_qdiriterator CONDITION CONFIG___contains___builtin_testdata + DEFINES + BUILTIN_TESTDATA +) diff --git a/tests/auto/corelib/io/qfile/.prev_CMakeLists.txt b/tests/auto/corelib/io/qfile/.prev_CMakeLists.txt new file mode 100644 index 0000000000..b976754629 --- /dev/null +++ b/tests/auto/corelib/io/qfile/.prev_CMakeLists.txt @@ -0,0 +1,89 @@ +# Generated from qfile.pro. + +##################################################################### +## tst_qfile Test: +##################################################################### + +# Collect test data +list(APPEND test_data "BLACKLIST") +list(APPEND test_data "dosfile.txt") +list(APPEND test_data "noendofline.txt") +list(APPEND test_data "testfile.txt") +list(APPEND test_data "testlog.txt") +list(APPEND test_data "two.dots.file") +list(APPEND test_data "tst_qfile.cpp") +list(APPEND test_data "Makefile") +list(APPEND test_data "forCopying.txt") +list(APPEND test_data "forRenaming.txt") +list(APPEND test_data "resources/file1.ext1") + +add_qt_test(tst_qfile + SOURCES + ../../../../shared/emulationdetector.h + tst_qfile.cpp + INCLUDE_DIRECTORIES + ../../../../shared + LIBRARIES + Qt::CorePrivate + TESTDATA ${test_data} +) + +# Resources: +set(qfile_resource_files + "resources/" +) + +add_qt_resource(tst_qfile "qfile" + PREFIX + "/tst_qfileinfo/" + FILES + ${qfile_resource_files} +) +set(rename-fallback_resource_files + "rename-fallback.qrc" +) + +add_qt_resource(tst_qfile "rename-fallback" + PREFIX + "/" + FILES + ${rename-fallback_resource_files} +) +set(copy-fallback_resource_files + "copy-fallback.qrc" +) + +add_qt_resource(tst_qfile "copy-fallback" + PREFIX + "/" + FILES + ${copy-fallback_resource_files} +) + + +## Scopes: +##################################################################### + +extend_target(tst_qfile CONDITION TARGET Qt::Network + PUBLIC_LIBRARIES + Qt::Network +) + +extend_target(tst_qfile CONDITION NOT TARGET Qt::Network + DEFINES + QT_NO_NETWORK +) + +extend_target(tst_qfile CONDITION CONFIG___contains___builtin_testdata + DEFINES + BUILTIN_TESTDATA +) + +extend_target(tst_qfile CONDITION WIN32 AND NOT WINRT + PUBLIC_LIBRARIES + ole32 + uuid +) +if(NOT WINRT) + add_subdirectory(stdinprocess) +endif() diff --git a/tests/auto/corelib/io/qfile/CMakeLists.txt b/tests/auto/corelib/io/qfile/CMakeLists.txt new file mode 100644 index 0000000000..03b648d76f --- /dev/null +++ b/tests/auto/corelib/io/qfile/CMakeLists.txt @@ -0,0 +1,89 @@ +# Generated from qfile.pro. + +##################################################################### +## tst_qfile Test: +##################################################################### + +# Collect test data +# list(APPEND test_data "BLACKLIST") # special case remove +list(APPEND test_data "dosfile.txt") +list(APPEND test_data "noendofline.txt") +list(APPEND test_data "testfile.txt") +list(APPEND test_data "testlog.txt") +list(APPEND test_data "two.dots.file") +list(APPEND test_data "tst_qfile.cpp") +# list(APPEND test_data "Makefile") # special case remove +list(APPEND test_data "forCopying.txt") +list(APPEND test_data "forRenaming.txt") +list(APPEND test_data "resources/file1.ext1") + +add_qt_test(tst_qfile + SOURCES + ../../../../shared/emulationdetector.h + tst_qfile.cpp + INCLUDE_DIRECTORIES + ../../../../shared + LIBRARIES + Qt::CorePrivate + TESTDATA ${test_data} +) + +# Resources: +set(qfile_resource_files + "resources/" +) + +add_qt_resource(tst_qfile "qfile" + PREFIX + "/tst_qfileinfo/" + FILES + ${qfile_resource_files} +) +set(rename-fallback_resource_files + "rename-fallback.qrc" +) + +add_qt_resource(tst_qfile "rename-fallback" + PREFIX + "/" + FILES + ${rename-fallback_resource_files} +) +set(copy-fallback_resource_files + "copy-fallback.qrc" +) + +add_qt_resource(tst_qfile "copy-fallback" + PREFIX + "/" + FILES + ${copy-fallback_resource_files} +) + + +## Scopes: +##################################################################### + +extend_target(tst_qfile CONDITION TARGET Qt::Network + PUBLIC_LIBRARIES + Qt::Network +) + +extend_target(tst_qfile CONDITION NOT TARGET Qt::Network + DEFINES + QT_NO_NETWORK +) + +extend_target(tst_qfile CONDITION CONFIG___contains___builtin_testdata + DEFINES + BUILTIN_TESTDATA +) + +extend_target(tst_qfile CONDITION WIN32 AND NOT WINRT + PUBLIC_LIBRARIES + ole32 + uuid +) +if(NOT WINRT) + add_subdirectory(stdinprocess) +endif() diff --git a/tests/auto/corelib/io/qfile/stdinprocess/CMakeLists.txt b/tests/auto/corelib/io/qfile/stdinprocess/CMakeLists.txt new file mode 100644 index 0000000000..994c2fc268 --- /dev/null +++ b/tests/auto/corelib/io/qfile/stdinprocess/CMakeLists.txt @@ -0,0 +1,10 @@ +# Generated from stdinprocess.pro. + +##################################################################### +## stdinprocess_helper Binary: +##################################################################### + +add_qt_test_helper(stdinprocess_helper + SOURCES + main.cpp +) diff --git a/tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro b/tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro index 512da8939b..bc48a9fb39 100644 --- a/tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro +++ b/tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro @@ -2,3 +2,4 @@ SOURCES += main.cpp QT = core load(qt_test_helper) +CONFIG += c++17 diff --git a/tests/auto/corelib/io/qfile/test.pro b/tests/auto/corelib/io/qfile/test.pro index 7a2767bf3c..47b778bc33 100644 --- a/tests/auto/corelib/io/qfile/test.pro +++ b/tests/auto/corelib/io/qfile/test.pro @@ -24,3 +24,5 @@ TESTDATA += \ resources/file1.ext1 win32:!winrt: QMAKE_USE += ole32 uuid + +CONFIG += c++17 diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 350bff0652..b8f0d29078 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -282,6 +282,8 @@ private slots: void moveToTrash_data(); void moveToTrash(); + void stdfilesystem(); + private: #ifdef BUILTIN_TESTDATA QSharedPointer<QTemporaryDir> m_dataDir; @@ -3812,5 +3814,54 @@ void tst_QFile::moveToTrash() } } +void tst_QFile::stdfilesystem() +{ +#if QT_CONFIG(cxx17_filesystem) + namespace fs = std::filesystem; + auto toFSPath = [](const QFile &file) { return fs::path(file.fileName().toStdU16String()); }; + fs::path path { "./path" }; + QFile file(path); + QCOMPARE(toFSPath(file), path); + + QCOMPARE(path, file.filesystemFileName()); + + { + QFile parentedFile(path, this); + QCOMPARE(file.fileName(), parentedFile.fileName()); + QCOMPARE(parentedFile.parent(), this); + } + + path = path / "filename"; + file.setFileName(path); + QCOMPARE(toFSPath(file), path); + + path = "test-file"; + file.setFileName(path); + QVERIFY(file.open(QIODevice::WriteOnly)); + file.close(); + + path = "tile-fest"; + QVERIFY(file.rename(path)); + QVERIFY(fs::exists(path)); + fs::path linkfile { "test-link" }; + QVERIFY(file.link(linkfile)); + QVERIFY(fs::exists(linkfile)); + + fs::path copyfile { "copy-file" }; + QVERIFY(file.copy(copyfile)); + QVERIFY(fs::exists(copyfile)); + + QFileDevice::Permissions p = QFile::permissions(path); + QVERIFY(p.testFlag(QFile::WriteUser) || p.testFlag(QFile::WriteOwner)); // some we know for sure + if (p.testFlag(QFile::ReadUser)) + p.setFlag(QFile::ReadUser, false); + else if (p.testFlag(QFile::ReadOwner)) + p.setFlag(QFile::ReadOwner, false); + QVERIFY(QFile::setPermissions(path, p)); +#else + QSKIP("Not supported"); +#endif +} + QTEST_MAIN(tst_QFile) #include "tst_qfile.moc" diff --git a/tests/auto/corelib/io/qfileinfo/CMakeLists.txt b/tests/auto/corelib/io/qfileinfo/CMakeLists.txt new file mode 100644 index 0000000000..a6cf3a38f1 --- /dev/null +++ b/tests/auto/corelib/io/qfileinfo/CMakeLists.txt @@ -0,0 +1,47 @@ +# Generated from qfileinfo.pro. + +##################################################################### +## tst_qfileinfo Test: +##################################################################### + +add_qt_test(tst_qfileinfo + SOURCES + tst_qfileinfo.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate +) + +# Resources: +set(qfileinfo_resource_files + "resources/" +) + +add_qt_resource(tst_qfileinfo "qfileinfo" + PREFIX + "/tst_qfileinfo/" + FILES + ${qfileinfo_resource_files} +) +set(testdata_resource_files + "resources/file1" + "resources/file1.ext1" + "resources/file1.ext1.ext2" + "tst_qfileinfo.cpp" +) + +add_qt_resource(tst_qfileinfo "testdata" + PREFIX + "/testdata" + FILES + ${testdata_resource_files} +) + + +## Scopes: +##################################################################### + +extend_target(tst_qfileinfo CONDITION WIN32 AND NOT WINRT + PUBLIC_LIBRARIES + advapi32 + netapi32 +) diff --git a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro index d181d16a3e..af764f3679 100644 --- a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro +++ b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro @@ -6,3 +6,6 @@ RESOURCES += qfileinfo.qrc \ testdata.qrc win32:!winrt: QMAKE_USE += advapi32 netapi32 + +# for std::filesystem tests +qtConfig(c++17): CONFIG += c++17 diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 09ef0ea44f..a1f9ca0b87 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -116,7 +116,7 @@ static DWORD createSymbolicLink(const QString &symLinkName, const QString &targe reinterpret_cast<const wchar_t*>(nativeTarget.utf16()), flags) == FALSE) { result = GetLastError(); QTextStream(errorMessage) << "CreateSymbolicLink(" << nativeSymLinkName << ", " - << nativeTarget << ", 0x" << hex << flags << dec << ") failed with error " << result + << nativeTarget << ", 0x" << Qt::hex << flags << Qt::dec << ") failed with error " << result << ": " << qt_error_string(int(result)); } return result; @@ -287,6 +287,8 @@ private slots: void invalidState(); void nonExistingFile(); + void stdfilesystem(); + private: const QString m_currentDir; QString m_sourceFile; @@ -2269,6 +2271,97 @@ void tst_QFileInfo::nonExistingFile() stateCheck(info, dirname, filename); } +void tst_QFileInfo::stdfilesystem() +{ +#if QT_CONFIG(cxx17_filesystem) + + namespace fs = std::filesystem; + + // Verify constructing with fs::path leads to valid objects + { + // We compare using absoluteFilePath since QFileInfo::operator== ends up using + // canonicalFilePath which evaluates to empty-string for non-existent paths causing + // these tests to always succeed. +#define COMPARE_CONSTRUCTION(filepath) \ + QCOMPARE(QFileInfo(fs::path(filepath)).absoluteFilePath(), \ + QFileInfo(QString::fromLocal8Bit(filepath)).absoluteFilePath()); \ + QCOMPARE(QFileInfo(base, fs::path(filepath)).absoluteFilePath(), \ + QFileInfo(base, QString::fromLocal8Bit(filepath)).absoluteFilePath()) + + QDir base{ "../" }; // Used for the QFileInfo(QDir, <path>) ctor + + COMPARE_CONSTRUCTION("./file"); + +#ifdef Q_OS_WIN32 + COMPARE_CONSTRUCTION("C:\\path\\to\\file.txt"); + COMPARE_CONSTRUCTION("x:\\path/to\\file.txt"); + COMPARE_CONSTRUCTION("D:/path/TO/file.txt"); + COMPARE_CONSTRUCTION("//sharename/folder/file.txt"); +#endif + COMPARE_CONSTRUCTION("/path/TO/file.txt"); + COMPARE_CONSTRUCTION("./path/TO/file.txt"); + COMPARE_CONSTRUCTION("../file.txt"); + COMPARE_CONSTRUCTION("./filæ.txt"); + +#undef COMPARE_CONSTRUCTION + { + // One proper comparison with operator== for each ctor + QFile file(QStringLiteral("./filesystem_test_file.txt")); + if (!file.open(QFile::NewOnly)) + QVERIFY(file.exists()); + file.close(); + + QFileInfo pinfo{ fs::path{ "./filesystem_test_file.txt" } }; + QFileInfo info{ QStringLiteral("./filesystem_test_file.txt") }; + QCOMPARE(pinfo, info); + } + + { + // And once more for QFileInfo(QDir, <path>) + const QString &subdir = QStringLiteral("./filesystem_test_dir/"); + base = QDir(QStringLiteral(".")); + if (!base.exists(subdir)) + QVERIFY(base.mkdir(subdir)); + base.cd(subdir); + QFile file{ base.filePath(QStringLiteral("./filesystem_test_file.txt")) }; + if (!file.open(QFile::NewOnly)) + QVERIFY(file.exists()); + file.close(); + QFileInfo pinfo{ base, fs::path{ "filesystem_test_file.txt" } }; + QFileInfo info{ base, QStringLiteral("filesystem_test_file.txt") }; + QCOMPARE(pinfo, info); + } + } + + // Verify that functions returning path all point to the same place + { +#define COMPARE_PATHS(actual, expected) \ + QCOMPARE(QString::fromStdU16String(actual.u16string()), expected) + + QFile file(QStringLiteral("./orig")); + if (!file.open(QFile::NewOnly)) + QVERIFY(file.exists()); + file.close(); + + QFileInfo info{ QStringLiteral("./orig") }; + COMPARE_PATHS(info.filesystemPath(), info.path()); + COMPARE_PATHS(info.filesystemAbsolutePath(), info.absolutePath()); + COMPARE_PATHS(info.filesystemCanonicalPath(), info.canonicalPath()); + COMPARE_PATHS(info.filesystemFilePath(), info.filePath()); + COMPARE_PATHS(info.filesystemAbsoluteFilePath(), info.absoluteFilePath()); + COMPARE_PATHS(info.filesystemCanonicalFilePath(), info.canonicalFilePath()); + + QVERIFY(file.link(QStringLiteral("./filesystem_test_symlink.lnk"))); + info = QFileInfo{ "./filesystem_test_symlink.lnk" }; + + COMPARE_PATHS(info.filesystemSymLinkTarget(), info.symLinkTarget()); +#undef COMPARE_PATHS + } + +#else + QSKIP("Not supported"); +#endif +} QTEST_MAIN(tst_QFileInfo) #include "tst_qfileinfo.moc" diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test5 b/tests/auto/corelib/io/qfileselector/platforms/+mac/test5 deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+mac/test5 +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test4 b/tests/auto/corelib/io/qfileselector/platforms/+osx/test4 deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+osx/test4 +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+ios/test index e69de29bb2..e69de29bb2 100644 --- a/tests/auto/corelib/io/qfileselector/platforms/+mac/test +++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+ios/test diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+macos/test index e69de29bb2..e69de29bb2 100644 --- a/tests/auto/corelib/io/qfileselector/platforms/+osx/test +++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+macos/test diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.qrc b/tests/auto/corelib/io/qfileselector/qfileselector.qrc index 54b2e0a0e2..f3b3ede575 100644 --- a/tests/auto/corelib/io/qfileselector/qfileselector.qrc +++ b/tests/auto/corelib/io/qfileselector/qfileselector.qrc @@ -1,65 +1,51 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/"> - <file>extras/test</file> - <file>extras/test2</file> - <file>extras/+custom1/test</file> - <file>extras/+custom1/test3</file> - <file>extras/+custom2/test</file> - <file>extras/+custom3/test</file> - <file>extras/+custom3/+custom2/test</file> - <file>extras/+custom3/+custom4/test</file> - <file>extras/+custom3/+custom5/test</file> - <file>extras/+custom5/+custom3/test</file> - - <!-- platforms/test: deepest possible selection --> - <file>platforms/test</file> - <file>platforms/+unix/+android/test</file> - <file>platforms/+unix/+darwin/+mac/+ios/test</file> - <file>platforms/+unix/+darwin/+mac/+osx/+macos/test</file> - <file>platforms/+unix/+darwin/+mac/+osx/test</file> - <file>platforms/+unix/+darwin/+mac/test</file> - <file>platforms/+unix/+darwin/test</file> - <file>platforms/+unix/+haiku/test</file> - <file>platforms/+unix/+linux/test</file> - <file>platforms/+unix/+qnx/test</file> - <file>platforms/+unix/test</file> - <file>platforms/+windows/+wince/test</file> - <file>platforms/+windows/+winnt/test</file> - <file>platforms/+windows/+winrt/test</file> - <file>platforms/+windows/test</file> - <file>platforms/+android/test</file> - <file>platforms/+ios/test</file> - <file>platforms/+macos/test</file> - <file>platforms/+osx/test</file> - <file>platforms/+darwin/test</file> - <file>platforms/+mac/test</file> - <file>platforms/+haiku/test</file> - <file>platforms/+linux/test</file> - <file>platforms/+qnx/test</file> - <file>platforms/+wince/test</file> - <file>platforms/+winrt/test</file> - - <!-- platforms/test2: shallow selection for the deepest selector --> - <file>platforms/test2</file> - <file>platforms/+android/test2</file> - <file>platforms/+ios/test2</file> - <file>platforms/+macos/test2</file> - <file>platforms/+haiku/test2</file> - <file>platforms/+linux/test2</file> - <file>platforms/+qnx/test2</file> - <file>platforms/+wince/test2</file> - <file>platforms/+winnt/test2</file> - <file>platforms/+winrt/test2</file> - - <!-- platforms/test3: selection for the family only --> - <file>platforms/test3</file> - <file>platforms/+windows/test3</file> - <file>platforms/+unix/test3</file> - - <!-- platforms/test4 and 5: special cases for macOS --> - <file>platforms/test4</file> - <file>platforms/+osx/test4</file> - <file>platforms/test5</file> - <file>platforms/+mac/test5</file> -</qresource> +<RCC> + <qresource prefix="/"> + <file>extras/test</file> + <file>extras/test2</file> + <file>extras/+custom1/test</file> + <file>extras/+custom1/test3</file> + <file>extras/+custom2/test</file> + <file>extras/+custom3/test</file> + <file>extras/+custom3/+custom2/test</file> + <file>extras/+custom3/+custom4/test</file> + <file>extras/+custom3/+custom5/test</file> + <file>extras/+custom5/+custom3/test</file> + <file>platforms/test</file> + <file>platforms/+unix/+android/test</file> + <file>platforms/+unix/+darwin/test</file> + <file>platforms/+unix/+haiku/test</file> + <file>platforms/+unix/+linux/test</file> + <file>platforms/+unix/+qnx/test</file> + <file>platforms/+unix/test</file> + <file>platforms/+windows/+wince/test</file> + <file>platforms/+windows/+winnt/test</file> + <file>platforms/+windows/+winrt/test</file> + <file>platforms/+windows/test</file> + <file>platforms/+android/test</file> + <file>platforms/+ios/test</file> + <file>platforms/+macos/test</file> + <file>platforms/+darwin/test</file> + <file>platforms/+haiku/test</file> + <file>platforms/+linux/test</file> + <file>platforms/+qnx/test</file> + <file>platforms/+wince/test</file> + <file>platforms/+winrt/test</file> + <file>platforms/test2</file> + <file>platforms/+android/test2</file> + <file>platforms/+ios/test2</file> + <file>platforms/+macos/test2</file> + <file>platforms/+haiku/test2</file> + <file>platforms/+linux/test2</file> + <file>platforms/+qnx/test2</file> + <file>platforms/+wince/test2</file> + <file>platforms/+winnt/test2</file> + <file>platforms/+winrt/test2</file> + <file>platforms/test3</file> + <file>platforms/+windows/test3</file> + <file>platforms/+unix/test3</file> + <file>platforms/test4</file> + <file>platforms/test5</file> + <file>platforms/+unix/+darwin/+macos/test</file> + <file>platforms/+unix/+darwin/+ios/test</file> + </qresource> </RCC> diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp index 11b1fdaeeb..bac7a69e0f 100644 --- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp +++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp @@ -126,14 +126,6 @@ void tst_QFileSelector::basicTest_data() QTest::newRow("platform3") << QString(":/platforms/test3") << QStringList() << expectedPlatform3File; -#ifdef Q_OS_MACOS - // special case for compatibility code - QTest::newRow("osx-compat") << QString(":/platforms/test4") << QStringList() - << ":/platforms/+osx/test4"; - QTest::newRow("mac-compat") << QString(":/platforms/test5") << QStringList() - << ":/platforms/+mac/test5"; -#endif - QString resourceTestPath(":/extras/test"); QString custom1("custom1"); QTest::newRow("custom1-noselector") << resourceTestPath << QStringList() diff --git a/tests/auto/corelib/io/qfilesystementry/CMakeLists.txt b/tests/auto/corelib/io/qfilesystementry/CMakeLists.txt new file mode 100644 index 0000000000..e989315bdd --- /dev/null +++ b/tests/auto/corelib/io/qfilesystementry/CMakeLists.txt @@ -0,0 +1,13 @@ +# Generated from qfilesystementry.pro. + +##################################################################### +## tst_qfilesystementry Test: +##################################################################### + +add_qt_test(tst_qfilesystementry + SOURCES + ${QT_SOURCE_TREE}/src/corelib/io/qfilesystementry.cpp ${QT_SOURCE_TREE}/src/corelib/io/qfilesystementry_p.h + tst_qfilesystementry.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate +) diff --git a/tests/auto/corelib/io/qfilesystemmetadata/CMakeLists.txt b/tests/auto/corelib/io/qfilesystemmetadata/CMakeLists.txt new file mode 100644 index 0000000000..a237090a48 --- /dev/null +++ b/tests/auto/corelib/io/qfilesystemmetadata/CMakeLists.txt @@ -0,0 +1,12 @@ +# Generated from qfilesystemmetadata.pro. + +##################################################################### +## tst_qfilesystemmetadata Test: +##################################################################### + +add_qt_test(tst_qfilesystemmetadata + SOURCES + tst_qfilesystemmetadata.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate +) diff --git a/tests/auto/corelib/io/qfilesystemwatcher/CMakeLists.txt b/tests/auto/corelib/io/qfilesystemwatcher/CMakeLists.txt new file mode 100644 index 0000000000..1dfef5acab --- /dev/null +++ b/tests/auto/corelib/io/qfilesystemwatcher/CMakeLists.txt @@ -0,0 +1,10 @@ +# Generated from qfilesystemwatcher.pro. + +##################################################################### +## tst_qfilesystemwatcher Test: +##################################################################### + +add_qt_test(tst_qfilesystemwatcher + SOURCES + tst_qfilesystemwatcher.cpp +) diff --git a/tests/auto/corelib/io/qiodevice/CMakeLists.txt b/tests/auto/corelib/io/qiodevice/CMakeLists.txt new file mode 100644 index 0000000000..6b7833ac22 --- /dev/null +++ b/tests/auto/corelib/io/qiodevice/CMakeLists.txt @@ -0,0 +1,36 @@ +# Generated from qiodevice.pro. + +##################################################################### +## tst_qiodevice Test: +##################################################################### + +# Collect test data +list(APPEND test_data "tst_qiodevice.cpp") + +add_qt_test(tst_qiodevice + SOURCES + tst_qiodevice.cpp + PUBLIC_LIBRARIES + Qt::Network + TESTDATA ${test_data} +) + +#### Keys ignored in scope 1:.:.:qiodevice.pro:<TRUE>: +# MOC_DIR = "tmp" + +## Scopes: +##################################################################### + +if(ANDROID AND NOT ANDROID_EMBEDDED) + # Resources: + set(android_testdata_resource_files + "tst_qiodevice.cpp" + ) + + add_qt_resource(tst_qiodevice "android_testdata" + PREFIX + "/" + FILES + ${android_testdata_resource_files} + ) +endif() diff --git a/tests/auto/corelib/io/qipaddress/CMakeLists.txt b/tests/auto/corelib/io/qipaddress/CMakeLists.txt new file mode 100644 index 0000000000..821cd58bdb --- /dev/null +++ b/tests/auto/corelib/io/qipaddress/CMakeLists.txt @@ -0,0 +1,12 @@ +# Generated from qipaddress.pro. + +##################################################################### +## tst_qipaddress Test: +##################################################################### + +add_qt_test(tst_qipaddress + SOURCES + tst_qipaddress.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate +) diff --git a/tests/auto/corelib/io/qlockfile/CMakeLists.txt b/tests/auto/corelib/io/qlockfile/CMakeLists.txt new file mode 100644 index 0000000000..52bd7bfd8f --- /dev/null +++ b/tests/auto/corelib/io/qlockfile/CMakeLists.txt @@ -0,0 +1,23 @@ +# Generated from qlockfile.pro. + +##################################################################### +## tst_qlockfile Test: +##################################################################### + +add_qt_test(tst_qlockfile + SOURCES + tst_qlockfile.cpp + LIBRARIES + Qt::CorePrivate + PUBLIC_LIBRARIES + Qt::Concurrent +) + +## Scopes: +##################################################################### + +extend_target(tst_qlockfile CONDITION WIN32 AND NOT WINRT + PUBLIC_LIBRARIES + advapi32 +) +add_subdirectory(qlockfiletesthelper) diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/.prev_CMakeLists.txt b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/.prev_CMakeLists.txt new file mode 100644 index 0000000000..755dc7cf39 --- /dev/null +++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/.prev_CMakeLists.txt @@ -0,0 +1,11 @@ +# Generated from qlockfile_test_helper.pro. + +##################################################################### +## qlockfile_test_helper Binary: +##################################################################### + +add_qt_executable(qlockfile_test_helper + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" + SOURCES + qlockfile_test_helper.cpp +) diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/CMakeLists.txt b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/CMakeLists.txt new file mode 100644 index 0000000000..b515037d56 --- /dev/null +++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/CMakeLists.txt @@ -0,0 +1,12 @@ +# Generated from qlockfile_test_helper.pro. + +##################################################################### +## qlockfile_test_helper Binary: +##################################################################### + +add_qt_test_helper(qlockfile_test_helper # special case + OVERRIDE_OUTPUT_DIRECTORY # special case + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" + SOURCES + qlockfile_test_helper.cpp +) diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp index 4969e417f4..1d79d0dd1f 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp @@ -163,13 +163,13 @@ void tst_QLockFile::lockOutOtherThread() QVERIFY(lockFile.lock()); // Other thread can't acquire lock - QFuture<QLockFile::LockError> ret = QtConcurrent::run<QLockFile::LockError>(tryLockFromThread, fileName); + auto ret = QtConcurrent::run(tryLockFromThread, fileName); QCOMPARE(ret.result(), QLockFile::LockFailedError); lockFile.unlock(); // Now other thread can acquire lock - QFuture<QLockFile::LockError> ret2 = QtConcurrent::run<QLockFile::LockError>(tryLockFromThread, fileName); + auto ret2 = QtConcurrent::run(tryLockFromThread, fileName); QCOMPARE(ret2.result(), QLockFile::NoError); } @@ -186,13 +186,13 @@ static QLockFile::LockError lockFromThread(const QString &fileName) void tst_QLockFile::raceWithOtherThread() { const QString fileName = dir.path() + "/raceWithOtherThread"; - QFuture<QLockFile::LockError> ret = QtConcurrent::run<QLockFile::LockError>(lockFromThread, fileName); - QFuture<QLockFile::LockError> ret2 = QtConcurrent::run<QLockFile::LockError>(lockFromThread, fileName); + auto ret = QtConcurrent::run(lockFromThread, fileName); + auto ret2 = QtConcurrent::run(lockFromThread, fileName); QCOMPARE(ret.result(), QLockFile::NoError); QCOMPARE(ret2.result(), QLockFile::NoError); } -static bool lockFromThread(const QString &fileName, int sleepMs, QSemaphore *semThreadReady, QSemaphore *semMainThreadDone) +static bool lockFromThreadAndWait(const QString &fileName, int sleepMs, QSemaphore *semThreadReady, QSemaphore *semMainThreadDone) { QLockFile lockFile(fileName); if (!lockFile.lock()) { @@ -233,7 +233,7 @@ void tst_QLockFile::waitForLock() QLockFile lockFile(fileName); QSemaphore semThreadReady, semMainThreadDone; // Lock file from a thread - QFuture<bool> ret = QtConcurrent::run<bool>(lockFromThread, fileName, threadSleepMs, &semThreadReady, &semMainThreadDone); + auto ret = QtConcurrent::run(lockFromThreadAndWait, fileName, threadSleepMs, &semThreadReady, &semMainThreadDone); semThreadReady.acquire(); if (releaseEarly) // let the thread release the lock after threadSleepMs @@ -410,7 +410,7 @@ void tst_QLockFile::staleLockRace() QThreadPool::globalInstance()->setMaxThreadCount(10); QFutureSynchronizer<QString> synchronizer; for (int i = 0; i < 8; ++i) - synchronizer.addFuture(QtConcurrent::run<QString>(tryStaleLockFromThread, fileName)); + synchronizer.addFuture(QtConcurrent::run(tryStaleLockFromThread, fileName)); synchronizer.waitForFinished(); foreach (const QFuture<QString> &future, synchronizer.futures()) QVERIFY2(future.result().isEmpty(), qPrintable(future.result())); diff --git a/tests/auto/corelib/io/qloggingcategory/CMakeLists.txt b/tests/auto/corelib/io/qloggingcategory/CMakeLists.txt new file mode 100644 index 0000000000..9e1eaf3e4a --- /dev/null +++ b/tests/auto/corelib/io/qloggingcategory/CMakeLists.txt @@ -0,0 +1,15 @@ +# Generated from qloggingcategory.pro. + +##################################################################### +## tst_qloggingcategory Test: +##################################################################### + +add_qt_test(tst_qloggingcategory + SOURCES + tst_qloggingcategory.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate +) + +#### Keys ignored in scope 1:.:.:qloggingcategory.pro:<TRUE>: +# TEMPLATE = "app" diff --git a/tests/auto/corelib/io/qloggingregistry/CMakeLists.txt b/tests/auto/corelib/io/qloggingregistry/CMakeLists.txt new file mode 100644 index 0000000000..3c42af9d01 --- /dev/null +++ b/tests/auto/corelib/io/qloggingregistry/CMakeLists.txt @@ -0,0 +1,36 @@ +# Generated from qloggingregistry.pro. + +##################################################################### +## tst_qloggingregistry Test: +##################################################################### + +# Collect test data +list(APPEND test_data "qtlogging.ini") + +add_qt_test(tst_qloggingregistry + SOURCES + tst_qloggingregistry.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate + TESTDATA ${test_data} +) + +#### Keys ignored in scope 1:.:.:qloggingregistry.pro:<TRUE>: +# TEMPLATE = "app" + +## Scopes: +##################################################################### + +if(ANDROID AND NOT ANDROID_EMBEDDED) + # Resources: + set(android_testdata_resource_files + "qtlogging.ini" + ) + + add_qt_resource(tst_qloggingregistry "android_testdata" + PREFIX + "/" + FILES + ${android_testdata_resource_files} + ) +endif() diff --git a/tests/auto/corelib/io/qnodebug/CMakeLists.txt b/tests/auto/corelib/io/qnodebug/CMakeLists.txt new file mode 100644 index 0000000000..4d1b57e222 --- /dev/null +++ b/tests/auto/corelib/io/qnodebug/CMakeLists.txt @@ -0,0 +1,10 @@ +# Generated from qnodebug.pro. + +##################################################################### +## tst_qnodebug Test: +##################################################################### + +add_qt_test(tst_qnodebug + SOURCES + tst_qnodebug.cpp +) diff --git a/tests/auto/corelib/io/qprocess-noapplication/CMakeLists.txt b/tests/auto/corelib/io/qprocess-noapplication/CMakeLists.txt new file mode 100644 index 0000000000..ce6195fc37 --- /dev/null +++ b/tests/auto/corelib/io/qprocess-noapplication/CMakeLists.txt @@ -0,0 +1,10 @@ +# Generated from qprocess-noapplication.pro. + +##################################################################### +## qprocess-noapplication Test: +##################################################################### + +add_qt_test(qprocess-noapplication + SOURCES + tst_qprocessnoapplication.cpp +) diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 9495631c23..bd2bba8a88 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -48,8 +48,6 @@ #include <stdlib.h> -typedef void (QProcess::*QProcessFinishedSignal1)(int); -typedef void (QProcess::*QProcessFinishedSignal2)(int, QProcess::ExitStatus); typedef void (QProcess::*QProcessErrorSignal)(QProcess::ProcessError); class tst_QProcess : public QObject @@ -159,7 +157,6 @@ private slots: void failToStartEmptyArgs(); #if QT_DEPRECATED_SINCE(5, 13) - void crashTest2_deprecated(); void restartProcessDeadlock_deprecated(); void waitForReadyReadInAReadyReadSlot_deprecated(); void finishProcessBeforeReadingDone_deprecated(); @@ -402,7 +399,7 @@ void tst_QProcess::crashTest() qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus"); QSignalSpy spy(process.data(), &QProcess::errorOccurred); - QSignalSpy spy2(process.data(), static_cast<QProcessFinishedSignal2>(&QProcess::finished)); + QSignalSpy spy2(process.data(), &QProcess::finished); QVERIFY(spy.isValid()); QVERIFY(spy2.isValid()); @@ -445,13 +442,12 @@ void tst_QProcess::crashTest2() qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus"); QSignalSpy spy(&process, static_cast<QProcessErrorSignal>(&QProcess::errorOccurred)); - QSignalSpy spy2(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished)); + QSignalSpy spy2(&process, &QProcess::finished); QVERIFY(spy.isValid()); QVERIFY(spy2.isValid()); - QObject::connect(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished), - this, &tst_QProcess::exitLoopSlot); + QObject::connect(&process, &QProcess::finished, this, &tst_QProcess::exitLoopSlot); QTestEventLoop::instance().enterLoop(30); if (QTestEventLoop::instance().timeout()) @@ -776,15 +772,14 @@ void tst_QProcess::restartProcessDeadlock() // process in the finished() connected slot causes a deadlock // because of the way QProcessManager uses its locks. QProcess process; - connect(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished), - this, &tst_QProcess::restartProcess); + connect(&process, &QProcess::finished, this, &tst_QProcess::restartProcess); process.start("testProcessEcho/testProcessEcho"); QCOMPARE(process.write("", 1), qlonglong(1)); QVERIFY(process.waitForFinished(5000)); - QObject::disconnect(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished), nullptr, nullptr); + QObject::disconnect(&process, &QProcess::finished, nullptr, nullptr); QCOMPARE(process.write("", 1), qlonglong(1)); QVERIFY(process.waitForFinished(5000)); @@ -983,8 +978,7 @@ public: SoftExitProcess(int n) : waitedForFinished(false), n(n), killing(false) { - connect(this, static_cast<QProcessFinishedSignal2>(&QProcess::finished), - this, &SoftExitProcess::finishedSlot); + connect(this, &QProcess::finished, this, &SoftExitProcess::finishedSlot); switch (n) { case 0: @@ -1229,8 +1223,7 @@ protected: exitCode = 90210; QProcess process; - connect(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished), - this, &TestThread::catchExitCode, Qt::DirectConnection); + connect(&process, &QProcess::finished, this, &TestThread::catchExitCode, Qt::DirectConnection); process.start("testProcessEcho/testProcessEcho"); @@ -1303,8 +1296,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot() { QProcess process; connect(&process, &QIODevice::readyRead, this, &tst_QProcess::waitForReadyReadInAReadyReadSlotSlot); - connect(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished), - this, &tst_QProcess::exitLoopSlot); + connect(&process, &QProcess::finished, this, &tst_QProcess::exitLoopSlot); bytesAvailable = 0; process.start("testProcessEcho/testProcessEcho"); @@ -1542,7 +1534,7 @@ void tst_QProcess::failToStart() QProcess process; QSignalSpy stateSpy(&process, &QProcess::stateChanged); QSignalSpy errorSpy(&process, &QProcess::errorOccurred); - QSignalSpy finishedSpy(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished)); + QSignalSpy finishedSpy(&process, &QProcess::finished); QVERIFY(stateSpy.isValid()); QVERIFY(errorSpy.isValid()); QVERIFY(finishedSpy.isValid()); @@ -1551,10 +1543,6 @@ void tst_QProcess::failToStart() QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error)); QVERIFY(errorSpy2.isValid()); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QSignalSpy finishedSpy2(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished)); - QVERIFY(finishedSpy2.isValid()); -#endif // OS X and HP-UX have a really low default process limit (~100), so spawning // to many processes here will cause test failures later on. @@ -1600,9 +1588,6 @@ void tst_QProcess::failToStart() #if QT_DEPRECATED_SINCE(5, 6) QCOMPARE(errorSpy2.count(), j * attempts + i + 1); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QCOMPARE(finishedSpy2.count(), 0); -#endif int it = j * attempts + i + 1; @@ -1621,7 +1606,7 @@ void tst_QProcess::failToStartWithWait() QProcess process; QEventLoop loop; QSignalSpy errorSpy(&process, &QProcess::errorOccurred); - QSignalSpy finishedSpy(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished)); + QSignalSpy finishedSpy(&process, &QProcess::finished); QVERIFY(errorSpy.isValid()); QVERIFY(finishedSpy.isValid()); @@ -1629,10 +1614,6 @@ void tst_QProcess::failToStartWithWait() QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error)); QVERIFY(errorSpy2.isValid()); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QSignalSpy finishedSpy2(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished)); - QVERIFY(finishedSpy2.isValid()); -#endif for (int i = 0; i < 50; ++i) { process.start("/blurp", QStringList() << "-v" << "-debug"); @@ -1644,10 +1625,6 @@ void tst_QProcess::failToStartWithWait() #if QT_DEPRECATED_SINCE(5, 6) QCOMPARE(errorSpy2.count(), i + 1); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QCOMPARE(finishedSpy2.count(), 0); -#endif - } } @@ -1659,7 +1636,7 @@ void tst_QProcess::failToStartWithEventLoop() QProcess process; QEventLoop loop; QSignalSpy errorSpy(&process, &QProcess::errorOccurred); - QSignalSpy finishedSpy(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished)); + QSignalSpy finishedSpy(&process, &QProcess::finished); QVERIFY(errorSpy.isValid()); QVERIFY(finishedSpy.isValid()); @@ -1667,10 +1644,6 @@ void tst_QProcess::failToStartWithEventLoop() QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error)); QVERIFY(errorSpy2.isValid()); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QSignalSpy finishedSpy2(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished)); - QVERIFY(finishedSpy2.isValid()); -#endif // The error signal may be emitted before start() returns connect(&process, &QProcess::errorOccurred, &loop, &QEventLoop::quit, Qt::QueuedConnection); @@ -1687,9 +1660,6 @@ void tst_QProcess::failToStartWithEventLoop() #if QT_DEPRECATED_SINCE(5, 6) QCOMPARE(errorSpy2.count(), i + 1); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QCOMPARE(finishedSpy2.count(), 0); -#endif } } @@ -1964,7 +1934,7 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess() QProcess process; QSignalSpy errorSpy(&process, &QProcess::errorOccurred); - QSignalSpy finishedSpy(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished)); + QSignalSpy finishedSpy(&process, &QProcess::finished); QVERIFY(errorSpy.isValid()); QVERIFY(finishedSpy.isValid()); @@ -1972,10 +1942,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess() QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error)); QVERIFY(errorSpy2.isValid()); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QSignalSpy finishedSpy1(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished)); - QVERIFY(finishedSpy1.isValid()); -#endif QVERIFY(!process.waitForReadyRead()); // used to crash process.start("doesntexist"); @@ -1987,9 +1953,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess() QCOMPARE(errorSpy2.count(), 1); QCOMPARE(errorSpy2.at(0).at(0).toInt(), 0); #endif -#if QT_DEPRECATED_SINCE(5, 13) - QCOMPARE(finishedSpy1.count(), 0); -#endif } void tst_QProcess::setStandardInputFile() @@ -2442,7 +2405,7 @@ void tst_QProcess::onlyOneStartedSignal() QProcess process; QSignalSpy spyStarted(&process, &QProcess::started); - QSignalSpy spyFinished(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished)); + QSignalSpy spyFinished(&process, &QProcess::finished); QVERIFY(spyStarted.isValid()); QVERIFY(spyFinished.isValid()); @@ -2485,8 +2448,7 @@ void tst_QProcess::finishProcessBeforeReadingDone() QProcess process; BlockOnReadStdOut blocker(&process); QEventLoop loop; - connect(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished), - &loop, &QEventLoop::quit); + connect(&process, &QProcess::finished, &loop, &QEventLoop::quit); process.start("testProcessOutput/testProcessOutput"); QVERIFY(process.waitForStarted()); loop.exec(); @@ -2633,52 +2595,20 @@ void tst_QProcess::processEventsInAReadyReadSlot() #if QT_DEPRECATED_SINCE(5, 13) -void tst_QProcess::crashTest2_deprecated() -{ - QProcess process; - process.start("testProcessCrash/testProcessCrash"); - QVERIFY(process.waitForStarted(5000)); - - qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError"); - qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus"); - - QSignalSpy spy(&process, static_cast<QProcessErrorSignal>(&QProcess::errorOccurred)); - QSignalSpy spy2(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished)); - - QVERIFY(spy.isValid()); - QVERIFY(spy2.isValid()); - - QObject::connect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished), - this, &tst_QProcess::exitLoopSlot); - - QTestEventLoop::instance().enterLoop(30); - if (QTestEventLoop::instance().timeout()) - QFAIL("Failed to detect crash : operation timed out"); - - QCOMPARE(spy.count(), 1); - QCOMPARE(*static_cast<const QProcess::ProcessError *>(spy.at(0).at(0).constData()), QProcess::Crashed); - - QCOMPARE(spy2.count(), 1); - QCOMPARE(*static_cast<const QProcess::ExitStatus *>(spy2.at(0).at(1).constData()), QProcess::CrashExit); - - QCOMPARE(process.exitStatus(), QProcess::CrashExit); -} - void tst_QProcess::restartProcessDeadlock_deprecated() { // The purpose of this test is to detect whether restarting a // process in the finished() connected slot causes a deadlock // because of the way QProcessManager uses its locks. QProcess process; - connect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished), - this, &tst_QProcess::restartProcess); + connect(&process, &QProcess::finished, this, &tst_QProcess::restartProcess); process.start("testProcessEcho/testProcessEcho"); QCOMPARE(process.write("", 1), qlonglong(1)); QVERIFY(process.waitForFinished(5000)); - QObject::disconnect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished), nullptr, nullptr); + QObject::disconnect(&process, &QProcess::finished, nullptr, nullptr); QCOMPARE(process.write("", 1), qlonglong(1)); QVERIFY(process.waitForFinished(5000)); @@ -2690,8 +2620,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot_deprecated() { QProcess process; connect(&process, &QIODevice::readyRead, this, &tst_QProcess::waitForReadyReadInAReadyReadSlotSlot); - connect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished), - this, &tst_QProcess::exitLoopSlot); + connect(&process, &QProcess::finished, this, &tst_QProcess::exitLoopSlot); bytesAvailable = 0; process.start("testProcessEcho/testProcessEcho"); @@ -2717,8 +2646,7 @@ void tst_QProcess::finishProcessBeforeReadingDone_deprecated() QProcess process; BlockOnReadStdOut blocker(&process); QEventLoop loop; - connect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished), - &loop, &QEventLoop::quit); + connect(&process, &QProcess::finished, &loop, &QEventLoop::quit); process.start("testProcessOutput/testProcessOutput"); QVERIFY(process.waitForStarted()); loop.exec(); diff --git a/tests/auto/corelib/io/qprocessenvironment/CMakeLists.txt b/tests/auto/corelib/io/qprocessenvironment/CMakeLists.txt new file mode 100644 index 0000000000..dbcd8c8172 --- /dev/null +++ b/tests/auto/corelib/io/qprocessenvironment/CMakeLists.txt @@ -0,0 +1,10 @@ +# Generated from qprocessenvironment.pro. + +##################################################################### +## tst_qprocessenvironment Test: +##################################################################### + +add_qt_test(tst_qprocessenvironment + SOURCES + tst_qprocessenvironment.cpp +) diff --git a/tests/auto/corelib/io/qsavefile/CMakeLists.txt b/tests/auto/corelib/io/qsavefile/CMakeLists.txt new file mode 100644 index 0000000000..aec5da1f99 --- /dev/null +++ b/tests/auto/corelib/io/qsavefile/CMakeLists.txt @@ -0,0 +1,14 @@ +# Generated from qsavefile.pro. + +##################################################################### +## tst_qsavefile Test: +##################################################################### + +# Collect test data +list(APPEND test_data "tst_qsavefile.cpp") + +add_qt_test(tst_qsavefile + SOURCES + tst_qsavefile.cpp + TESTDATA ${test_data} +) diff --git a/tests/auto/corelib/io/qsettings/CMakeLists.txt b/tests/auto/corelib/io/qsettings/CMakeLists.txt new file mode 100644 index 0000000000..161b03b041 --- /dev/null +++ b/tests/auto/corelib/io/qsettings/CMakeLists.txt @@ -0,0 +1,50 @@ +# Generated from qsettings.pro. + +##################################################################### +## tst_qsettings Test: +##################################################################### + +add_qt_test(tst_qsettings + SOURCES + tst_qsettings.cpp + DEFINES + QT_DISABLE_DEPRECATED_BEFORE=0 + INCLUDE_DIRECTORIES + ../../kernel/qmetatype + PUBLIC_LIBRARIES + Qt::CorePrivate + Qt::Gui +) + +# Resources: +set(qsettings_resource_files + "bom.ini" + "resourcefile.ini" + "resourcefile2.ini" + "resourcefile3.ini" + "resourcefile4.ini" + "resourcefile5.ini" + "resourcefile6.plist" + "withcomments.ini" +) + +add_qt_resource(tst_qsettings "qsettings" + PREFIX + "/" + FILES + ${qsettings_resource_files} +) + + +## Scopes: +##################################################################### + +extend_target(tst_qsettings CONDITION MSVC + PUBLIC_LIBRARIES + advapi32 +) + +extend_target(tst_qsettings CONDITION APPLE + PUBLIC_LIBRARIES + ${FWCoreFoundation} +) diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 57bab115bb..427ce1a424 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -39,7 +39,9 @@ #include <QtCore/QDir> #include <QtCore/QThread> #include <QtCore/QSysInfo> -#include <QtGui/QKeySequence> +#if QT_CONFIG(shortcut) +# include <QtGui/QKeySequence> +#endif #include <QtCore> #include <QtGui> @@ -1364,6 +1366,7 @@ void tst_QSettings::testVariantTypes() dt.setOffsetFromUtc(3600); testVal("key14", dt, QDateTime, DateTime); +#if QT_CONFIG(shortcut) // We store key sequences as strings instead of binary variant blob, for improved // readability in the resulting format. if (format >= QSettings::InvalidFormat) { @@ -1373,6 +1376,7 @@ void tst_QSettings::testVariantTypes() QKeySequence(Qt::ControlModifier + Qt::Key_F1).toString(QKeySequence::NativeText), QString, String); } +#endif // QT_CONFIG(shortcut) #undef testVal } diff --git a/tests/auto/corelib/io/qstandardpaths/CMakeLists.txt b/tests/auto/corelib/io/qstandardpaths/CMakeLists.txt new file mode 100644 index 0000000000..5bceaf1d77 --- /dev/null +++ b/tests/auto/corelib/io/qstandardpaths/CMakeLists.txt @@ -0,0 +1,26 @@ +# Generated from qstandardpaths.pro. + +##################################################################### +## tst_qstandardpaths Test: +##################################################################### + +# Collect test data +list(APPEND test_data "tst_qstandardpaths.cpp") +list(APPEND test_data "qstandardpaths.pro") + +add_qt_test(tst_qstandardpaths + SOURCES + ../../../../shared/emulationdetector.h + tst_qstandardpaths.cpp + INCLUDE_DIRECTORIES + ../../../../shared + TESTDATA ${test_data} +) + +## Scopes: +##################################################################### + +extend_target(tst_qstandardpaths CONDITION boot2qt + DEFINES + SKIP_FINDEXECUTABLE +) diff --git a/tests/auto/corelib/io/qstorageinfo/CMakeLists.txt b/tests/auto/corelib/io/qstorageinfo/CMakeLists.txt new file mode 100644 index 0000000000..08af02dc6c --- /dev/null +++ b/tests/auto/corelib/io/qstorageinfo/CMakeLists.txt @@ -0,0 +1,12 @@ +# Generated from qstorageinfo.pro. + +##################################################################### +## tst_qstorageinfo Test: +##################################################################### + +add_qt_test(tst_qstorageinfo + SOURCES + tst_qstorageinfo.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate +) diff --git a/tests/auto/corelib/io/qtemporarydir/CMakeLists.txt b/tests/auto/corelib/io/qtemporarydir/CMakeLists.txt new file mode 100644 index 0000000000..855495bbbb --- /dev/null +++ b/tests/auto/corelib/io/qtemporarydir/CMakeLists.txt @@ -0,0 +1,15 @@ +# Generated from qtemporarydir.pro. + +##################################################################### +## tst_qtemporarydir Test: +##################################################################### + +add_qt_test(tst_qtemporarydir + SOURCES + ../../../../shared/emulationdetector.h + tst_qtemporarydir.cpp + INCLUDE_DIRECTORIES + ../../../../shared + PUBLIC_LIBRARIES + Qt::TestPrivate +) diff --git a/tests/auto/corelib/io/qtemporaryfile/CMakeLists.txt b/tests/auto/corelib/io/qtemporaryfile/CMakeLists.txt new file mode 100644 index 0000000000..af614552cc --- /dev/null +++ b/tests/auto/corelib/io/qtemporaryfile/CMakeLists.txt @@ -0,0 +1,47 @@ +# Generated from qtemporaryfile.pro. + +##################################################################### +## tst_qtemporaryfile Test: +##################################################################### + +# Collect test data +list(APPEND test_data "tst_qtemporaryfile.cpp") + +add_qt_test(tst_qtemporaryfile + SOURCES + tst_qtemporaryfile.cpp + PUBLIC_LIBRARIES + Qt::TestPrivate + TESTDATA ${test_data} +) + +# Resources: +set(qtemporaryfile_resource_files + "resources/test.txt" +) + +add_qt_resource(tst_qtemporaryfile "qtemporaryfile" + PREFIX + "/" + FILES + ${qtemporaryfile_resource_files} +) + + +## Scopes: +##################################################################### + +if(ANDROID AND NOT ANDROID_EMBEDDED) + # Resources: + set(android_testdata_resource_files + "resources/test.txt" + "tst_qtemporaryfile.cpp" + ) + + add_qt_resource(tst_qtemporaryfile "android_testdata" + PREFIX + "/android_testdata" + FILES + ${android_testdata_resource_files} + ) +endif() diff --git a/tests/auto/corelib/io/qurl/CMakeLists.txt b/tests/auto/corelib/io/qurl/CMakeLists.txt new file mode 100644 index 0000000000..c23ad27cfc --- /dev/null +++ b/tests/auto/corelib/io/qurl/CMakeLists.txt @@ -0,0 +1,20 @@ +# Generated from qurl.pro. + +##################################################################### +## tst_qurl Test: +##################################################################### + +add_qt_test(tst_qurl + SOURCES + tst_qurl.cpp + PUBLIC_LIBRARIES + Qt::Concurrent +) + +## Scopes: +##################################################################### + +extend_target(tst_qurl CONDITION APPLE + SOURCES + tst_qurl_mac.mm +) diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index ef4325d2ea..31d1de4234 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -48,8 +48,6 @@ class tst_QUrl : public QObject private slots: void initTestCase(); void cleanupTestCase(); - void effectiveTLDs_data(); - void effectiveTLDs(); void getSetCheck(); void constructing(); void hashInPath(); @@ -3387,61 +3385,6 @@ void tst_QUrl::acceptEmptyAuthoritySegments() QCOMPARE(QUrl(file_uni_bar, QUrl::StrictMode).toString(), file_triple_bar); } -void tst_QUrl::effectiveTLDs_data() -{ - // See also: tst_QNetworkCookieJar::setCookiesFromUrl(). - // in tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp - QTest::addColumn<QUrl>("domain"); - QTest::addColumn<QString>("TLD"); - // TODO: autogenerate test-cases from: - // https://raw.githubusercontent.com/publicsuffix/list/master/tests/test_psl.txt - // checkPublicSuffix(domain, tail) appears in the list if - // either tail is null and domain is public or - // tail is the "registrable" part of domain; i.e. its minimal non-public tail. - - QTest::newRow("yes0") << QUrl::fromEncoded("http://test.co.uk") << ".co.uk"; - QTest::newRow("yes1") << QUrl::fromEncoded("http://test.com") << ".com"; - QTest::newRow("yes2") << QUrl::fromEncoded("http://www.test.de") << ".de"; - QTest::newRow("yes3") << QUrl::fromEncoded("http://test.ulm.museum") << ".ulm.museum"; - QTest::newRow("yes4") << QUrl::fromEncoded("http://www.com.krodsherad.no") << ".krodsherad.no"; - QTest::newRow("yes5") << QUrl::fromEncoded("http://www.co.uk.1.bg") << ".1.bg"; - QTest::newRow("yes6") << QUrl::fromEncoded("http://www.com.com.cn") << ".com.cn"; - QTest::newRow("yes7") << QUrl::fromEncoded("http://www.test.org.ws") << ".org.ws"; - QTest::newRow("yes9") << QUrl::fromEncoded("http://www.com.co.uk.wallonie.museum") << ".wallonie.museum"; - QTest::newRow("yes10") << QUrl::fromEncoded("http://www.com.evje-og-hornnes.no") << ".evje-og-hornnes.no"; - QTest::newRow("yes11") << QUrl::fromEncoded("http://www.bla.kamijima.ehime.jp") << ".kamijima.ehime.jp"; - QTest::newRow("yes12") << QUrl::fromEncoded("http://www.bla.kakuda.miyagi.jp") << ".kakuda.miyagi.jp"; - QTest::newRow("yes13") << QUrl::fromEncoded("http://mypage.betainabox.com") << ".betainabox.com"; - QTest::newRow("yes14") << QUrl::fromEncoded("http://mypage.rhcloud.com") << ".rhcloud.com"; - QTest::newRow("yes15") << QUrl::fromEncoded("http://mypage.int.az") << ".int.az"; - 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() -{ - QFETCH(QUrl, domain); - QFETCH(QString, TLD); - QCOMPARE(domain.topLevelDomain(QUrl::PrettyDecoded), TLD); - QCOMPARE(domain.topLevelDomain(QUrl::FullyDecoded), TLD); -} - void tst_QUrl::lowercasesScheme() { QUrl url; @@ -4124,7 +4067,7 @@ void tst_QUrl::testThreading() QThreadPool::globalInstance()->setMaxThreadCount(100); QFutureSynchronizer<void> sync; for (int i = 0; i < 100; ++i) - sync.addFuture(QtConcurrent::run(this, &tst_QUrl::testThreadingHelper)); + sync.addFuture(QtConcurrent::run(&tst_QUrl::testThreadingHelper, this)); sync.waitForFinished(); delete s_urlStorage; } diff --git a/tests/auto/corelib/io/qurlinternal/CMakeLists.txt b/tests/auto/corelib/io/qurlinternal/CMakeLists.txt new file mode 100644 index 0000000000..5ad3bc1919 --- /dev/null +++ b/tests/auto/corelib/io/qurlinternal/CMakeLists.txt @@ -0,0 +1,20 @@ +# Generated from qurlinternal.pro. + +if(NOT QT_FEATURE_private_tests) + return() +endif() + +##################################################################### +## tst_qurlinternal Test: +##################################################################### + +add_qt_test(tst_qurlinternal + SOURCES + ../../codecs/utf8/utf8data.cpp + tst_qurlinternal.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate +) + +#### Keys ignored in scope 1:.:.:qurlinternal.pro:<TRUE>: +# _REQUIREMENTS = "qtConfig(private_tests)" diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp index 5c6e633749..f644979c06 100644 --- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp +++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp @@ -30,7 +30,6 @@ #include <QtCore/QUrl> #include <QtTest/QtTest> -#include "private/qtldurl_p.h" #include "private/qurl_p.h" // For testsuites diff --git a/tests/auto/corelib/io/qurlquery/CMakeLists.txt b/tests/auto/corelib/io/qurlquery/CMakeLists.txt new file mode 100644 index 0000000000..8a0cc54aeb --- /dev/null +++ b/tests/auto/corelib/io/qurlquery/CMakeLists.txt @@ -0,0 +1,14 @@ +# Generated from qurlquery.pro. + +##################################################################### +## tst_qurlquery Test: +##################################################################### + +add_qt_test(tst_qurlquery + SOURCES + tst_qurlquery.cpp + DEFINES + SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\" + PUBLIC_LIBRARIES + Qt::CorePrivate +) |