2014-10-07 12:30:54 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2014-10-07 12:30:54 +02:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** This file is part of Qt Creator.
|
2014-10-07 12:30:54 +02:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
2014-10-07 12:30:54 +02:00
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-22 10:37:55 +01:00
|
|
|
** 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.
|
2014-10-07 12:30:54 +02:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** 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.
|
2014-10-07 12:30:54 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2014-10-07 12:30:54 +02:00
|
|
|
|
2016-05-11 13:02:42 +02:00
|
|
|
#include "itestparser.h"
|
2014-11-06 16:01:06 +01:00
|
|
|
|
2016-06-20 07:03:55 +02:00
|
|
|
#include <qmljs/qmljsdocument.h>
|
|
|
|
|
|
2014-10-07 12:30:54 +02:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QMap>
|
2016-01-27 13:52:33 +01:00
|
|
|
#include <QFutureWatcher>
|
2014-10-07 12:30:54 +02:00
|
|
|
|
2014-12-10 09:41:23 +01:00
|
|
|
namespace Core {
|
|
|
|
|
class Id;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-07 12:30:54 +02:00
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class TestCodeParser : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2015-02-10 14:20:43 +01:00
|
|
|
enum State {
|
|
|
|
|
Idle,
|
|
|
|
|
PartialParse,
|
2015-02-12 15:48:24 +01:00
|
|
|
FullParse,
|
|
|
|
|
Disabled
|
2015-02-10 14:20:43 +01:00
|
|
|
};
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
explicit TestCodeParser(TestTreeModel *parent = 0);
|
2014-10-28 15:57:13 +01:00
|
|
|
virtual ~TestCodeParser();
|
2015-02-12 15:48:24 +01:00
|
|
|
void setState(State state);
|
2015-04-10 15:09:45 +02:00
|
|
|
State state() const { return m_parserState; }
|
2016-03-14 15:36:03 +01:00
|
|
|
bool isParsing() const { return m_parserState == PartialParse || m_parserState == FullParse; }
|
2015-07-27 13:54:27 +02:00
|
|
|
void setDirty() { m_dirty = true; }
|
2016-06-06 15:35:00 +02:00
|
|
|
void syncTestFrameworks(const QVector<Core::Id> &frameworkIds);
|
2016-02-10 10:43:31 +01:00
|
|
|
#ifdef WITH_TESTS
|
|
|
|
|
bool furtherParsingExpected() const
|
|
|
|
|
{ return m_singleShotScheduled || m_fullUpdatePostponed || m_partialUpdatePostponed; }
|
|
|
|
|
#endif
|
2014-10-07 12:30:54 +02:00
|
|
|
|
|
|
|
|
signals:
|
2016-01-25 13:05:12 +01:00
|
|
|
void aboutToPerformFullParse();
|
2016-04-12 12:44:56 +02:00
|
|
|
void testParseResultReady(const TestParseResultPtr result);
|
2015-02-17 14:45:26 +01:00
|
|
|
void parsingStarted();
|
2015-02-10 14:20:43 +01:00
|
|
|
void parsingFinished();
|
2015-07-27 13:54:27 +02:00
|
|
|
void parsingFailed();
|
2014-10-07 12:30:54 +02:00
|
|
|
|
|
|
|
|
public slots:
|
2014-12-10 09:41:23 +01:00
|
|
|
void emitUpdateTestTree();
|
2014-10-07 12:30:54 +02:00
|
|
|
void updateTestTree();
|
2015-01-27 15:22:17 +01:00
|
|
|
void onCppDocumentUpdated(const CPlusPlus::Document::Ptr &document);
|
|
|
|
|
void onQmlDocumentUpdated(const QmlJS::Document::Ptr &document);
|
2016-02-10 15:48:00 +01:00
|
|
|
void onStartupProjectChanged(ProjectExplorer::Project *project);
|
2015-04-02 12:16:55 +02:00
|
|
|
void onProjectPartsUpdated(ProjectExplorer::Project *project);
|
2014-10-07 12:30:54 +02:00
|
|
|
|
|
|
|
|
private:
|
2015-02-10 14:20:43 +01:00
|
|
|
bool postponed(const QStringList &fileList);
|
2014-11-25 09:32:13 +01:00
|
|
|
void scanForTests(const QStringList &fileList = QStringList());
|
2015-02-05 16:07:45 +01:00
|
|
|
|
2014-12-10 09:41:23 +01:00
|
|
|
void onTaskStarted(Core::Id type);
|
|
|
|
|
void onAllTasksFinished(Core::Id type);
|
2015-02-13 15:44:18 +01:00
|
|
|
void onFinished();
|
2015-02-10 14:20:43 +01:00
|
|
|
void onPartialParsingFinished();
|
2016-06-20 07:03:55 +02:00
|
|
|
void releaseParserInternals();
|
2014-10-07 12:30:54 +02:00
|
|
|
|
|
|
|
|
TestTreeModel *m_model;
|
2016-01-25 08:40:36 +01:00
|
|
|
|
2015-07-23 15:51:38 +02:00
|
|
|
bool m_codeModelParsing;
|
2015-02-27 14:16:07 +01:00
|
|
|
bool m_fullUpdatePostponed;
|
|
|
|
|
bool m_partialUpdatePostponed;
|
2015-02-19 11:19:59 +01:00
|
|
|
bool m_dirty;
|
2015-07-27 13:54:27 +02:00
|
|
|
bool m_singleShotScheduled;
|
2015-02-27 14:16:07 +01:00
|
|
|
QSet<QString> m_postponedFiles;
|
2015-02-10 14:20:43 +01:00
|
|
|
State m_parserState;
|
2016-04-12 12:44:56 +02:00
|
|
|
QFutureWatcher<TestParseResultPtr> m_futureWatcher;
|
2016-06-06 15:35:00 +02:00
|
|
|
QVector<ITestParser *> m_testCodeParsers; // ptrs are still owned by TestFrameworkManager
|
2014-10-07 12:30:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
2016-05-11 13:02:42 +02:00
|
|
|
} // namespace Autotest
|