forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/12.0'
Change-Id: I2594f193260a103e1c4484fcab974213c881353d
This commit is contained in:
25
dist/changelog/changes-12.0.0.md
vendored
25
dist/changelog/changes-12.0.0.md
vendored
@@ -145,6 +145,12 @@ Editing
|
|||||||
|
|
||||||
### QML
|
### QML
|
||||||
|
|
||||||
|
* Fixed multiple crashes when updating the `Outline` view
|
||||||
|
([QTCREATORBUG-28862](https://bugreports.qt.io/browse/QTCREATORBUG-28862),
|
||||||
|
[QTCREATORBUG-29653](https://bugreports.qt.io/browse/QTCREATORBUG-29653),
|
||||||
|
[QTCREATORBUG-29702](https://bugreports.qt.io/browse/QTCREATORBUG-29702))
|
||||||
|
* Fixed that reformatting QML code removed type annotations
|
||||||
|
([QTCREATORBUG-29061](https://bugreports.qt.io/browse/QTCREATORBUG-29061))
|
||||||
* Fixed invalid `M325` warnings
|
* Fixed invalid `M325` warnings
|
||||||
([QTCREATORBUG-29601](https://bugreports.qt.io/browse/QTCREATORBUG-29601))
|
([QTCREATORBUG-29601](https://bugreports.qt.io/browse/QTCREATORBUG-29601))
|
||||||
* Language Server
|
* Language Server
|
||||||
@@ -237,6 +243,8 @@ Projects
|
|||||||
* Fixed issues with the subdirectory structure of the project tree
|
* Fixed issues with the subdirectory structure of the project tree
|
||||||
([QTCREATORBUG-23942](https://bugreports.qt.io/browse/QTCREATORBUG-23942),
|
([QTCREATORBUG-23942](https://bugreports.qt.io/browse/QTCREATORBUG-23942),
|
||||||
[QTCREATORBUG-29105](https://bugreports.qt.io/browse/QTCREATORBUG-29105))
|
[QTCREATORBUG-29105](https://bugreports.qt.io/browse/QTCREATORBUG-29105))
|
||||||
|
* Fixed an issue with source file specific compiler flags
|
||||||
|
([QTCREATORBUG-29707](https://bugreports.qt.io/browse/QTCREATORBUG-29707))
|
||||||
* Presets
|
* Presets
|
||||||
* Fixed that variables were not expanded for `cmakeExecutable`
|
* Fixed that variables were not expanded for `cmakeExecutable`
|
||||||
([QTCREATORBUG-29643](https://bugreports.qt.io/browse/QTCREATORBUG-29643))
|
([QTCREATORBUG-29643](https://bugreports.qt.io/browse/QTCREATORBUG-29643))
|
||||||
@@ -258,6 +266,11 @@ Projects
|
|||||||
* Fixed the project tree structure in case of some subfolder structures
|
* Fixed the project tree structure in case of some subfolder structures
|
||||||
([QTCREATORBUG-29733](https://bugreports.qt.io/browse/QTCREATORBUG-29733))
|
([QTCREATORBUG-29733](https://bugreports.qt.io/browse/QTCREATORBUG-29733))
|
||||||
|
|
||||||
|
### Qbs
|
||||||
|
|
||||||
|
* Fixed the importing of builds on macOS
|
||||||
|
([QTCREATORBUG-29829](https://bugreports.qt.io/browse/QTCREATORBUG-29829))
|
||||||
|
|
||||||
### vcpkg
|
### vcpkg
|
||||||
|
|
||||||
* Added the generation of code for `CMakeLists.txt`
|
* Added the generation of code for `CMakeLists.txt`
|
||||||
@@ -279,6 +292,11 @@ Debugging
|
|||||||
* Added support for remote Linux debugging with LLDB
|
* Added support for remote Linux debugging with LLDB
|
||||||
* Fixed warnings about index cache permissions
|
* Fixed warnings about index cache permissions
|
||||||
([QTCREATORBUG-29556](https://bugreports.qt.io/browse/QTCREATORBUG-29556))
|
([QTCREATORBUG-29556](https://bugreports.qt.io/browse/QTCREATORBUG-29556))
|
||||||
|
* Pretty Printers
|
||||||
|
* Fixed `QDateTime` with a time zone offset
|
||||||
|
([QTCREATORBUG-29737](https://bugreports.qt.io/browse/QTCREATORBUG-29737))
|
||||||
|
* Fixed `std::unique_ptr` on macOS
|
||||||
|
* Fixed `QImage`
|
||||||
|
|
||||||
Analyzer
|
Analyzer
|
||||||
--------
|
--------
|
||||||
@@ -325,10 +343,17 @@ Test Integration
|
|||||||
* Added an option for the number of threads used for scanning
|
* Added an option for the number of threads used for scanning
|
||||||
([QTCREATORBUG-29301](https://bugreports.qt.io/browse/QTCREATORBUG-29301))
|
([QTCREATORBUG-29301](https://bugreports.qt.io/browse/QTCREATORBUG-29301))
|
||||||
* Improved the wizards for `GTest` and `Catch2`
|
* Improved the wizards for `GTest` and `Catch2`
|
||||||
|
* CTest
|
||||||
|
* Enabled colored test output
|
||||||
|
|
||||||
Platforms
|
Platforms
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
### macOS
|
||||||
|
|
||||||
|
* Fixed running and debugging in an external terminal
|
||||||
|
([QTCREATORBUG-29246](https://bugreports.qt.io/browse/QTCREATORBUG-29246))
|
||||||
|
|
||||||
### Android
|
### Android
|
||||||
|
|
||||||
* Fixed issues when `LIBRARY_OUTPUT_DIRECTORY` is set in the CMake build files
|
* Fixed issues when `LIBRARY_OUTPUT_DIRECTORY` is set in the CMake build files
|
||||||
|
@@ -11,6 +11,8 @@
|
|||||||
You can connect iOS devices to your local machine with a USB cable to
|
You can connect iOS devices to your local machine with a USB cable to
|
||||||
run applications built for them from \QC.
|
run applications built for them from \QC.
|
||||||
|
|
||||||
|
\note Deployment, running, and debugging on iOS 17 devices are not supported.
|
||||||
|
|
||||||
To be able to use \QC on \macos, you must install Xcode, and therefore,
|
To be able to use \QC on \macos, you must install Xcode, and therefore,
|
||||||
you already have the tool chain for building applications for iOS. \QC
|
you already have the tool chain for building applications for iOS. \QC
|
||||||
automatically detects the tool chain and creates the necessary
|
automatically detects the tool chain and creates the necessary
|
||||||
|
@@ -48,6 +48,8 @@
|
|||||||
|
|
||||||
\section1 iOS
|
\section1 iOS
|
||||||
|
|
||||||
|
\note Deployment, running, and debugging on iOS 17 devices are not supported.
|
||||||
|
|
||||||
To be able to use \QC on \macos, you must install Xcode, and therefore
|
To be able to use \QC on \macos, you must install Xcode, and therefore
|
||||||
you should already have the tool chain for building applications for
|
you should already have the tool chain for building applications for
|
||||||
iOS. \QC automatically detects the tool chain and creates the necessary
|
iOS. \QC automatically detects the tool chain and creates the necessary
|
||||||
|
@@ -69,8 +69,7 @@
|
|||||||
\li \image ok.png
|
\li \image ok.png
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
\note UWP support was removed from \QC 8.0.
|
\note Deployment, running, and debugging on iOS 17 devices are not supported.
|
||||||
To develop for UWP using Qt 5, use \QC 7.0, or earlier.
|
|
||||||
|
|
||||||
\QC automatically runs scheduled checks for updates based on the settings
|
\QC automatically runs scheduled checks for updates based on the settings
|
||||||
specified in \preferences > \uicontrol Environment > \uicontrol Update.
|
specified in \preferences > \uicontrol Environment > \uicontrol Update.
|
||||||
|
@@ -1282,6 +1282,10 @@ protected:
|
|||||||
out(ast->rparenToken);
|
out(ast->rparenToken);
|
||||||
if (ast->isArrowFunction && !ast->formals)
|
if (ast->isArrowFunction && !ast->formals)
|
||||||
out("()");
|
out("()");
|
||||||
|
if (ast->typeAnnotation) {
|
||||||
|
out(": ");
|
||||||
|
out(ast->typeAnnotation->type->toString());
|
||||||
|
}
|
||||||
out(" ");
|
out(" ");
|
||||||
if (ast->isArrowFunction)
|
if (ast->isArrowFunction)
|
||||||
out("=> ");
|
out("=> ");
|
||||||
@@ -1406,6 +1410,10 @@ protected:
|
|||||||
{
|
{
|
||||||
for (FormalParameterList *it = ast; it; it = it->next) {
|
for (FormalParameterList *it = ast; it; it = it->next) {
|
||||||
accept(it->element);
|
accept(it->element);
|
||||||
|
if (it->element->typeAnnotation) {
|
||||||
|
out(": ");
|
||||||
|
out(it->element->typeAnnotation->type->toString());
|
||||||
|
}
|
||||||
if (it->next)
|
if (it->next)
|
||||||
out(", ");
|
out(", ");
|
||||||
}
|
}
|
||||||
|
@@ -124,31 +124,7 @@ public:
|
|||||||
&& prj->hasMakeInstallEquivalent();
|
&& prj->hasMakeInstallEquivalent();
|
||||||
});
|
});
|
||||||
addInitialStep(Qdb::Constants::QdbStopApplicationStepId);
|
addInitialStep(Qdb::Constants::QdbStopApplicationStepId);
|
||||||
addInitialStep(RemoteLinux::Constants::GenericDeployStepId, [](Target *target) {
|
addInitialStep(RemoteLinux::Constants::GenericDeployStepId);
|
||||||
auto device = DeviceKitAspect::device(target->kit());
|
|
||||||
auto buildDevice = BuildDeviceKitAspect::device(target->kit());
|
|
||||||
if (buildDevice && buildDevice->rootPath().needsDevice())
|
|
||||||
return false;
|
|
||||||
return !device || (device
|
|
||||||
&& device->extraData(ProjectExplorer::Constants::SUPPORTS_RSYNC).toBool());
|
|
||||||
});
|
|
||||||
addInitialStep(RemoteLinux::Constants::DirectUploadStepId, [](Target *target) {
|
|
||||||
auto device = DeviceKitAspect::device(target->kit());
|
|
||||||
auto buildDevice = BuildDeviceKitAspect::device(target->kit());
|
|
||||||
if (buildDevice && buildDevice->rootPath().needsDevice())
|
|
||||||
return false;
|
|
||||||
return device && !device->extraData(ProjectExplorer::Constants::SUPPORTS_RSYNC).toBool();
|
|
||||||
});
|
|
||||||
// This step is for:
|
|
||||||
// a) A remote build device, as they do not support real rsync yet.
|
|
||||||
// b) If there is no target device setup yet.
|
|
||||||
addInitialStep(RemoteLinux::Constants::DirectUploadStepId, [](Target *target) {
|
|
||||||
auto device = DeviceKitAspect::device(target->kit());
|
|
||||||
auto buildDevice = BuildDeviceKitAspect::device(target->kit());
|
|
||||||
if (buildDevice && buildDevice->rootPath().needsDevice())
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
#include <cppeditor/clangdiagnosticconfigsmodel.h>
|
#include <cppeditor/clangdiagnosticconfigsmodel.h>
|
||||||
|
#include <cppeditor/cppprojectfile.h>
|
||||||
#include <cppeditor/cpptoolsreuse.h>
|
#include <cppeditor/cpptoolsreuse.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
@@ -76,14 +77,17 @@ static QStringList checksArguments(const AnalyzeInputData &input)
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static QStringList clangArguments(const ClangDiagnosticConfig &diagnosticConfig,
|
static QStringList clangArguments(const AnalyzeInputData &input)
|
||||||
const QStringList &baseOptions)
|
|
||||||
{
|
{
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
|
const ClangDiagnosticConfig &diagnosticConfig = input.config;
|
||||||
|
const QStringList &baseOptions = input.unit.arguments;
|
||||||
arguments << ClangDiagnosticConfigsModel::globalDiagnosticOptions()
|
arguments << ClangDiagnosticConfigsModel::globalDiagnosticOptions()
|
||||||
<< (isClMode(baseOptions) ? clangArgsForCl(diagnosticConfig.clangOptions())
|
<< (isClMode(baseOptions) ? clangArgsForCl(diagnosticConfig.clangOptions())
|
||||||
: diagnosticConfig.clangOptions())
|
: diagnosticConfig.clangOptions())
|
||||||
<< baseOptions;
|
<< baseOptions;
|
||||||
|
if (ProjectFile::isHeader(input.unit.file))
|
||||||
|
arguments << "-Wno-pragma-once-outside-header";
|
||||||
|
|
||||||
if (LOG().isDebugEnabled())
|
if (LOG().isDebugEnabled())
|
||||||
arguments << QLatin1String("-v");
|
arguments << QLatin1String("-v");
|
||||||
@@ -157,7 +161,7 @@ GroupItem clangToolTask(const AnalyzeInputData &input,
|
|||||||
const QStringList args = checksArguments(input)
|
const QStringList args = checksArguments(input)
|
||||||
+ mainToolArguments(data)
|
+ mainToolArguments(data)
|
||||||
+ QStringList{"--"}
|
+ QStringList{"--"}
|
||||||
+ clangArguments(input.config, input.unit.arguments);
|
+ clangArguments(input);
|
||||||
const CommandLine commandLine = {data.executable, args};
|
const CommandLine commandLine = {data.executable, args};
|
||||||
|
|
||||||
qCDebug(LOG).noquote() << "Starting" << commandLine.toUserOutput();
|
qCDebug(LOG).noquote() << "Starting" << commandLine.toUserOutput();
|
||||||
|
@@ -1789,7 +1789,7 @@ void CMakeBuildSystem::updateQmlJSCodeModel(const QStringList &extraHeaderPaths,
|
|||||||
auto addImports = [&projectInfo](const QString &imports) {
|
auto addImports = [&projectInfo](const QString &imports) {
|
||||||
const QStringList importList = CMakeConfigItem::cmakeSplitValue(imports);
|
const QStringList importList = CMakeConfigItem::cmakeSplitValue(imports);
|
||||||
for (const QString &import : importList)
|
for (const QString &import : importList)
|
||||||
projectInfo.importPaths.maybeInsert(FilePath::fromString(import), QmlJS::Dialect::Qml);
|
projectInfo.importPaths.maybeInsert(FilePath::fromUserInput(import), QmlJS::Dialect::Qml);
|
||||||
};
|
};
|
||||||
|
|
||||||
const CMakeConfig &cm = configurationFromCMake();
|
const CMakeConfig &cm = configurationFromCMake();
|
||||||
|
@@ -209,14 +209,17 @@ SourceEditorWidget::SourceEditorWidget(const std::shared_ptr<SourceSettings> &se
|
|||||||
|
|
||||||
connect(m_codeEditor, &CodeEditorWidget::gotFocus, this, &SourceEditorWidget::gotFocus);
|
connect(m_codeEditor, &CodeEditorWidget::gotFocus, this, &SourceEditorWidget::gotFocus);
|
||||||
|
|
||||||
TextDocumentPtr document = TextDocumentPtr(new SourceTextDocument(m_sourceSettings, undoStack));
|
auto sourceTextDocument = settings->sourceTextDocument();
|
||||||
|
if (!sourceTextDocument)
|
||||||
|
sourceTextDocument = TextDocumentPtr(new SourceTextDocument(m_sourceSettings, undoStack));
|
||||||
|
settings->setSourceTextDocument(sourceTextDocument);
|
||||||
|
|
||||||
connect(document.get(),
|
connect(sourceTextDocument.get(),
|
||||||
&SourceTextDocument::changed,
|
&SourceTextDocument::changed,
|
||||||
this,
|
this,
|
||||||
&SourceEditorWidget::sourceCodeChanged);
|
&SourceEditorWidget::sourceCodeChanged);
|
||||||
|
|
||||||
m_codeEditor->setTextDocument(document);
|
m_codeEditor->setTextDocument(sourceTextDocument);
|
||||||
m_codeEditor->updateHighlighter();
|
m_codeEditor->updateHighlighter();
|
||||||
|
|
||||||
auto addCompilerButton = new QToolButton;
|
auto addCompilerButton = new QToolButton;
|
||||||
|
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include <utils/aspects.h>
|
#include <utils/aspects.h>
|
||||||
|
|
||||||
|
#include <texteditor/textdocument.h>
|
||||||
|
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
namespace CompilerExplorer {
|
namespace CompilerExplorer {
|
||||||
@@ -58,6 +60,12 @@ public:
|
|||||||
|
|
||||||
ApiConfigFunction apiConfigFunction() const { return m_apiConfigFunction; }
|
ApiConfigFunction apiConfigFunction() const { return m_apiConfigFunction; }
|
||||||
|
|
||||||
|
TextEditor::TextDocumentPtr sourceTextDocument() const { return m_sourceTextDocument; }
|
||||||
|
void setSourceTextDocument(TextEditor::TextDocumentPtr sourceTextDocument)
|
||||||
|
{
|
||||||
|
m_sourceTextDocument = sourceTextDocument;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Utils::StringSelectionAspect languageId{this};
|
Utils::StringSelectionAspect languageId{this};
|
||||||
Utils::StringAspect source{this};
|
Utils::StringAspect source{this};
|
||||||
@@ -75,6 +83,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
CompilerExplorerSettings *m_parent;
|
CompilerExplorerSettings *m_parent;
|
||||||
ApiConfigFunction m_apiConfigFunction;
|
ApiConfigFunction m_apiConfigFunction;
|
||||||
|
TextEditor::TextDocumentPtr m_sourceTextDocument{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
class CompilerSettings : public Utils::AspectContainer,
|
class CompilerSettings : public Utils::AspectContainer,
|
||||||
|
@@ -867,7 +867,7 @@ void DapEngine::refreshLocals(const QJsonArray &variables)
|
|||||||
if (currentItem && currentItem->iname.startsWith("watch"))
|
if (currentItem && currentItem->iname.startsWith("watch"))
|
||||||
currentItem->removeChildren();
|
currentItem->removeChildren();
|
||||||
|
|
||||||
for (const QJsonValueConstRef &variable : variables) {
|
for (const auto &variable : variables) {
|
||||||
WatchItem *item = new WatchItem;
|
WatchItem *item = new WatchItem;
|
||||||
const QString name = variable.toObject().value("name").toString();
|
const QString name = variable.toObject().value("name").toString();
|
||||||
|
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
@@ -22,7 +23,8 @@ class HeaderPath
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HeaderPath() = default;
|
HeaderPath() = default;
|
||||||
HeaderPath(const QString &path, HeaderPathType type) : path(path), type(type) { }
|
HeaderPath(const QString &path, HeaderPathType type)
|
||||||
|
: path(QDir::fromNativeSeparators(path)), type(type) { }
|
||||||
HeaderPath(const char *path, HeaderPathType type) : HeaderPath(QLatin1String(path), type) {}
|
HeaderPath(const char *path, HeaderPathType type) : HeaderPath(QLatin1String(path), type) {}
|
||||||
HeaderPath(const Utils::FilePath &path, HeaderPathType type)
|
HeaderPath(const Utils::FilePath &path, HeaderPathType type)
|
||||||
: HeaderPath(path.path(), type)
|
: HeaderPath(path.path(), type)
|
||||||
|
@@ -41,7 +41,6 @@ CodeGenSettings::CodeGenSettings()
|
|||||||
|
|
||||||
addQtVersionCheck.setSettingsKey("AddQtVersionCheck");
|
addQtVersionCheck.setSettingsKey("AddQtVersionCheck");
|
||||||
addQtVersionCheck.setLabelText(Tr::tr("Add Qt version #ifdef for module names"));
|
addQtVersionCheck.setLabelText(Tr::tr("Add Qt version #ifdef for module names"));
|
||||||
addQtVersionCheck.setEnabler(&includeQtModule);
|
|
||||||
|
|
||||||
setLayouter([this] {
|
setLayouter([this] {
|
||||||
using namespace Layouting;
|
using namespace Layouting;
|
||||||
@@ -66,6 +65,7 @@ CodeGenSettings::CodeGenSettings()
|
|||||||
|
|
||||||
|
|
||||||
readSettings();
|
readSettings();
|
||||||
|
addQtVersionCheck.setEnabler(&includeQtModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
class CodeGenSettingsPage final : public Core::IOptionsPage
|
class CodeGenSettingsPage final : public Core::IOptionsPage
|
||||||
|
@@ -28,6 +28,11 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void test();
|
void test();
|
||||||
void test_data();
|
void test_data();
|
||||||
|
|
||||||
|
void reformatter_data();
|
||||||
|
void reformatter();
|
||||||
|
|
||||||
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
tst_Reformatter::tst_Reformatter()
|
tst_Reformatter::tst_Reformatter()
|
||||||
@@ -41,9 +46,17 @@ void tst_Reformatter::test_data()
|
|||||||
{
|
{
|
||||||
QTest::addColumn<QString>("path");
|
QTest::addColumn<QString>("path");
|
||||||
|
|
||||||
|
// This test performs line-by-line comparison and fails if reformatting
|
||||||
|
// makes a change inline, for example whitespace removal. We omit
|
||||||
|
// those files in this test.
|
||||||
|
QSet<QString> excludedFiles;
|
||||||
|
excludedFiles << QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.qml";
|
||||||
|
excludedFiles << QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.formatted.qml";
|
||||||
|
|
||||||
QDirIterator it(TESTSRCDIR, QStringList() << QLatin1String("*.qml") << QLatin1String("*.js"), QDir::Files);
|
QDirIterator it(TESTSRCDIR, QStringList() << QLatin1String("*.qml") << QLatin1String("*.js"), QDir::Files);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
const QString fileName = it.next();
|
const QString fileName = it.next();
|
||||||
|
if (!excludedFiles.contains(fileName))
|
||||||
QTest::newRow(fileName.toLatin1()) << it.filePath();
|
QTest::newRow(fileName.toLatin1()) << it.filePath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,6 +97,44 @@ void tst_Reformatter::test()
|
|||||||
QCOMPARE(sourceLines.size(), newLines.size());
|
QCOMPARE(sourceLines.size(), newLines.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_Reformatter::reformatter_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<QString>("filePath");
|
||||||
|
QTest::addColumn<QString>("formattedFilePath");
|
||||||
|
|
||||||
|
QTest::newRow("typeAnnotations")
|
||||||
|
<< QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.qml"
|
||||||
|
<< QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.formatted.qml";
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_Reformatter::reformatter()
|
||||||
|
{
|
||||||
|
QFETCH(QString, filePath);
|
||||||
|
QFETCH(QString, formattedFilePath);
|
||||||
|
|
||||||
|
Utils::FilePath fPath = Utils::FilePath::fromString(filePath);
|
||||||
|
Document::MutablePtr doc
|
||||||
|
= Document::create(fPath, ModelManagerInterface::guessLanguageOfFile(fPath));
|
||||||
|
|
||||||
|
QString fileContent;
|
||||||
|
{
|
||||||
|
QFile file(filePath);
|
||||||
|
QVERIFY(file.open(QFile::ReadOnly | QFile::Text));
|
||||||
|
fileContent = QString::fromUtf8(file.readAll());
|
||||||
|
}
|
||||||
|
doc->setSource(fileContent);
|
||||||
|
doc->parse();
|
||||||
|
QString expected;
|
||||||
|
{
|
||||||
|
QFile file(formattedFilePath);
|
||||||
|
QVERIFY(file.open(QFile::ReadOnly | QFile::Text));
|
||||||
|
expected = QString::fromUtf8(file.readAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString formatted = reformat(doc);
|
||||||
|
QCOMPARE(formatted, expected);
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_GUILESS_MAIN(tst_Reformatter);
|
QTEST_GUILESS_MAIN(tst_Reformatter);
|
||||||
|
|
||||||
#include "tst_reformatter.moc"
|
#include "tst_reformatter.moc"
|
||||||
|
18
tests/auto/qml/reformatter/typeAnnotations.formatted.qml
Normal file
18
tests/auto/qml/reformatter/typeAnnotations.formatted.qml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
// Copyright (C) 2023 The Qt Company Ltd.
|
||||||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Text {
|
||||||
|
function aaa(t: int, k: double): int {
|
||||||
|
return 42
|
||||||
|
}
|
||||||
|
|
||||||
|
function bbb(aaa): int {
|
||||||
|
return 42
|
||||||
|
}
|
||||||
|
|
||||||
|
function abc(cba: int) {
|
||||||
|
return 42
|
||||||
|
}
|
||||||
|
}
|
17
tests/auto/qml/reformatter/typeAnnotations.qml
Normal file
17
tests/auto/qml/reformatter/typeAnnotations.qml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright (C) 2023 The Qt Company Ltd.
|
||||||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Text {
|
||||||
|
function aaa (t : int, k : double) : int {
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
|
||||||
|
function bbb(aaa)
|
||||||
|
: int {return 42}
|
||||||
|
|
||||||
|
function abc (cba : int) {
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,4 +1,5 @@
|
|||||||
add_qtc_test(tst_terminal
|
add_qtc_test(tst_terminal
|
||||||
|
MANUALTEST
|
||||||
DEPENDS Utils
|
DEPENDS Utils
|
||||||
SOURCES tst_terminal.cpp
|
SOURCES tst_terminal.cpp
|
||||||
)
|
)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import qbs
|
import qbs
|
||||||
|
|
||||||
QtcAutotest {
|
QtcManualTest {
|
||||||
name: "Terminal autotest"
|
name: "Terminal autotest"
|
||||||
Depends { name: "Utils" }
|
Depends { name: "Utils" }
|
||||||
files: "tst_terminal.cpp"
|
files: "tst_terminal.cpp"
|
||||||
|
Reference in New Issue
Block a user