2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2016-05-11 13:02:42 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "../itestparser.h"
|
|
|
|
|
|
2016-06-20 07:03:55 +02:00
|
|
|
#include <qmljs/qmljsdocument.h>
|
|
|
|
|
|
2017-03-20 15:42:08 +01:00
|
|
|
#include <QFileSystemWatcher>
|
|
|
|
|
|
2016-05-11 13:02:42 +02:00
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class QuickTestParseResult : public TestParseResult
|
|
|
|
|
{
|
|
|
|
|
public:
|
2021-01-25 16:31:16 +01:00
|
|
|
explicit QuickTestParseResult(ITestFramework *framework) : TestParseResult(framework) {}
|
2016-05-11 13:02:42 +02:00
|
|
|
TestTreeItem *createTestTreeItem() const override;
|
|
|
|
|
};
|
|
|
|
|
|
2017-03-20 15:42:08 +01:00
|
|
|
class QuickTestParser : public QObject, public CppParser
|
2016-05-11 13:02:42 +02:00
|
|
|
{
|
2017-03-20 15:42:08 +01:00
|
|
|
Q_OBJECT
|
2016-05-11 13:02:42 +02:00
|
|
|
public:
|
2020-03-13 13:54:33 +01:00
|
|
|
explicit QuickTestParser(ITestFramework *framework);
|
2021-05-26 15:50:03 +02:00
|
|
|
void init(const Utils::FilePaths &filesToParse, bool fullParse) override;
|
2016-07-12 10:35:43 +02:00
|
|
|
void release() override;
|
2023-02-12 01:31:47 +01:00
|
|
|
bool processDocument(QPromise<TestParseResultPtr> &promise,
|
2021-05-26 15:50:03 +02:00
|
|
|
const Utils::FilePath &fileName) override;
|
|
|
|
|
Utils::FilePath projectFileForMainCppFile(const Utils::FilePath &fileName) const;
|
2023-01-17 12:09:18 +01:00
|
|
|
QStringList supportedExtensions() const override { return {"qml"}; };
|
|
|
|
|
|
2016-05-11 13:02:42 +02:00
|
|
|
private:
|
2023-02-12 01:31:47 +01:00
|
|
|
bool handleQtQuickTest(QPromise<TestParseResultPtr> &promise,
|
2023-01-18 08:15:08 +01:00
|
|
|
CPlusPlus::Document::Ptr document,
|
|
|
|
|
ITestFramework *framework);
|
2017-06-01 11:57:57 +02:00
|
|
|
void handleDirectoryChanged(const QString &directory);
|
|
|
|
|
void doUpdateWatchPaths(const QStringList &directories);
|
2021-01-01 19:19:10 +01:00
|
|
|
QString quickTestName(const CPlusPlus::Document::Ptr &doc) const;
|
2022-06-20 12:35:13 +02:00
|
|
|
QList<QmlJS::Document::Ptr> scanDirectoryForQuickTestQmlFiles(const Utils::FilePath &srcDir);
|
2016-05-11 13:02:42 +02:00
|
|
|
QmlJS::Snapshot m_qmlSnapshot;
|
2021-05-26 15:50:03 +02:00
|
|
|
QHash<Utils::FilePath, Utils::FilePath> m_proFilesForQmlFiles;
|
2017-03-20 15:42:08 +01:00
|
|
|
QFileSystemWatcher m_directoryWatcher;
|
2017-06-01 11:57:57 +02:00
|
|
|
QMap<QString, QMap<QString, QDateTime> > m_watchedFiles;
|
2021-05-26 15:50:03 +02:00
|
|
|
QMap<Utils::FilePath, Utils::FilePath> m_mainCppFiles;
|
2023-01-18 08:15:08 +01:00
|
|
|
bool m_checkForDerivedTests = false;
|
2016-05-11 13:02:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|