2016-05-11 13:02:42 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#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;
|
2016-05-11 13:02:42 +02:00
|
|
|
bool processDocument(QFutureInterface<TestParseResultPtr> futureInterface,
|
2021-05-26 15:50:03 +02:00
|
|
|
const Utils::FilePath &fileName) override;
|
|
|
|
|
Utils::FilePath projectFileForMainCppFile(const Utils::FilePath &fileName) const;
|
2016-05-11 13:02:42 +02:00
|
|
|
private:
|
2017-03-20 15:42:08 +01:00
|
|
|
bool handleQtQuickTest(QFutureInterface<TestParseResultPtr> futureInterface,
|
2020-03-13 13:54:33 +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;
|
2020-11-17 09:09:05 +01:00
|
|
|
QList<QmlJS::Document::Ptr> scanDirectoryForQuickTestQmlFiles(const QString &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;
|
2016-05-11 13:02:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|