diff options
Diffstat (limited to 'tests/auto')
123 files changed, 738 insertions, 85 deletions
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt new file mode 100644 index 0000000000..88f4e3b20b --- /dev/null +++ b/tests/auto/CMakeLists.txt @@ -0,0 +1,25 @@ +add_subdirectory(aggregation) +add_subdirectory(algorithm) +add_subdirectory(changeset) +add_subdirectory(cplusplus) +add_subdirectory(debugger) +add_subdirectory(diff) +add_subdirectory(environment) +add_subdirectory(extensionsystem) +add_subdirectory(externaltool) +add_subdirectory(filesearch) +add_subdirectory(json) +add_subdirectory(languageserverprotocol) +add_subdirectory(mapreduce) +add_subdirectory(pointeralgorithm) +add_subdirectory(profilewriter) +add_subdirectory(qml) +add_subdirectory(qtcprocess) +add_subdirectory(runextensions) +add_subdirectory(sdktool) +add_subdirectory(ssh) +add_subdirectory(toolchaincache) +add_subdirectory(tracing) +add_subdirectory(treeviewfind) +add_subdirectory(utils) +# add_subdirectory(valgrind) diff --git a/tests/auto/aggregation/CMakeLists.txt b/tests/auto/aggregation/CMakeLists.txt new file mode 100644 index 0000000000..1827d6b111 --- /dev/null +++ b/tests/auto/aggregation/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_aggregation + DEPENDS Aggregation Qt5::Core + SOURCES tst_aggregate.cpp +) diff --git a/tests/auto/algorithm/CMakeLists.txt b/tests/auto/algorithm/CMakeLists.txt new file mode 100644 index 0000000000..f856b34836 --- /dev/null +++ b/tests/auto/algorithm/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_algorithm + INCLUDES "${CMAKE_SOURCE_DIR}/src/libs" + SOURCES tst_algorithm.cpp +) diff --git a/tests/auto/changeset/CMakeLists.txt b/tests/auto/changeset/CMakeLists.txt new file mode 100644 index 0000000000..50adbd176b --- /dev/null +++ b/tests/auto/changeset/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_changeset + DEPENDS Utils + SOURCES tst_changeset.cpp +) diff --git a/tests/auto/cplusplus/CMakeLists.txt b/tests/auto/cplusplus/CMakeLists.txt new file mode 100644 index 0000000000..1c85a988cc --- /dev/null +++ b/tests/auto/cplusplus/CMakeLists.txt @@ -0,0 +1,15 @@ +add_subdirectory(ast) +add_subdirectory(c99) +add_subdirectory(checksymbols) +add_subdirectory(codeformatter) +add_subdirectory(cppselectionchanger) +add_subdirectory(cxx11) +add_subdirectory(fileiterationorder) +add_subdirectory(findusages) +add_subdirectory(lexer) +add_subdirectory(lookup) +add_subdirectory(misc) +add_subdirectory(preprocessor) +add_subdirectory(semantic) +add_subdirectory(translationunit) +add_subdirectory(typeprettyprinter) diff --git a/tests/auto/cplusplus/ast/CMakeLists.txt b/tests/auto/cplusplus/ast/CMakeLists.txt new file mode 100644 index 0000000000..5bfef72674 --- /dev/null +++ b/tests/auto/cplusplus/ast/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_ast + DEPENDS CppTools + SOURCES tst_ast.cpp +) diff --git a/tests/auto/cplusplus/ast/tst_ast.cpp b/tests/auto/cplusplus/ast/tst_ast.cpp index 0cf9c7a560..e444a4b8e5 100644 --- a/tests/auto/cplusplus/ast/tst_ast.cpp +++ b/tests/auto/cplusplus/ast/tst_ast.cpp @@ -97,7 +97,7 @@ public: { ++errorCount; - qDebug() << fileName->chars()<<':'<<line<<':'<<column<<' '<<QString().vsprintf(format, ap); + qDebug() << fileName->chars()<<':'<<line<<':'<<column<<' ' << QString::vasprintf(format, ap); } }; diff --git a/tests/auto/cplusplus/c99/CMakeLists.txt b/tests/auto/cplusplus/c99/CMakeLists.txt new file mode 100644 index 0000000000..836f4b5c55 --- /dev/null +++ b/tests/auto/cplusplus/c99/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_c99 + DEPENDS CppTools + SOURCES tst_c99.cpp +) diff --git a/tests/auto/cplusplus/c99/tst_c99.cpp b/tests/auto/cplusplus/c99/tst_c99.cpp index df33671907..edcb5f955f 100644 --- a/tests/auto/cplusplus/c99/tst_c99.cpp +++ b/tests/auto/cplusplus/c99/tst_c99.cpp @@ -83,11 +83,10 @@ class tst_c99: public QObject static const char *const pretty[] = {"warning", "error", "fatal"}; - QString str; - str.sprintf("%s:%d:%d: %s: ", fileName->chars(), line, column, pretty[level]); + QString str = QString::asprintf("%s:%d:%d: %s: ", fileName->chars(), line, column, pretty[level]); errors->append(str.toUtf8()); - str.vsprintf(format, ap); + str += QString::vasprintf(format, ap); errors->append(str.toUtf8()); errors->append('\n'); diff --git a/tests/auto/cplusplus/checksymbols/CMakeLists.txt b/tests/auto/cplusplus/checksymbols/CMakeLists.txt new file mode 100644 index 0000000000..f889839ed2 --- /dev/null +++ b/tests/auto/cplusplus/checksymbols/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_checksymbols + DEPENDS CppTools TextEditor + SOURCES tst_checksymbols.cpp +) diff --git a/tests/auto/cplusplus/codeformatter/CMakeLists.txt b/tests/auto/cplusplus/codeformatter/CMakeLists.txt new file mode 100644 index 0000000000..9dfcc9346e --- /dev/null +++ b/tests/auto/cplusplus/codeformatter/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_codeformatter + DEPENDS CppTools + SOURCES tst_codeformatter.cpp +) diff --git a/tests/auto/cplusplus/cppselectionchanger/CMakeLists.txt b/tests/auto/cplusplus/cppselectionchanger/CMakeLists.txt new file mode 100644 index 0000000000..6df9d4c2ba --- /dev/null +++ b/tests/auto/cplusplus/cppselectionchanger/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_cppselectionchangertest + DEPENDS CppTools + SOURCES tst_cppselectionchangertest.cpp +) diff --git a/tests/auto/cplusplus/cxx11/CMakeLists.txt b/tests/auto/cplusplus/cxx11/CMakeLists.txt new file mode 100644 index 0000000000..b21ee16194 --- /dev/null +++ b/tests/auto/cplusplus/cxx11/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_cxx11 + DEPENDS CppTools + SOURCES tst_cxx11.cpp +) diff --git a/tests/auto/cplusplus/cxx11/tst_cxx11.cpp b/tests/auto/cplusplus/cxx11/tst_cxx11.cpp index 108d93f18f..abef7cc1e1 100644 --- a/tests/auto/cplusplus/cxx11/tst_cxx11.cpp +++ b/tests/auto/cplusplus/cxx11/tst_cxx11.cpp @@ -85,11 +85,10 @@ class tst_cxx11: public QObject static const char *const pretty[] = {"warning", "error", "fatal"}; - QString str; - str.sprintf("%s:%d:%d: %s: ", fileName->chars(), line, column, pretty[level]); + QString str = QString::asprintf("%s:%d:%d: %s: ", fileName->chars(), line, column, pretty[level]); errors->append(str.toUtf8()); - str.vsprintf(format, ap); + str += QString::vasprintf(format, ap); errors->append(str.toUtf8()); errors->append('\n'); diff --git a/tests/auto/cplusplus/fileiterationorder/CMakeLists.txt b/tests/auto/cplusplus/fileiterationorder/CMakeLists.txt new file mode 100644 index 0000000000..3f3d99d0e7 --- /dev/null +++ b/tests/auto/cplusplus/fileiterationorder/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_fileiterationorder + DEPENDS CppTools + SOURCES tst_fileiterationorder.cpp +) diff --git a/tests/auto/cplusplus/findusages/CMakeLists.txt b/tests/auto/cplusplus/findusages/CMakeLists.txt new file mode 100644 index 0000000000..5155c324e5 --- /dev/null +++ b/tests/auto/cplusplus/findusages/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_findusages + DEPENDS CppTools Utils + SOURCES tst_findusages.cpp +) diff --git a/tests/auto/cplusplus/lexer/CMakeLists.txt b/tests/auto/cplusplus/lexer/CMakeLists.txt new file mode 100644 index 0000000000..8cc0c55062 --- /dev/null +++ b/tests/auto/cplusplus/lexer/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_lexer + DEPENDS CppTools + SOURCES tst_lexer.cpp +) diff --git a/tests/auto/cplusplus/lookup/CMakeLists.txt b/tests/auto/cplusplus/lookup/CMakeLists.txt new file mode 100644 index 0000000000..4ca7f97e21 --- /dev/null +++ b/tests/auto/cplusplus/lookup/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_lookup + DEPENDS CppTools + SOURCES tst_lookup.cpp +) diff --git a/tests/auto/cplusplus/misc/CMakeLists.txt b/tests/auto/cplusplus/misc/CMakeLists.txt new file mode 100644 index 0000000000..260ec2ae12 --- /dev/null +++ b/tests/auto/cplusplus/misc/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_misc + DEPENDS CppTools Utils + SOURCES tst_misc.cpp +) diff --git a/tests/auto/cplusplus/preprocessor/CMakeLists.txt b/tests/auto/cplusplus/preprocessor/CMakeLists.txt new file mode 100644 index 0000000000..c473084bad --- /dev/null +++ b/tests/auto/cplusplus/preprocessor/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_preprocessor + DEPENDS CppTools + SOURCES tst_preprocessor.cpp +) diff --git a/tests/auto/cplusplus/semantic/CMakeLists.txt b/tests/auto/cplusplus/semantic/CMakeLists.txt new file mode 100644 index 0000000000..6a358e9fff --- /dev/null +++ b/tests/auto/cplusplus/semantic/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_semantic + DEPENDS CppTools + SOURCES tst_semantic.cpp +) diff --git a/tests/auto/cplusplus/semantic/tst_semantic.cpp b/tests/auto/cplusplus/semantic/tst_semantic.cpp index 3904558efc..e13795154b 100644 --- a/tests/auto/cplusplus/semantic/tst_semantic.cpp +++ b/tests/auto/cplusplus/semantic/tst_semantic.cpp @@ -120,7 +120,7 @@ public: ++errorCount; #ifndef NO_PARSER_OR_SEMANTIC_ERROR_MESSAGES - qDebug() << fileName->chars()<<':'<<line<<':'<<column<<' '<<QString().vsprintf(format, ap); + qDebug() << fileName->chars()<<':'<<line<<':'<<column<<' ' << QString::vasprintf(format, ap); #else Q_UNUSED(fileName); Q_UNUSED(line); diff --git a/tests/auto/cplusplus/translationunit/CMakeLists.txt b/tests/auto/cplusplus/translationunit/CMakeLists.txt new file mode 100644 index 0000000000..5633d0f36b --- /dev/null +++ b/tests/auto/cplusplus/translationunit/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_translationunit + DEPENDS CppTools + SOURCES tst_translationunit.cpp +) diff --git a/tests/auto/cplusplus/translationunit/tst_translationunit.cpp b/tests/auto/cplusplus/translationunit/tst_translationunit.cpp index 4a2159bf04..2c651676bc 100644 --- a/tests/auto/cplusplus/translationunit/tst_translationunit.cpp +++ b/tests/auto/cplusplus/translationunit/tst_translationunit.cpp @@ -133,7 +133,7 @@ private: { ++errorCount; qDebug() << fileName->chars() << ':' << line << ':' << column - << ' ' << QString().vsprintf(format, ap); + << ' ' << QString::vasprintf(format, ap); } } m_diagnosticClient; }; diff --git a/tests/auto/cplusplus/typeprettyprinter/CMakeLists.txt b/tests/auto/cplusplus/typeprettyprinter/CMakeLists.txt new file mode 100644 index 0000000000..a6c0718114 --- /dev/null +++ b/tests/auto/cplusplus/typeprettyprinter/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_cplusplus_typeprettyprinter + DEPENDS CppTools + SOURCES tst_typeprettyprinter.cpp +) diff --git a/tests/auto/debugger/CMakeLists.txt b/tests/auto/debugger/CMakeLists.txt new file mode 100644 index 0000000000..b4e7da69dc --- /dev/null +++ b/tests/auto/debugger/CMakeLists.txt @@ -0,0 +1,53 @@ +set(DEBUGGERDIR "${CMAKE_SOURCE_DIR}/src/plugins/debugger") + +add_qtc_test(tst_debugger_disassembler + INCLUDES "${DEBUGGERDIR}" + SOURCES + tst_disassembler.cpp + "${DEBUGGERDIR}/disassemblerlines.cpp" "${DEBUGGERDIR}/disassemblerlines.h" +) + +if (WITH_DEBUGGER_DUMPERS) + add_qtc_test(tst_debugger_dumpers + DEPENDS Qt5::Network Utils + DEFINES DUMPERDIR="${CMAKE_SOURCE_DIR}/share/qtcreator/debugger" + INCLUDES + "${DEBUGGERDIR}" + SOURCES + "${DEBUGGERDIR}/debuggerprotocol.cpp" "${DEBUGGERDIR}/debuggerprotocol.h" + "${DEBUGGERDIR}/simplifytype.cpp" "${DEBUGGERDIR}/simplifytype.h" + "${DEBUGGERDIR}/watchdata.cpp" "${DEBUGGERDIR}/watchdata.h" + "${DEBUGGERDIR}/watchutils.cpp" "${DEBUGGERDIR}/watchutils.h" + tst_dumpers.cpp + ) +endif() + +add_qtc_test(tst_debugger_gdb + DEPENDS Qt5::Network Utils + INCLUDES "${DEBUGGERDIR}" + SOURCES + tst_gdb.cpp + "${DEBUGGERDIR}/debuggerprotocol.cpp" "${DEBUGGERDIR}/debuggerprotocol.h" +) + +add_qtc_test(tst_debugger_namedemangler + INCLUDES "${DEBUGGERDIR}" + SOURCES + tst_namedemangler.cpp + "${DEBUGGERDIR}/namedemangler/globalparsestate.cpp" "${DEBUGGERDIR}/namedemangler/globalparsestate.h" + "${DEBUGGERDIR}/namedemangler/namedemangler.cpp" "${DEBUGGERDIR}/namedemangler/namedemangler.h" + "${DEBUGGERDIR}/namedemangler/parsetreenodes.cpp" "${DEBUGGERDIR}/namedemangler/parsetreenodes.h" +) + +add_qtc_test(tst_debugger_offsets + DEPENDS Qt5::CorePrivate + INCLUDES "${DEBUGGERDIR}" + SOURCES tst_offsets.cpp +) + +add_qtc_test(tst_debugger_simplifytypes + INCLUDES "${DEBUGGERDIR}" + SOURCES + tst_simplifytypes.cpp + "${DEBUGGERDIR}/simplifytype.cpp" "${DEBUGGERDIR}/simplifytype.h" +) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index fac13979db..3b59a9cce8 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -90,10 +90,11 @@ static bool generateEnvironmentSettings(Utils::Environment &env, // if Creator is launched within a session set up by setenv.cmd. env.unset("ORIGINALPATH"); run.setEnvironment(env); - const QString cmdPath = QString::fromLocal8Bit(qgetenv("COMSPEC")); + const Utils::FilePath cmdPath + = Utils::FilePath::fromString(QString::fromLocal8Bit(qgetenv("COMSPEC"))); // Windows SDK setup scripts require command line switches for environment expansion. QString cmdArguments = " /E:ON /V:ON /c \"" + QDir::toNativeSeparators(saver.fileName()) + '"'; - run.setCommand(cmdPath, cmdArguments); + run.setCommand(Utils::CommandLine(cmdPath, cmdArguments)); run.start(); if (!run.waitForStarted()) { @@ -3685,7 +3686,7 @@ void tst_Dumpers::dumper_data() "QList<int> list;\n" "list << 1 << 2 << 3;\n" - "QVariant v3 = qVariantFromValue(list);\n" + "QVariant v3 = QVariant::fromValue(list);\n" "unused(&list, &v3);\n\n") + CoreProfile() diff --git a/tests/auto/diff/CMakeLists.txt b/tests/auto/diff/CMakeLists.txt new file mode 100644 index 0000000000..61bd0b2845 --- /dev/null +++ b/tests/auto/diff/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(differ) diff --git a/tests/auto/diff/differ/CMakeLists.txt b/tests/auto/diff/differ/CMakeLists.txt new file mode 100644 index 0000000000..59b675d4ce --- /dev/null +++ b/tests/auto/diff/differ/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_differ + DEPENDS Utils + SOURCES tst_differ.cpp +) diff --git a/tests/auto/environment/CMakeLists.txt b/tests/auto/environment/CMakeLists.txt new file mode 100644 index 0000000000..c38dfe733e --- /dev/null +++ b/tests/auto/environment/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_environment + DEPENDS Utils + SOURCES tst_environment.cpp +) diff --git a/tests/auto/extensionsystem/CMakeLists.txt b/tests/auto/extensionsystem/CMakeLists.txt new file mode 100644 index 0000000000..48d0b007d4 --- /dev/null +++ b/tests/auto/extensionsystem/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(pluginmanager) +add_subdirectory(pluginspec) diff --git a/tests/auto/extensionsystem/pluginmanager/CMakeLists.txt b/tests/auto/extensionsystem/pluginmanager/CMakeLists.txt new file mode 100644 index 0000000000..26130c88ba --- /dev/null +++ b/tests/auto/extensionsystem/pluginmanager/CMakeLists.txt @@ -0,0 +1,9 @@ +add_subdirectory(circularplugins) +add_subdirectory(correctplugins1) + +add_qtc_test(tst_pluginmanager + DEFINES PLUGINMANAGER_TESTS_DIR="${CMAKE_CURRENT_BINARY_DIR}" + DEPENDS ExtensionSystem + SOURCES + tst_pluginmanager.cpp +) diff --git a/tests/auto/extensionsystem/pluginmanager/circularplugins/CMakeLists.txt b/tests/auto/extensionsystem/pluginmanager/circularplugins/CMakeLists.txt new file mode 100644 index 0000000000..bbf4a58ef9 --- /dev/null +++ b/tests/auto/extensionsystem/pluginmanager/circularplugins/CMakeLists.txt @@ -0,0 +1,4 @@ +set(TEST_PLUGIN_PATH "${CMAKE_CURRENT_BINARY_DIR}") +add_subdirectory(plugin1) +add_subdirectory(plugin2) +add_subdirectory(plugin3) diff --git a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin1/CMakeLists.txt b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin1/CMakeLists.txt new file mode 100644 index 0000000000..0d3e8e3858 --- /dev/null +++ b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin1/CMakeLists.txt @@ -0,0 +1,7 @@ +add_qtc_plugin(plugin1 + DEPENDS ExtensionSystem + SOURCES + plugin1.cpp plugin1.h + PLUGIN_PATH "${TEST_PLUGIN_PATH}" + SKIP_INSTALL + ) diff --git a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin2/CMakeLists.txt b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin2/CMakeLists.txt new file mode 100644 index 0000000000..fd58e173c2 --- /dev/null +++ b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin2/CMakeLists.txt @@ -0,0 +1,7 @@ +add_qtc_plugin(plugin2 + DEPENDS ExtensionSystem + SOURCES + plugin2.cpp plugin2.h + PLUGIN_PATH "${TEST_PLUGIN_PATH}" + SKIP_INSTALL + ) diff --git a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin3/CMakeLists.txt b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin3/CMakeLists.txt new file mode 100644 index 0000000000..dec94785f1 --- /dev/null +++ b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin3/CMakeLists.txt @@ -0,0 +1,7 @@ +add_qtc_plugin(plugin3 + DEPENDS ExtensionSystem + SOURCES + plugin3.cpp plugin3.h + PLUGIN_PATH "${TEST_PLUGIN_PATH}" + SKIP_INSTALL + ) diff --git a/tests/auto/extensionsystem/pluginmanager/correctplugins1/CMakeLists.txt b/tests/auto/extensionsystem/pluginmanager/correctplugins1/CMakeLists.txt new file mode 100644 index 0000000000..bbf4a58ef9 --- /dev/null +++ b/tests/auto/extensionsystem/pluginmanager/correctplugins1/CMakeLists.txt @@ -0,0 +1,4 @@ +set(TEST_PLUGIN_PATH "${CMAKE_CURRENT_BINARY_DIR}") +add_subdirectory(plugin1) +add_subdirectory(plugin2) +add_subdirectory(plugin3) diff --git a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/CMakeLists.txt b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/CMakeLists.txt new file mode 100644 index 0000000000..6302992c2a --- /dev/null +++ b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/CMakeLists.txt @@ -0,0 +1,8 @@ +add_qtc_plugin(correct_plugin1 + PLUGIN_NAME plugin1 + DEPENDS ExtensionSystem + SOURCES + plugin1.cpp plugin1.h + PLUGIN_PATH "${TEST_PLUGIN_PATH}" + SKIP_INSTALL +) diff --git a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin2/CMakeLists.txt b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin2/CMakeLists.txt new file mode 100644 index 0000000000..075a08e58d --- /dev/null +++ b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin2/CMakeLists.txt @@ -0,0 +1,8 @@ +add_qtc_plugin(correct_plugin2 + PLUGIN_NAME plugin2 + DEPENDS ExtensionSystem + SOURCES + plugin2.cpp plugin2.h + PLUGIN_PATH "${TEST_PLUGIN_PATH}" + SKIP_INSTALL +) diff --git a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/CMakeLists.txt b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/CMakeLists.txt new file mode 100644 index 0000000000..2326ac08b4 --- /dev/null +++ b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/CMakeLists.txt @@ -0,0 +1,8 @@ +add_qtc_plugin(correct_plugin3 + PLUGIN_NAME plugin3 + DEPENDS ExtensionSystem + SOURCES + plugin3.cpp plugin3.h + PLUGIN_PATH "${TEST_PLUGIN_PATH}" + SKIP_INSTALL +) diff --git a/tests/auto/extensionsystem/pluginmanager/tst_pluginmanager.cpp b/tests/auto/extensionsystem/pluginmanager/tst_pluginmanager.cpp index 14722c6d57..c3c144a16c 100644 --- a/tests/auto/extensionsystem/pluginmanager/tst_pluginmanager.cpp +++ b/tests/auto/extensionsystem/pluginmanager/tst_pluginmanager.cpp @@ -161,7 +161,7 @@ void tst_PluginManager::circularPlugins() { m_pm->setPluginPaths(QStringList() << pluginFolder(QLatin1String("circularplugins"))); m_pm->loadPlugins(); - QList<PluginSpec *> plugins = m_pm->plugins(); + QVector<PluginSpec *> plugins = m_pm->plugins(); QCOMPARE(plugins.count(), 3); foreach (PluginSpec *spec, plugins) { if (spec->name() == "plugin1") { diff --git a/tests/auto/extensionsystem/pluginspec/CMakeLists.txt b/tests/auto/extensionsystem/pluginspec/CMakeLists.txt new file mode 100644 index 0000000000..8380467989 --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/CMakeLists.txt @@ -0,0 +1,10 @@ +add_subdirectory(testplugin) + +add_qtc_test(tst_pluginspec + DEFINES + PLUGIN_DIR="${CMAKE_CURRENT_BINARY_DIR}" + PLUGINSPEC_DIR="${CMAKE_CURRENT_SOURCE_DIR}" + DEPENDS ExtensionSystem + SOURCES + tst_pluginspec.cpp +) diff --git a/tests/auto/extensionsystem/pluginspec/testplugin/CMakeLists.txt b/tests/auto/extensionsystem/pluginspec/testplugin/CMakeLists.txt new file mode 100644 index 0000000000..df9fe19244 --- /dev/null +++ b/tests/auto/extensionsystem/pluginspec/testplugin/CMakeLists.txt @@ -0,0 +1,22 @@ +# TODO: unittest should be fixed +if(APPLE) + set(plugin_output_name "libtest_debug") +elseif(UNIX) + set(plugin_output_name "liblibtest") +else() + set(plugin_output_name "testd4") +endif() + +add_qtc_plugin(testplugin + DEPENDS ExtensionSystem + DEFINES MYPLUGIN_LIBRARY + SOURCES + testplugin.cpp testplugin.h + PLUGIN_PATH "${CMAKE_CURRENT_BINARY_DIR}" + PROPERTIES + OUTPUT_NAME ${plugin_output_name} + SKIP_INSTALL +) + +# The empty string gets removed if I put it above +set_target_properties(testplugin PROPERTIES PREFIX "") diff --git a/tests/auto/extensionsystem/pluginspec/tst_pluginspec.cpp b/tests/auto/extensionsystem/pluginspec/tst_pluginspec.cpp index c846458615..8092bfa57e 100644 --- a/tests/auto/extensionsystem/pluginspec/tst_pluginspec.cpp +++ b/tests/auto/extensionsystem/pluginspec/tst_pluginspec.cpp @@ -245,7 +245,7 @@ void tst_PluginSpec::locationAndPath() void tst_PluginSpec::resolveDependencies() { - QList<PluginSpec *> specs; + QVector<PluginSpec *> specs; PluginSpec *spec1 = Internal::PluginManagerPrivate::createSpec(); specs.append(spec1); Internal::PluginSpecPrivate *spec1Priv = Internal::PluginManagerPrivate::privateSpec(spec1); @@ -291,7 +291,7 @@ void tst_PluginSpec::loadLibrary() PluginSpec *ps = Internal::PluginManagerPrivate::createSpec(); Internal::PluginSpecPrivate *spec = Internal::PluginManagerPrivate::privateSpec(ps); QVERIFY(spec->read(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/") + libraryName(QLatin1String("test")))); - QVERIFY(spec->resolveDependencies(QList<PluginSpec *>())); + QVERIFY(spec->resolveDependencies(QVector<PluginSpec *>())); QVERIFY2(spec->loadLibrary(), qPrintable(spec->errorString)); QVERIFY(spec->plugin != 0); QVERIFY(QLatin1String(spec->plugin->metaObject()->className()) == QLatin1String("MyPlugin::MyPluginImpl")); @@ -305,7 +305,7 @@ void tst_PluginSpec::initializePlugin() { Internal::PluginSpecPrivate spec(0); QVERIFY(spec.read(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/") + libraryName(QLatin1String("test")))); - QVERIFY(spec.resolveDependencies(QList<PluginSpec *>())); + QVERIFY(spec.resolveDependencies(QVector<PluginSpec *>())); QVERIFY2(spec.loadLibrary(), qPrintable(spec.errorString)); bool isInitialized; QMetaObject::invokeMethod(spec.plugin, "isInitialized", @@ -323,7 +323,7 @@ void tst_PluginSpec::initializeExtensions() { Internal::PluginSpecPrivate spec(0); QVERIFY(spec.read(QLatin1String(PLUGIN_DIR) + QLatin1String("/testplugin/") + libraryName(QLatin1String("test")))); - QVERIFY(spec.resolveDependencies(QList<PluginSpec *>())); + QVERIFY(spec.resolveDependencies(QVector<PluginSpec *>())); QVERIFY2(spec.loadLibrary(), qPrintable(spec.errorString)); bool isExtensionsInitialized; QVERIFY(spec.initializePlugin()); diff --git a/tests/auto/externaltool/CMakeLists.txt b/tests/auto/externaltool/CMakeLists.txt new file mode 100644 index 0000000000..64a6004150 --- /dev/null +++ b/tests/auto/externaltool/CMakeLists.txt @@ -0,0 +1,7 @@ +add_qtc_test(tst_externaltooltest + DEPENDS Core app_version + SOURCES + tst_externaltooltest.cpp + "${CMAKE_SOURCE_DIR}/src/plugins/coreplugin/externaltool.cpp" + "${CMAKE_SOURCE_DIR}/src/plugins/coreplugin/externaltool.h" +) diff --git a/tests/auto/filesearch/CMakeLists.txt b/tests/auto/filesearch/CMakeLists.txt new file mode 100644 index 0000000000..e61567e78a --- /dev/null +++ b/tests/auto/filesearch/CMakeLists.txt @@ -0,0 +1,6 @@ +add_qtc_test(tst_filesearch + DEPENDS Utils + SOURCES + tst_filesearch.cpp + tst_filesearch.qrc +) diff --git a/tests/auto/json/CMakeLists.txt b/tests/auto/json/CMakeLists.txt new file mode 100644 index 0000000000..e03addf91d --- /dev/null +++ b/tests/auto/json/CMakeLists.txt @@ -0,0 +1,7 @@ +add_qtc_test(tst_json + DEPENDS Utils + INCLUDES "${CMAKE_SOURCE_DIR}/src/shared/json" + SOURCES + tst_json.cpp + "${CMAKE_SOURCE_DIR}/src/shared/json/json.cpp" +) diff --git a/tests/auto/languageserverprotocol/CMakeLists.txt b/tests/auto/languageserverprotocol/CMakeLists.txt new file mode 100644 index 0000000000..76664b67cb --- /dev/null +++ b/tests/auto/languageserverprotocol/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_languageserverprotocol + DEPENDS Utils LanguageServerProtocol + SOURCES tst_languageserverprotocol.cpp +) diff --git a/tests/auto/languageserverprotocol/tst_languageserverprotocol.cpp b/tests/auto/languageserverprotocol/tst_languageserverprotocol.cpp index f4c94a36b9..daa013b744 100644 --- a/tests/auto/languageserverprotocol/tst_languageserverprotocol.cpp +++ b/tests/auto/languageserverprotocol/tst_languageserverprotocol.cpp @@ -595,7 +595,7 @@ void tst_LanguageServerProtocol::documentUri_data() { QTest::addColumn<DocumentUri>("uri"); QTest::addColumn<bool>("isValid"); - QTest::addColumn<Utils::FileName>("fileName"); + QTest::addColumn<Utils::FilePath>("fileName"); QTest::addColumn<QString>("string"); // '/' (fs root) is part of the file path @@ -605,18 +605,18 @@ void tst_LanguageServerProtocol::documentUri_data() QTest::newRow("empty uri") << DocumentUri() << false - << Utils::FileName() + << Utils::FilePath() << QString(); QTest::newRow("home dir") - << DocumentUri::fromFileName(Utils::FileName::fromString(QDir::homePath())) + << DocumentUri::fromFileName(Utils::FilePath::fromString(QDir::homePath())) << true - << Utils::FileName::fromUserInput(QDir::homePath()) + << Utils::FilePath::fromUserInput(QDir::homePath()) << QString(filePrefix + QDir::homePath()); const QString argv0 = QFileInfo(qApp->arguments().first()).absoluteFilePath(); - const auto argv0FileName = Utils::FileName::fromUserInput(argv0); + const auto argv0FileName = Utils::FilePath::fromUserInput(argv0); QTest::newRow("argv0 file name") << DocumentUri::fromFileName(argv0FileName) << true @@ -626,7 +626,7 @@ void tst_LanguageServerProtocol::documentUri_data() QTest::newRow("http") << DocumentUri::fromProtocol("https://www.qt.io/") << true - << Utils::FileName() + << Utils::FilePath() << "https://www.qt.io/"; // depending on the OS the resulting path is different (made suitable for the file system) @@ -636,7 +636,7 @@ void tst_LanguageServerProtocol::documentUri_data() QTest::newRow("percent encoding") << DocumentUri::fromProtocol(winUserPercent) << true - << Utils::FileName::fromUserInput(winUser) + << Utils::FilePath::fromUserInput(winUser) << QString(filePrefix + QDir::fromNativeSeparators(winUser)); } @@ -644,7 +644,7 @@ void tst_LanguageServerProtocol::documentUri() { QFETCH(DocumentUri, uri); QFETCH(bool, isValid); - QFETCH(Utils::FileName, fileName); + QFETCH(Utils::FilePath, fileName); QFETCH(QString, string); QCOMPARE(uri.isValid(), isValid); diff --git a/tests/auto/mapreduce/CMakeLists.txt b/tests/auto/mapreduce/CMakeLists.txt new file mode 100644 index 0000000000..5a57f3c676 --- /dev/null +++ b/tests/auto/mapreduce/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_mapreduce + DEPENDS Utils + SOURCES tst_mapreduce.cpp +) diff --git a/tests/auto/pointeralgorithm/CMakeLists.txt b/tests/auto/pointeralgorithm/CMakeLists.txt new file mode 100644 index 0000000000..52a8bbc499 --- /dev/null +++ b/tests/auto/pointeralgorithm/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_pointeralgorithm + INCLUDES "${CMAKE_SOURCE_DIR}/src/libs" + SOURCES tst_pointeralgorithm.cpp +) diff --git a/tests/auto/profilewriter/CMakeLists.txt b/tests/auto/profilewriter/CMakeLists.txt new file mode 100644 index 0000000000..c929843c83 --- /dev/null +++ b/tests/auto/profilewriter/CMakeLists.txt @@ -0,0 +1,5 @@ +add_qtc_test(tst_profilewriter + DEPENDS Utils ProParser + INCLUDES "${CMAKE_SOURCE_DIR}/src/shared/proparser" + SOURCES tst_profilewriter.cpp +) diff --git a/tests/auto/qml/CMakeLists.txt b/tests/auto/qml/CMakeLists.txt new file mode 100644 index 0000000000..61e6c1e0b5 --- /dev/null +++ b/tests/auto/qml/CMakeLists.txt @@ -0,0 +1,8 @@ +add_subdirectory(codemodel) +add_subdirectory(persistenttrie) +add_subdirectory(qmldesigner) +add_subdirectory(qmleditor) +add_subdirectory(qmljssimplereader) +add_subdirectory(qmlprojectmanager) +add_subdirectory(qrcparser) +add_subdirectory(reformatter) diff --git a/tests/auto/qml/codemodel/CMakeLists.txt b/tests/auto/qml/codemodel/CMakeLists.txt new file mode 100644 index 0000000000..94eae7af58 --- /dev/null +++ b/tests/auto/qml/codemodel/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(check ) +add_subdirectory(dependencies ) +add_subdirectory(ecmascript7 ) +add_subdirectory(importscheck ) diff --git a/tests/auto/qml/codemodel/check/CMakeLists.txt b/tests/auto/qml/codemodel/check/CMakeLists.txt new file mode 100644 index 0000000000..fdcd1334bd --- /dev/null +++ b/tests/auto/qml/codemodel/check/CMakeLists.txt @@ -0,0 +1,8 @@ +add_qtc_test(tst_qml_check + DEPENDS qmljs + DEFINES + QT_CREATOR + QTCREATORDIR="${CMAKE_SOURCE_DIR}" + TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" + SOURCES tst_check.cpp +) diff --git a/tests/auto/qml/codemodel/dependencies/CMakeLists.txt b/tests/auto/qml/codemodel/dependencies/CMakeLists.txt new file mode 100644 index 0000000000..544e771873 --- /dev/null +++ b/tests/auto/qml/codemodel/dependencies/CMakeLists.txt @@ -0,0 +1,9 @@ +add_qtc_test(tst_qml_dependencies + DEPENDS qmljs QmlJSTools ExtensionSystem Utils + INCLUDES "${CMAKE_SOURCE_DIR}/src/plugins" + DEFINES + QT_CREATOR + QTCREATORDIR="${CMAKE_SOURCE_DIR}" + TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" + SOURCES tst_dependencies.cpp +) diff --git a/tests/auto/qml/codemodel/dependencies/tst_dependencies.cpp b/tests/auto/qml/codemodel/dependencies/tst_dependencies.cpp index 842cec7e4e..79ce9cec1b 100644 --- a/tests/auto/qml/codemodel/dependencies/tst_dependencies.cpp +++ b/tests/auto/qml/codemodel/dependencies/tst_dependencies.cpp @@ -112,7 +112,7 @@ private: void tst_Dependencies::initTestCase() { - m_path = QLatin1Literal(TESTSRCDIR "/samples"); + m_path = QLatin1String(TESTSRCDIR "/samples"); m_basePaths.append(QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath)); @@ -148,7 +148,7 @@ void tst_Dependencies::test() QStringList paths(m_basePaths); paths << m_path; for (auto p: paths) - lPaths.maybeInsert(Utils::FileName::fromString(p), Dialect::Qml); + lPaths.maybeInsert(Utils::FilePath::fromString(p), Dialect::Qml); ModelManagerInterface::importScan(result, ModelManagerInterface::workingCopy(), lPaths, ModelManagerInterface::instance(), false); diff --git a/tests/auto/qml/codemodel/ecmascript7/CMakeLists.txt b/tests/auto/qml/codemodel/ecmascript7/CMakeLists.txt new file mode 100644 index 0000000000..62a0ba588d --- /dev/null +++ b/tests/auto/qml/codemodel/ecmascript7/CMakeLists.txt @@ -0,0 +1,9 @@ +add_qtc_test(tst_qml_ecmascript7 + DEPENDS qmljs QmlJSTools ExtensionSystem Utils + INCLUDES "${CMAKE_SOURCE_DIR}/src/plugins" + DEFINES + QT_CREATOR + QTCREATORDIR="${CMAKE_SOURCE_DIR}" + TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" + SOURCES tst_ecmascript7.cpp +) diff --git a/tests/auto/qml/codemodel/ecmascript7/tst_ecmascript7.cpp b/tests/auto/qml/codemodel/ecmascript7/tst_ecmascript7.cpp index fd6a54b59b..735daa04f7 100644 --- a/tests/auto/qml/codemodel/ecmascript7/tst_ecmascript7.cpp +++ b/tests/auto/qml/codemodel/ecmascript7/tst_ecmascript7.cpp @@ -124,7 +124,7 @@ private slots: void test(); private: - QList<QFileInfo> m_files; + QFileInfoList m_files; QStringList m_basePaths; }; @@ -134,13 +134,13 @@ void tst_Ecmascript::initTestCase() QDirIterator it(sampledir, QDirIterator::Subdirectories); - QStringList skipList = readSkipList(sampledir, QLatin1Literal("skip.txt")); + QStringList skipList = readSkipList(sampledir, QLatin1String("skip.txt")); while (it.hasNext()) { QString path = it.next(); if (skipList.contains(path)) continue; QFileInfo f(path); - if (f.isFile() && f.suffix() == QLatin1Literal("js")) + if (f.isFile() && f.suffix() == QLatin1String("js")) m_files << f; } @@ -174,7 +174,7 @@ void tst_Ecmascript::test() PathsAndLanguages lPaths; QStringList paths(m_basePaths); for (auto p: paths) - lPaths.maybeInsert(Utils::FileName::fromString(p), Dialect::Qml); + lPaths.maybeInsert(Utils::FilePath::fromString(p), Dialect::Qml); ModelManagerInterface::importScan(result, ModelManagerInterface::workingCopy(), lPaths, ModelManagerInterface::instance(), false); diff --git a/tests/auto/qml/codemodel/importscheck/CMakeLists.txt b/tests/auto/qml/codemodel/importscheck/CMakeLists.txt new file mode 100644 index 0000000000..5f994a58ee --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/CMakeLists.txt @@ -0,0 +1,9 @@ +add_qtc_test(tst_qml_importscheck + DEPENDS qmljs QmlJSTools Utils CPlusPlus + INCLUDES "${CMAKE_SOURCE_DIR}/src/plugins" + DEFINES + QT_CREATOR + QTCREATORDIR="${CMAKE_SOURCE_DIR}" + TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" + SOURCES tst_importscheck.cpp +) diff --git a/tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp b/tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp index dcedd6df69..0c11438e12 100644 --- a/tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp +++ b/tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp @@ -67,7 +67,7 @@ void scanDir(const QString &dir) { QFutureInterface<void> result; PathsAndLanguages paths; - paths.maybeInsert(Utils::FileName::fromString(dir), Dialect::Qml); + paths.maybeInsert(Utils::FilePath::fromString(dir), Dialect::Qml); ModelManagerInterface::importScan(result, ModelManagerInterface::workingCopy(), paths, ModelManagerInterface::instance(), false); ViewerContext vCtx = ViewerContext(QStringList(), QStringList(dir)); @@ -178,7 +178,7 @@ void tst_ImportCheck::test() QFutureInterface<void> result; PathsAndLanguages lPaths; foreach (const QString &path, paths) - lPaths.maybeInsert(Utils::FileName::fromString(path), Dialect::Qml); + lPaths.maybeInsert(Utils::FilePath::fromString(path), Dialect::Qml); ModelManagerInterface::importScan(result, ModelManagerInterface::workingCopy(), lPaths, ModelManagerInterface::instance(), false); ViewerContext vCtx(QStringList(), paths); diff --git a/tests/auto/qml/persistenttrie/CMakeLists.txt b/tests/auto/qml/persistenttrie/CMakeLists.txt new file mode 100644 index 0000000000..2ab22d0919 --- /dev/null +++ b/tests/auto/qml/persistenttrie/CMakeLists.txt @@ -0,0 +1,8 @@ +add_qtc_test(tst_qml_testtrie + DEPENDS qmljs + DEFINES + QT_CREATOR + QTCREATORDIR="${CMAKE_SOURCE_DIR}" + TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" + SOURCES tst_testtrie.cpp +) diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro index 2f9a2f1b2c..c0da615d8b 100644 --- a/tests/auto/qml/qml.pro +++ b/tests/auto/qml/qml.pro @@ -9,13 +9,13 @@ SUBDIRS += \ qrcparser \ persistenttrie -DO_NOT_BUILD_QMLDESIGNER = $$(DO_NOT_BUILD_QMLDESIGNER) -isEmpty(DO_NOT_BUILD_QMLDESIGNER):qtHaveModule(quick-private) { +QTC_DO_NOT_BUILD_QMLDESIGNER = $$(QTC_DO_NOT_BUILD_QMLDESIGNER) +isEmpty(QTC_DO_NOT_BUILD_QMLDESIGNER):qtHaveModule(quick-private) { SUBDIRS += qmldesigner } else { !qtHaveModule(quick-private) { warning("QmlDesigner plugin has been disabled since the Qt Quick module is not available.") } else { - warning("QmlDesigner plugin has been disabled since DO_NOT_BUILD_QMLDESIGNER is set.") + warning("QmlDesigner plugin has been disabled since QTC_DO_NOT_BUILD_QMLDESIGNER is set.") } } diff --git a/tests/auto/qml/qmldesigner/CMakeLists.txt b/tests/auto/qml/qmldesigner/CMakeLists.txt new file mode 100644 index 0000000000..9d4ab11adc --- /dev/null +++ b/tests/auto/qml/qmldesigner/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(coretests) diff --git a/tests/auto/qml/qmldesigner/coretests/CMakeLists.txt b/tests/auto/qml/qmldesigner/coretests/CMakeLists.txt new file mode 100644 index 0000000000..3e83f280af --- /dev/null +++ b/tests/auto/qml/qmldesigner/coretests/CMakeLists.txt @@ -0,0 +1,20 @@ +# TODO: fix compiler errors +return() + +add_qtc_test(tst_qml_testcore + DEPENDS qmljs Utils QmlEditorWidgets CPlusPlus Core QmlJSEditor + INCLUDES + "${CMAKE_SOURCE_DIR}/src/plugins/qmldesigner/designercore/include" + "${CMAKE_SOURCE_DIR}/src/plugins/qmldesigner/designercore" + "${CMAKE_SOURCE_DIR}/share/qtcreator/qml/qmlpuppet/interfaces" + "${CMAKE_SOURCE_DIR}/share/qtcreator/qml/qmlpuppet/types" + DEFINES + QT_CREATOR + QTCREATORDIR="${CMAKE_SOURCE_DIR}" + TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" + SOURCES + ../data/testfiles.qrc + ../testview.cpp ../testview.h + testrewriterview.cpp testrewriterview.h + tst_testcore.cpp tst_testcore.h +) diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp index 1a4eda3bcc..31ea4e5914 100644 --- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp +++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp @@ -185,7 +185,7 @@ void tst_TestCore::initTestCase() QFutureInterface<void> result; QmlJS::PathsAndLanguages lPaths; - lPaths.maybeInsert(Utils::FileName::fromString(basePaths.first()), QmlJS::Dialect::Qml); + lPaths.maybeInsert(Utils::FilePath::fromString(basePaths.first()), QmlJS::Dialect::Qml); QmlJS::ModelManagerInterface::importScan(result, QmlJS::ModelManagerInterface::workingCopy(), lPaths, QmlJS::ModelManagerInterface::instance(), false); @@ -1017,6 +1017,44 @@ void tst_TestCore::testRewriterUnicodeChars() QCOMPARE(textEdit.toPlainText(), unicodeChar); } +void tst_TestCore::testRewriterTransactionAddingAfterReparenting() +{ + const QLatin1String qmlString("\n" + "import QtQuick 2.0\n" + "\n" + "Item {\n" + "}\n"); + + QPlainTextEdit textEdit; + textEdit.setPlainText(qmlString); + NotIndentingTextEditModifier modifier(&textEdit); + + QScopedPointer<Model> model(Model::create("QtQuick.Rectangle")); + + QScopedPointer<TestRewriterView> testRewriterView(new TestRewriterView(0, RewriterView::Amend)); + testRewriterView->setTextModifier(&modifier); + model->attachView(testRewriterView.data()); + + QVERIFY(testRewriterView->errors().isEmpty()); + + ModelNode rootModelNode = testRewriterView->rootModelNode(); + QVERIFY(rootModelNode.isValid()); + + { + /* Regression test + * If a node is not a direct child node of the root item we did get an exception when adding properties + * after the reparent */ + + RewriterTransaction transaction = testRewriterView->beginRewriterTransaction("TEST"); + ModelNode rectangle = testRewriterView->createModelNode("QtQuick.Rectangle", 2, 0); + rootModelNode.nodeListProperty("data").reparentHere(rectangle); + ModelNode rectangle2 = testRewriterView->createModelNode("QtQuick.Rectangle", 2, 0); + rectangle.nodeListProperty("data").reparentHere(rectangle2); + + rectangle2.variantProperty("width").setValue(100); + } +} + void tst_TestCore::testRewriterForGradientMagic() { const QLatin1String qmlString("\n" diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.h b/tests/auto/qml/qmldesigner/coretests/tst_testcore.h index 3f1eec576b..92f3b17161 100644 --- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.h +++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.h @@ -140,6 +140,7 @@ private slots: void testRewriterImports(); void testRewriterChangeImports(); void testRewriterUnicodeChars(); + void testRewriterTransactionAddingAfterReparenting(); // // unit tests QmlModelNodeFacade/QmlModelState diff --git a/tests/auto/qml/qmleditor/CMakeLists.txt b/tests/auto/qml/qmleditor/CMakeLists.txt new file mode 100644 index 0000000000..93a723626e --- /dev/null +++ b/tests/auto/qml/qmleditor/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(qmlcodeformatter) diff --git a/tests/auto/qml/qmleditor/qmlcodeformatter/CMakeLists.txt b/tests/auto/qml/qmleditor/qmlcodeformatter/CMakeLists.txt new file mode 100644 index 0000000000..d8daee0578 --- /dev/null +++ b/tests/auto/qml/qmleditor/qmlcodeformatter/CMakeLists.txt @@ -0,0 +1,8 @@ +add_qtc_test(tst_qml_qmlcodeformatter + DEPENDS qmljs QmlJSTools TextEditor + DEFINES + QT_CREATOR + QTCREATORDIR="${CMAKE_SOURCE_DIR}" + TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" + SOURCES tst_qmlcodeformatter.cpp +) diff --git a/tests/auto/qml/qmljssimplereader/CMakeLists.txt b/tests/auto/qml/qmljssimplereader/CMakeLists.txt new file mode 100644 index 0000000000..4742047d7b --- /dev/null +++ b/tests/auto/qml/qmljssimplereader/CMakeLists.txt @@ -0,0 +1,8 @@ +add_qtc_test(tst_qml_qmljssimplereader + DEPENDS qmljs + DEFINES + QT_CREATOR + QTCREATORDIR="${CMAKE_SOURCE_DIR}" + TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" + SOURCES tst_qmljssimplereader.cpp +) diff --git a/tests/auto/qml/qmlprojectmanager/CMakeLists.txt b/tests/auto/qml/qmlprojectmanager/CMakeLists.txt new file mode 100644 index 0000000000..f7c00d44bd --- /dev/null +++ b/tests/auto/qml/qmlprojectmanager/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(fileformat) diff --git a/tests/auto/qml/qmlprojectmanager/fileformat/CMakeLists.txt b/tests/auto/qml/qmlprojectmanager/fileformat/CMakeLists.txt new file mode 100644 index 0000000000..5d7f7c79bf --- /dev/null +++ b/tests/auto/qml/qmlprojectmanager/fileformat/CMakeLists.txt @@ -0,0 +1,15 @@ +get_target_property(QmlProjectManagerSources QmlProjectManager SOURCES) +foreach(source IN LISTS QmlProjectManagerSources) + if (source MATCHES "fileformat") + list(APPEND fileformat_sources "${CMAKE_SOURCE_DIR}/src/plugins/qmlprojectmanager/${source}") + endif() +endforeach() + +add_qtc_test(tst_qml_fileformat + DEPENDS qmljs Utils + INCLUDES "${CMAKE_SOURCE_DIR}/src/plugins/qmlprojectmanager/fileformat" + DEFINES + QT_CREATOR + SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" + SOURCES tst_fileformat.cpp ${fileformat_sources} +) diff --git a/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp b/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp index bca2e8d7a8..fe61dd0ea5 100644 --- a/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp +++ b/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp @@ -54,7 +54,7 @@ QString testDataDir = QLatin1String(SRCDIR "/data"); static QmlProjectItem *loadQmlProject(QString name, QString *error) { return QmlProjectFileFormat::parseProjectFile( - Utils::FileName::fromString(testDataDir).appendPath(name).appendString(".qmlproject"), error); + Utils::FilePath::fromString(testDataDir).pathAppended(name + ".qmlproject"), error); } void tst_FileFormat::testFileFilter() diff --git a/tests/auto/qml/qrcparser/CMakeLists.txt b/tests/auto/qml/qrcparser/CMakeLists.txt new file mode 100644 index 0000000000..bcecb807e4 --- /dev/null +++ b/tests/auto/qml/qrcparser/CMakeLists.txt @@ -0,0 +1,8 @@ +add_qtc_test(tst_qml_qrcparser + DEPENDS qmljs Utils + DEFINES + QT_CREATOR + QTCREATORDIR="${CMAKE_SOURCE_DIR}" + TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" + SOURCES tst_qrcparser.cpp +) diff --git a/tests/auto/qml/qrcparser/qrcparser.pro b/tests/auto/qml/qrcparser/qrcparser.pro index 571c0a11a3..cb991a4e8f 100644 --- a/tests/auto/qml/qrcparser/qrcparser.pro +++ b/tests/auto/qml/qrcparser/qrcparser.pro @@ -1,5 +1,5 @@ #include(../shared/shared.pri) -QTC_PLUGIN_DEPENDS += qmljstools +QTC_LIB_DEPENDS += utils include(../../qttest.pri) #DEFINES+=CPLUSPLUS_BUILD_STATIC_LIB include($$IDE_SOURCE_TREE/src/rpath.pri) diff --git a/tests/auto/qml/qrcparser/qrcparser.qbs b/tests/auto/qml/qrcparser/qrcparser.qbs index f08e32a063..432dca6d8b 100644 --- a/tests/auto/qml/qrcparser/qrcparser.qbs +++ b/tests/auto/qml/qrcparser/qrcparser.qbs @@ -1,9 +1,8 @@ import qbs QtcAutotest { - name: "QML qrc parser autotest" - Depends { name: "QmlJS" } - Depends { name: "QmlJSTools" } + name: "qrc parser autotest" + Depends { name: "Utils" } files: "tst_qrcparser.cpp" cpp.defines: base.concat(['TESTSRCDIR="' + path + '"']) } diff --git a/tests/auto/qml/qrcparser/tst_qrcparser.cpp b/tests/auto/qml/qrcparser/tst_qrcparser.cpp index d8c3f03c36..10f3dfd10c 100644 --- a/tests/auto/qml/qrcparser/tst_qrcparser.cpp +++ b/tests/auto/qml/qrcparser/tst_qrcparser.cpp @@ -27,9 +27,9 @@ #include <QDebug> #include <QLocale> -#include <qmljs/qmljsqrcparser.h> +#include <utils/qrcparser.h> -using namespace QmlJS; +using namespace Utils; class tst_QrcParser: public QObject { diff --git a/tests/auto/qml/reformatter/CMakeLists.txt b/tests/auto/qml/reformatter/CMakeLists.txt new file mode 100644 index 0000000000..a9119ccd93 --- /dev/null +++ b/tests/auto/qml/reformatter/CMakeLists.txt @@ -0,0 +1,8 @@ +add_qtc_test(tst_qml_reformatter + DEPENDS qmljs + DEFINES + QT_CREATOR + QTCREATORDIR="${CMAKE_SOURCE_DIR}" + TESTSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" + SOURCES tst_reformatter.cpp +) diff --git a/tests/auto/qml/reformatter/comments.qml b/tests/auto/qml/reformatter/comments.qml index 4ced7eb0e8..d2caa1b555 100644 --- a/tests/auto/qml/reformatter/comments.qml +++ b/tests/auto/qml/reformatter/comments.qml @@ -21,5 +21,13 @@ Item { { console.log("test") } + + var a = 1 + if (a > 0) { + console.log("positive") + } // Final condition + else { + console.log("negative or zero") + } } } diff --git a/tests/auto/qml/reformatter/enum.qml b/tests/auto/qml/reformatter/enum.qml new file mode 100644 index 0000000000..769386494d --- /dev/null +++ b/tests/auto/qml/reformatter/enum.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +Item { + enum Test { + A, + B + } + + enum TestWithValues { + A = 11.1, + B, + C = 3 + } +} diff --git a/tests/auto/qml/reformatter/jssyntax.js b/tests/auto/qml/reformatter/jssyntax.js index 5ef1a2adcd..d651cd7822 100644 --- a/tests/auto/qml/reformatter/jssyntax.js +++ b/tests/auto/qml/reformatter/jssyntax.js @@ -1,6 +1,10 @@ var x var y = 12 +var a_var = 1 +let a_let = 2 +const a_const = 3 + function foo(a, b) { x = 15 x += 4 @@ -28,6 +32,12 @@ while (true) { for (var x in a) { print(a[x]) } + for (let x in a) { + print(a[x]) + } + for (const x in a) { + print(a[x]) + } do { a = x diff --git a/tests/auto/qml/reformatter/objectliteral.js b/tests/auto/qml/reformatter/objectliteral.js index 37f6863374..d260712166 100644 --- a/tests/auto/qml/reformatter/objectliteral.js +++ b/tests/auto/qml/reformatter/objectliteral.js @@ -10,3 +10,5 @@ var x = { }, "z": 12 } + +var empty_object = {} diff --git a/tests/auto/qml/reformatter/qmlsingleton.qml b/tests/auto/qml/reformatter/qmlsingleton.qml index d64f554097..05a08e7de4 100644 --- a/tests/auto/qml/reformatter/qmlsingleton.qml +++ b/tests/auto/qml/reformatter/qmlsingleton.qml @@ -2,5 +2,4 @@ pragma Singleton import QtQuick 2.0 -Item { -} +Item {} diff --git a/tests/auto/qml/reformatter/qmlsyntax.qml b/tests/auto/qml/reformatter/qmlsyntax.qml index ded863106a..3e55503049 100644 --- a/tests/auto/qml/reformatter/qmlsyntax.qml +++ b/tests/auto/qml/reformatter/qmlsyntax.qml @@ -9,6 +9,8 @@ Text { property int foo property alias bar: x property list<QtObject> pro + property Part.Particles particles + property list<Part.Particles> particlesList default property int def property var baz: Rectangle { width: 20 @@ -45,4 +47,6 @@ Text { function foo(a, b) { x = a + 12 * b } + + value: Rectangle {} } diff --git a/tests/auto/qtcprocess/CMakeLists.txt b/tests/auto/qtcprocess/CMakeLists.txt new file mode 100644 index 0000000000..16b9f4a9fa --- /dev/null +++ b/tests/auto/qtcprocess/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_qtcprocess + DEPENDS Utils + SOURCES tst_qtcprocess.cpp +) diff --git a/tests/auto/runextensions/CMakeLists.txt b/tests/auto/runextensions/CMakeLists.txt new file mode 100644 index 0000000000..73455f7518 --- /dev/null +++ b/tests/auto/runextensions/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_runextensions + DEPENDS Utils + SOURCES tst_runextensions.cpp +) diff --git a/tests/auto/sdktool/CMakeLists.txt b/tests/auto/sdktool/CMakeLists.txt new file mode 100644 index 0000000000..65d83c00e3 --- /dev/null +++ b/tests/auto/sdktool/CMakeLists.txt @@ -0,0 +1,5 @@ +add_qtc_test(tst_sdktool + DEPENDS Utils + DEFINES SDKTOOL_DIR="${IDE_LIBEXEC_PATH}" + SOURCES tst_sdktool.cpp +) diff --git a/tests/auto/sdktool/tst_sdktool.cpp b/tests/auto/sdktool/tst_sdktool.cpp index 3a6eeca2f9..4cb4876dd8 100644 --- a/tests/auto/sdktool/tst_sdktool.cpp +++ b/tests/auto/sdktool/tst_sdktool.cpp @@ -43,7 +43,9 @@ void SdktoolTest::testSdktool() process.start(rootDir.absoluteFilePath(QLatin1String("sdktool")), QStringList() << QLatin1String("-test")); process.waitForFinished(); - qDebug() << process.readAllStandardError(); + QByteArray output = process.readAllStandardError(); + for (auto line : output.split('\n')) + qDebug() << line; QCOMPARE(process.exitCode(), 0); } diff --git a/tests/auto/ssh/CMakeLists.txt b/tests/auto/ssh/CMakeLists.txt new file mode 100644 index 0000000000..590144d3bd --- /dev/null +++ b/tests/auto/ssh/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_ssh + DEPENDS Utils QtcSsh + SOURCES tst_ssh.cpp +) diff --git a/tests/auto/ssh/tst_ssh.cpp b/tests/auto/ssh/tst_ssh.cpp index 22e7062fde..72260c2c9a 100644 --- a/tests/auto/ssh/tst_ssh.cpp +++ b/tests/auto/ssh/tst_ssh.cpp @@ -27,6 +27,7 @@ #include <ssh/sftptransfer.h> #include <ssh/sshconnection.h> #include <ssh/sshremoteprocessrunner.h> +#include <ssh/sshsettings.h> #include <utils/environment.h> #include <utils/temporarydirectory.h> @@ -171,8 +172,10 @@ void tst_Ssh::errorHandling() connection.connectToHost(); loop.exec(); QVERIFY(timer.isActive()); - QCOMPARE(connection.state(), SshConnection::Unconnected); - QVERIFY(!connection.errorString().isEmpty()); + const bool expectConnected = !SshSettings::connectionSharingEnabled(); + QCOMPARE(connection.state(), expectConnected ? SshConnection::Connected + : SshConnection::Unconnected); + QCOMPARE(connection.errorString().isEmpty(), expectConnected); QVERIFY(!disconnected); QVERIFY2(dataReceived.isEmpty(), qPrintable(dataReceived)); } @@ -313,8 +316,7 @@ void tst_Ssh::remoteProcessInput() SshConnection connection(params); QVERIFY(waitForConnection(connection)); - SshRemoteProcessPtr catProcess - = connection.createRemoteProcess(QString::fromLatin1("/bin/cat").toUtf8()); + SshRemoteProcessPtr catProcess = connection.createRemoteProcess("/bin/cat"); QEventLoop loop; connect(catProcess.get(), &SshRemoteProcess::started, &loop, &QEventLoop::quit); connect(catProcess.get(), &SshRemoteProcess::done, &loop, &QEventLoop::quit); @@ -375,7 +377,7 @@ void tst_Ssh::sftp() }; FilesToTransfer filesToUpload; std::srand(QDateTime::currentDateTime().toSecsSinceEpoch()); - for (int i = 0; i < 1000; ++i) { + for (int i = 0; i < 100; ++i) { const QString fileName = "sftptestfile" + QString::number(i + 1); QFile file(dirForFilesToUpload.path() + '/' + fileName); QVERIFY2(file.open(QIODevice::WriteOnly), qPrintable(file.errorString())); @@ -414,7 +416,7 @@ void tst_Ssh::sftp() QTimer timer; QObject::connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit); timer.setSingleShot(true); - timer.setInterval((params.timeout + 5) * 1000); + timer.setInterval(30 * 1000); timer.start(); upload->start(); loop.exec(); @@ -454,7 +456,7 @@ void tst_Ssh::sftp() // Download the uploaded files to a different location const QStringList allUploadedFileNames = QDir(dirForFilesToUpload.path()).entryList(QDir::Files); - QCOMPARE(allUploadedFileNames.size(), 1001); + QCOMPARE(allUploadedFileNames.size(), 101); for (const QString &fileName : allUploadedFileNames) { const QString localFilePath = dirForFilesToUpload.path() + '/' + fileName; const QString remoteFilePath = getRemoteFilePath(fileName); @@ -463,7 +465,7 @@ void tst_Ssh::sftp() QVERIFY(downloadJob != SftpInvalidJob); jobs << downloadJob; } - QCOMPARE(jobs.size(), 1001); + QCOMPARE(jobs.size(), 101); loop.exec(); QVERIFY(!invalidFinishedSignal); QVERIFY2(jobError.isEmpty(), qPrintable(jobError)); @@ -491,6 +493,7 @@ void tst_Ssh::sftp() } // Remove the uploaded files on the remote system + timer.setInterval((params.timeout + 5) * 1000); for (const QString &fileName : allUploadedFileNames) { const QString remoteFilePath = getRemoteFilePath(fileName); const SftpJobId removeJob = sftpChannel->removeFile(remoteFilePath); diff --git a/tests/auto/toolchaincache/CMakeLists.txt b/tests/auto/toolchaincache/CMakeLists.txt new file mode 100644 index 0000000000..5a2115f09b --- /dev/null +++ b/tests/auto/toolchaincache/CMakeLists.txt @@ -0,0 +1,5 @@ +add_qtc_test(tst_toolchaincache + DEPENDS ProjectExplorer Qt5::Gui + INCLUDES "${CMAKE_SOURCE_DIR}/src/libs" + SOURCES tst_toolchaincache.cpp +) diff --git a/tests/auto/toolchaincache/toolchaincache.pro b/tests/auto/toolchaincache/toolchaincache.pro index 5dea077c20..cdb1ca0bb7 100644 --- a/tests/auto/toolchaincache/toolchaincache.pro +++ b/tests/auto/toolchaincache/toolchaincache.pro @@ -1,5 +1,3 @@ -QT -= gui - include(../qttest.pri) SOURCES += \ diff --git a/tests/auto/toolchaincache/toolchaincache.qbs b/tests/auto/toolchaincache/toolchaincache.qbs index c814441539..7f1a2adbf1 100644 --- a/tests/auto/toolchaincache/toolchaincache.qbs +++ b/tests/auto/toolchaincache/toolchaincache.qbs @@ -3,6 +3,7 @@ import qbs QtcAutotest { name: "ToolChainCache autotest" Depends { name: "ProjectExplorer" } + Depends { name: "Qt.gui" } // For QIcon in Task Group { name: "Test sources" files: "tst_toolchaincache.cpp" diff --git a/tests/auto/tracing/CMakeLists.txt b/tests/auto/tracing/CMakeLists.txt new file mode 100644 index 0000000000..5ad3ed915d --- /dev/null +++ b/tests/auto/tracing/CMakeLists.txt @@ -0,0 +1,14 @@ +add_subdirectory(flamegraph) +add_subdirectory(flamegraphview) +add_subdirectory(timelineabstractrenderer) +add_subdirectory(timelineitemsrenderpass) +add_subdirectory(timelinemodel) +add_subdirectory(timelinemodelaggregator) +add_subdirectory(timelinenotesmodel) +add_subdirectory(timelinenotesrenderpass) +add_subdirectory(timelineoverviewrenderer) +add_subdirectory(timelinerenderer) +add_subdirectory(timelinerenderpass) +add_subdirectory(timelinerenderstate) +add_subdirectory(timelineselectionrenderpass) +add_subdirectory(timelinezoomcontrol) diff --git a/tests/auto/tracing/flamegraph/CMakeLists.txt b/tests/auto/tracing/flamegraph/CMakeLists.txt new file mode 100644 index 0000000000..eee7081aa2 --- /dev/null +++ b/tests/auto/tracing/flamegraph/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_tracing_flamegraph + DEPENDS Tracing Qt5::Quick + SOURCES tst_flamegraph.cpp +) diff --git a/tests/auto/tracing/flamegraphview/CMakeLists.txt b/tests/auto/tracing/flamegraphview/CMakeLists.txt new file mode 100644 index 0000000000..2a247c9ea1 --- /dev/null +++ b/tests/auto/tracing/flamegraphview/CMakeLists.txt @@ -0,0 +1,6 @@ +add_qtc_test(tst_tracing_flamegraphview + DEPENDS Tracing Qt5::QuickWidgets Qt5::Quick Utils + SOURCES + tst_flamegraphview.cpp + flamegraphview.qrc +) diff --git a/tests/auto/tracing/timelineabstractrenderer/CMakeLists.txt b/tests/auto/tracing/timelineabstractrenderer/CMakeLists.txt new file mode 100644 index 0000000000..5bf14c179c --- /dev/null +++ b/tests/auto/tracing/timelineabstractrenderer/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_tracing_timelineabstractrenderer + DEPENDS Tracing Qt5::Gui Qt5::Quick + SOURCES tst_timelineabstractrenderer.cpp +) diff --git a/tests/auto/tracing/timelineitemsrenderpass/CMakeLists.txt b/tests/auto/tracing/timelineitemsrenderpass/CMakeLists.txt new file mode 100644 index 0000000000..056880e54c --- /dev/null +++ b/tests/auto/tracing/timelineitemsrenderpass/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_tracing_timelineitemsrenderpass + DEPENDS Tracing Qt5::Quick + SOURCES tst_timelineitemsrenderpass.cpp +) diff --git a/tests/auto/tracing/timelinemodel/CMakeLists.txt b/tests/auto/tracing/timelinemodel/CMakeLists.txt new file mode 100644 index 0000000000..198f71e9b8 --- /dev/null +++ b/tests/auto/tracing/timelinemodel/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_tracing_timelinemodel + DEPENDS Tracing Qt5::Gui + SOURCES tst_timelinemodel.cpp +) diff --git a/tests/auto/tracing/timelinemodelaggregator/CMakeLists.txt b/tests/auto/tracing/timelinemodelaggregator/CMakeLists.txt new file mode 100644 index 0000000000..7845c6ad51 --- /dev/null +++ b/tests/auto/tracing/timelinemodelaggregator/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_tracing_timelinemodelaggregator + DEPENDS Tracing Qt5::Gui + SOURCES tst_timelinemodelaggregator.cpp +) diff --git a/tests/auto/tracing/timelinenotesmodel/CMakeLists.txt b/tests/auto/tracing/timelinenotesmodel/CMakeLists.txt new file mode 100644 index 0000000000..d59241ad98 --- /dev/null +++ b/tests/auto/tracing/timelinenotesmodel/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_tracing_timelinenotesmodel + DEPENDS Tracing Qt5::Gui + SOURCES tst_timelinenotesmodel.cpp +) diff --git a/tests/auto/tracing/timelinenotesrenderpass/CMakeLists.txt b/tests/auto/tracing/timelinenotesrenderpass/CMakeLists.txt new file mode 100644 index 0000000000..4bed7af0d5 --- /dev/null +++ b/tests/auto/tracing/timelinenotesrenderpass/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_tracing_timelinenotesrenderpass + DEPENDS Tracing Qt5::Quick + SOURCES tst_timelinenotesrenderpass.cpp +) diff --git a/tests/auto/tracing/timelineoverviewrenderer/CMakeLists.txt b/tests/auto/tracing/timelineoverviewrenderer/CMakeLists.txt new file mode 100644 index 0000000000..275765765d --- /dev/null +++ b/tests/auto/tracing/timelineoverviewrenderer/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_tracing_timelineoverviewrenderer + DEPENDS Tracing Qt5::Quick + SOURCES tst_timelineoverviewrenderer.cpp +) diff --git a/tests/auto/tracing/timelinerenderer/CMakeLists.txt b/tests/auto/tracing/timelinerenderer/CMakeLists.txt new file mode 100644 index 0000000000..30e44a5cd2 --- /dev/null +++ b/tests/auto/tracing/timelinerenderer/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_tracing_timelinerenderer + DEPENDS Tracing Qt5::Gui Qt5::Quick + SOURCES tst_timelinerenderer.cpp +) diff --git a/tests/auto/tracing/timelinerenderpass/CMakeLists.txt b/tests/auto/tracing/timelinerenderpass/CMakeLists.txt new file mode 100644 index 0000000000..3f0cd33f20 --- /dev/null +++ b/tests/auto/tracing/timelinerenderpass/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_tracing_timelinerenderpass + DEPENDS Tracing + SOURCES tst_timelinerenderpass.cpp +) diff --git a/tests/auto/tracing/timelinerenderstate/CMakeLists.txt b/tests/auto/tracing/timelinerenderstate/CMakeLists.txt new file mode 100644 index 0000000000..53f0b67415 --- /dev/null +++ b/tests/auto/tracing/timelinerenderstate/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_tracing_timelinerenderstate + DEPENDS Tracing Qt5::Gui Qt5::Quick + SOURCES tst_timelinerenderstate.cpp +) diff --git a/tests/auto/tracing/timelineselectionrenderpass/CMakeLists.txt b/tests/auto/tracing/timelineselectionrenderpass/CMakeLists.txt new file mode 100644 index 0000000000..a3e3c9af67 --- /dev/null +++ b/tests/auto/tracing/timelineselectionrenderpass/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_tracing_timelineselectionrenderpass + DEPENDS Tracing Qt5::Quick + SOURCES tst_timelineselectionrenderpass.cpp +) diff --git a/tests/auto/tracing/timelinezoomcontrol/CMakeLists.txt b/tests/auto/tracing/timelinezoomcontrol/CMakeLists.txt new file mode 100644 index 0000000000..1e5f7989e9 --- /dev/null +++ b/tests/auto/tracing/timelinezoomcontrol/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_tracing_timelinezoomcontrol + DEPENDS Tracing Qt5::Gui + SOURCES tst_timelinezoomcontrol.cpp +) diff --git a/tests/auto/treeviewfind/CMakeLists.txt b/tests/auto/treeviewfind/CMakeLists.txt new file mode 100644 index 0000000000..6ce09aa209 --- /dev/null +++ b/tests/auto/treeviewfind/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_treeviewfind + DEPENDS Core + SOURCES tst_treeviewfind.cpp +) diff --git a/tests/auto/utils/CMakeLists.txt b/tests/auto/utils/CMakeLists.txt new file mode 100644 index 0000000000..74f1d6f819 --- /dev/null +++ b/tests/auto/utils/CMakeLists.txt @@ -0,0 +1,7 @@ +add_subdirectory(ansiescapecodehandler) +add_subdirectory(fileutils) +add_subdirectory(fuzzymatcher) +add_subdirectory(settings) +add_subdirectory(stringutils) +add_subdirectory(templateengine) +add_subdirectory(treemodel) diff --git a/tests/auto/utils/ansiescapecodehandler/CMakeLists.txt b/tests/auto/utils/ansiescapecodehandler/CMakeLists.txt new file mode 100644 index 0000000000..971849d8b2 --- /dev/null +++ b/tests/auto/utils/ansiescapecodehandler/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_utils_ansiescapecodehandler + DEPENDS Utils + SOURCES tst_ansiescapecodehandler.cpp +) diff --git a/tests/auto/utils/fileutils/CMakeLists.txt b/tests/auto/utils/fileutils/CMakeLists.txt new file mode 100644 index 0000000000..0f766bc999 --- /dev/null +++ b/tests/auto/utils/fileutils/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_utils_fileutils + DEPENDS Utils + SOURCES tst_fileutils.cpp +) diff --git a/tests/auto/utils/fileutils/tst_fileutils.cpp b/tests/auto/utils/fileutils/tst_fileutils.cpp index 2b588c533e..2102bd0f06 100644 --- a/tests/auto/utils/fileutils/tst_fileutils.cpp +++ b/tests/auto/utils/fileutils/tst_fileutils.cpp @@ -80,7 +80,7 @@ void tst_fileutils::parentDir() QFETCH(QString, parentPath); QFETCH(QString, expectFailMessage); - FileName result = FileName::fromString(path).parentDir(); + FilePath result = FilePath::fromString(path).parentDir(); if (!expectFailMessage.isEmpty()) QEXPECT_FAIL("", expectFailMessage.toUtf8().constData(), Continue); QCOMPARE(result.toString(), parentPath); @@ -120,7 +120,7 @@ void tst_fileutils::isChildOf() QFETCH(QString, childPath); QFETCH(bool, result); - bool res = FileName::fromString(childPath).isChildOf(FileName::fromString(path)); + bool res = FilePath::fromString(childPath).isChildOf(FilePath::fromString(path)); QCOMPARE(res, result); } @@ -161,7 +161,7 @@ void tst_fileutils::fileName() QFETCH(QString, path); QFETCH(int, components); QFETCH(QString, result); - QCOMPARE(FileName::fromString(path).fileName(components), result); + QCOMPARE(FilePath::fromString(path).fileName(components), result); } QTEST_APPLESS_MAIN(tst_fileutils) diff --git a/tests/auto/utils/fuzzymatcher/CMakeLists.txt b/tests/auto/utils/fuzzymatcher/CMakeLists.txt new file mode 100644 index 0000000000..fb5198fe08 --- /dev/null +++ b/tests/auto/utils/fuzzymatcher/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_utils_fuzzymatcher + DEPENDS Utils + SOURCES tst_fuzzymatcher.cpp +) diff --git a/tests/auto/utils/settings/CMakeLists.txt b/tests/auto/utils/settings/CMakeLists.txt new file mode 100644 index 0000000000..5bf072b08a --- /dev/null +++ b/tests/auto/utils/settings/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_utils_settings + DEPENDS Utils + SOURCES tst_settings.cpp +) diff --git a/tests/auto/utils/settings/tst_settings.cpp b/tests/auto/utils/settings/tst_settings.cpp index 867f9bbe91..931c601a6e 100644 --- a/tests/auto/utils/settings/tst_settings.cpp +++ b/tests/auto/utils/settings/tst_settings.cpp @@ -70,18 +70,18 @@ public: class BasicTestSettingsAccessor : public Utils::MergingSettingsAccessor { public: - BasicTestSettingsAccessor(const Utils::FileName &baseName = Utils::FileName::fromString("/foo/bar"), + BasicTestSettingsAccessor(const Utils::FilePath &baseName = Utils::FilePath::fromString("/foo/bar"), const QByteArray &id = QByteArray(TESTACCESSOR_DEFAULT_ID)); using Utils::MergingSettingsAccessor::addVersionUpgrader; - QHash<Utils::FileName, QVariantMap> files() const { return m_files; } - void addFile(const Utils::FileName &path, const QVariantMap &data) const { m_files.insert(path, data); } - Utils::FileNameList fileNames() const { return m_files.keys(); } - QVariantMap fileContents(const Utils::FileName &path) const { return m_files.value(path); } + QHash<Utils::FilePath, QVariantMap> files() const { return m_files; } + void addFile(const Utils::FilePath &path, const QVariantMap &data) const { m_files.insert(path, data); } + Utils::FilePathList fileNames() const { return m_files.keys(); } + QVariantMap fileContents(const Utils::FilePath &path) const { return m_files.value(path); } protected: - RestoreData readFile(const Utils::FileName &path) const override + RestoreData readFile(const Utils::FilePath &path) const override { if (!m_files.contains(path)) return RestoreData("File not found.", "File not found.", Issue::Type::ERROR); @@ -108,7 +108,7 @@ protected: return qMakePair(key, secondary); } - Utils::optional<Issue> writeFile(const Utils::FileName &path, const QVariantMap &data) const override + Utils::optional<Issue> writeFile(const Utils::FilePath &path, const QVariantMap &data) const override { if (data.isEmpty()) { return Issue(QCoreApplication::translate("Utils::SettingsAccessor", "Failed to Write File"), @@ -121,7 +121,7 @@ protected: } private: - mutable QHash<Utils::FileName, QVariantMap> m_files; + mutable QHash<Utils::FilePath, QVariantMap> m_files; }; // -------------------------------------------------------------------- @@ -137,10 +137,10 @@ public: VersionedBackUpStrategy(accessor) { } - FileNameList readFileCandidates(const Utils::FileName &baseFileName) const + FilePathList readFileCandidates(const Utils::FilePath &baseFileName) const { return Utils::filtered(static_cast<const BasicTestSettingsAccessor *>(accessor())->fileNames(), - [&baseFileName](const Utils::FileName &f) { + [&baseFileName](const Utils::FilePath &f) { return f.parentDir() == baseFileName.parentDir() && f.toString().startsWith(baseFileName.toString()); }); } @@ -153,7 +153,7 @@ public: class TestSettingsAccessor : public BasicTestSettingsAccessor { public: - TestSettingsAccessor(const Utils::FileName &baseName = Utils::FileName::fromString("/foo/baz"), + TestSettingsAccessor(const Utils::FilePath &baseName = Utils::FilePath::fromString("/foo/baz"), const QByteArray &id = QByteArray(TESTACCESSOR_DEFAULT_ID)) : BasicTestSettingsAccessor(baseName, id) { @@ -166,7 +166,7 @@ public: using Utils::MergingSettingsAccessor::upgradeSettings; }; -BasicTestSettingsAccessor::BasicTestSettingsAccessor(const FileName &baseName, const QByteArray &id) : +BasicTestSettingsAccessor::BasicTestSettingsAccessor(const FilePath &baseName, const QByteArray &id) : Utils::MergingSettingsAccessor(std::make_unique<TestBackUpStrategy>(this), "TestData", TESTACCESSOR_DN, TESTACCESSOR_APPLICATION_DN) { @@ -235,7 +235,7 @@ static QVariantMap versionedMap(int version, const QByteArray &id = QByteArray() return result; } -static Utils::SettingsAccessor::RestoreData restoreData(const Utils::FileName &path, +static Utils::SettingsAccessor::RestoreData restoreData(const Utils::FilePath &path, const QVariantMap &data) { return Utils::SettingsAccessor::RestoreData(path, data); @@ -244,7 +244,7 @@ static Utils::SettingsAccessor::RestoreData restoreData(const Utils::FileName &p static Utils::SettingsAccessor::RestoreData restoreData(const QByteArray &path, const QVariantMap &data) { - return restoreData(Utils::FileName::fromUtf8(path), data); + return restoreData(Utils::FilePath::fromUtf8(path), data); } void tst_SettingsAccessor::addVersionUpgrader() @@ -365,7 +365,7 @@ void tst_SettingsAccessor::RestoreDataCompare_idMismatch() void tst_SettingsAccessor::RestoreDataCompare_noId() { - const TestSettingsAccessor accessor(Utils::FileName::fromString("/foo/baz"), QByteArray()); + const TestSettingsAccessor accessor(Utils::FilePath::fromString("/foo/baz"), QByteArray()); Utils::SettingsAccessor::RestoreData a = restoreData("/foo/bar", versionedMap(5, TESTACCESSOR_DEFAULT_ID)); Utils::SettingsAccessor::RestoreData b = restoreData("/foo/baz", versionedMap(6, "foo")); @@ -667,7 +667,7 @@ void tst_SettingsAccessor::findIssues_nonDefaultPath() void tst_SettingsAccessor::saveSettings() { - const Utils::FileName baseFile = Utils::FileName::fromString("/tmp/foo/saveSettings"); + const Utils::FilePath baseFile = Utils::FilePath::fromString("/tmp/foo/saveSettings"); const TestSettingsAccessor accessor(baseFile); const QVariantMap data = versionedMap(6, TESTACCESSOR_DEFAULT_ID); @@ -691,7 +691,7 @@ void tst_SettingsAccessor::saveSettings() void tst_SettingsAccessor::loadSettings() { const QVariantMap data = versionedMap(6, "loadSettings", generateExtraData()); - const Utils::FileName path = Utils::FileName::fromString("/tmp/foo/loadSettings"); + const Utils::FilePath path = Utils::FilePath::fromString("/tmp/foo/loadSettings"); const TestSettingsAccessor accessor(path, "loadSettings"); accessor.addFile(path, data); QCOMPARE(accessor.files().count(), 1); // Catch changes early:-) @@ -719,17 +719,17 @@ void tst_SettingsAccessor::loadSettings() void tst_SettingsAccessor::loadSettings_pickBest() { - const Utils::FileName path = Utils::FileName::fromString("/tmp/foo/loadSettings"); + const Utils::FilePath path = Utils::FilePath::fromString("/tmp/foo/loadSettings"); const TestSettingsAccessor accessor(path, "loadSettings"); accessor.addFile(path, versionedMap(10, "loadSettings", generateExtraData())); // too new const QVariantMap data = versionedMap(7, "loadSettings", generateExtraData()); - accessor.addFile(Utils::FileName::fromString("/tmp/foo/loadSettings.foo"), data); // pick this! - accessor.addFile(Utils::FileName::fromString("/tmp/foo/loadSettings.foo1"), + accessor.addFile(Utils::FilePath::fromString("/tmp/foo/loadSettings.foo"), data); // pick this! + accessor.addFile(Utils::FilePath::fromString("/tmp/foo/loadSettings.foo1"), versionedMap(8, "fooSettings", generateExtraData())); // wrong environment - accessor.addFile(Utils::FileName::fromString("/tmp/foo/loadSettings.bar"), + accessor.addFile(Utils::FilePath::fromString("/tmp/foo/loadSettings.bar"), versionedMap(6, "loadSettings", generateExtraData())); // too old - accessor.addFile(Utils::FileName::fromString("/tmp/foo/loadSettings.baz"), + accessor.addFile(Utils::FilePath::fromString("/tmp/foo/loadSettings.baz"), versionedMap(1, "loadSettings", generateExtraData())); // much too old QCOMPARE(accessor.files().count(), 5); // Catch changes early:-) diff --git a/tests/auto/utils/stringutils/CMakeLists.txt b/tests/auto/utils/stringutils/CMakeLists.txt new file mode 100644 index 0000000000..9d77c71d86 --- /dev/null +++ b/tests/auto/utils/stringutils/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_utils_stringutils + DEPENDS Utils + SOURCES tst_stringutils.cpp +) diff --git a/tests/auto/utils/stringutils/tst_stringutils.cpp b/tests/auto/utils/stringutils/tst_stringutils.cpp index 8e51c89300..98e04185ab 100644 --- a/tests/auto/utils/stringutils/tst_stringutils.cpp +++ b/tests/auto/utils/stringutils/tst_stringutils.cpp @@ -68,6 +68,14 @@ public: *ret = "bar"; return true; } + if (name == "JS:with } inside") { + *ret = "yay"; + return true; + } + if (name == "JS:literal%{") { + *ret = "hurray"; + return true; + } return false; } }; @@ -158,7 +166,9 @@ void tst_StringUtils::testMacroExpander_data() {"%{hihi//./c}", "ccc"}, {"%{hihi/(.)(.)r/\\2\\1c}", "abc"}, // no escape for capture groups {"%{hihi/b/c/d}", "c/dar"}, - {"%{hihi/a/e{\\}e}", "be{}er"}, // escape closing brace + {"%{hihi/a/e{\\}e}", "be{}er"}, // escape closing brace + {"%{JS:with \\} inside}", "yay"}, // escape closing brace also in JS: + {"%{JS:literal%\\{}", "hurray"}, {"%{slash/o\\/b/ol's c}", "fool's car"}, {"%{sl\\/sh/(.)(a)(.)/\\2\\1\\3as}", "salsash"}, // escape in variable name {"%{JS:foo/b/c}", "%{JS:foo/b/c}"}, // No replacement for JS (all considered varName) diff --git a/tests/auto/utils/templateengine/CMakeLists.txt b/tests/auto/utils/templateengine/CMakeLists.txt new file mode 100644 index 0000000000..bb13af8817 --- /dev/null +++ b/tests/auto/utils/templateengine/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_utils_templateengine + DEPENDS Utils + SOURCES tst_templateengine.cpp +) diff --git a/tests/auto/utils/treemodel/CMakeLists.txt b/tests/auto/utils/treemodel/CMakeLists.txt new file mode 100644 index 0000000000..487afcefd7 --- /dev/null +++ b/tests/auto/utils/treemodel/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qtc_test(tst_utils_treemodel + DEPENDS Utils + SOURCES tst_treemodel.cpp +) diff --git a/tests/auto/valgrind/callgrind/modeltest.cpp b/tests/auto/valgrind/callgrind/modeltest.cpp index c02b23bf6d..6197f632d6 100644 --- a/tests/auto/valgrind/callgrind/modeltest.cpp +++ b/tests/auto/valgrind/callgrind/modeltest.cpp @@ -85,7 +85,7 @@ ModelTestWidget::ModelTestWidget(CallgrindWidgetHandler *handler) m_format->addItem("absolute", CostDelegate::FormatAbsolute); m_format->addItem("relative", CostDelegate::FormatRelative); m_format->addItem("rel. to parent", CostDelegate::FormatRelativeToParent); - connect(m_format, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), + connect(m_format, QOverload<int>::of(&QComboBox::activated), this, &ModelTestWidget::formatChanged); h->addWidget(m_format); diff --git a/tests/auto/valgrind/memcheck/memcheck.qbs b/tests/auto/valgrind/memcheck/memcheck.qbs index c633a605a3..d695ba30a0 100644 --- a/tests/auto/valgrind/memcheck/memcheck.qbs +++ b/tests/auto/valgrind/memcheck/memcheck.qbs @@ -2,6 +2,7 @@ import qbs Project { name: "Memcheck autotests" + condition: !qbs.targetOS.contains("windows") references: [ "testapps/testapps.qbs", "modeldemo.qbs" diff --git a/tests/auto/valgrind/valgrind.qbs b/tests/auto/valgrind/valgrind.qbs index af50a1e889..23b7e2cdbb 100644 --- a/tests/auto/valgrind/valgrind.qbs +++ b/tests/auto/valgrind/valgrind.qbs @@ -2,7 +2,6 @@ import qbs Project { name: "Valgrind autotests" - condition: !qbs.targetOS.contains("windows") references: [ "callgrind/callgrind.qbs", "memcheck/memcheck.qbs" |