forked from qt-creator/qt-creator
AutoTest: Pass a list of results inside testParseResultsReady()
This limits the number of signals being sent. Change-Id: Ie4b0661571a9d1bbd5708e33e21e0911e7a9fcbd Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -384,9 +384,9 @@ void TestCodeParser::scanForTests(const QSet<FilePath> &filePaths,
|
||||
++*storage;
|
||||
};
|
||||
const auto onDone = [this](const Async<TestParseResultPtr> &async) {
|
||||
const QList<TestParseResultPtr> results = async.results();
|
||||
for (const TestParseResultPtr &result : results)
|
||||
emit testParseResultReady(result);
|
||||
const QList<TestParseResultPtr> &results = async.results();
|
||||
if (!results.isEmpty())
|
||||
emit testParseResultsReady(results);
|
||||
};
|
||||
const Group root {
|
||||
parallelLimit(limit),
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
signals:
|
||||
void aboutToPerformFullParse();
|
||||
void testParseResultReady(const TestParseResultPtr result); // TODO: pass list of results?
|
||||
void testParseResultsReady(const QList<TestParseResultPtr> &results);
|
||||
void parsingStarted();
|
||||
void parsingFinished();
|
||||
void parsingFailed();
|
||||
|
||||
@@ -34,15 +34,15 @@ static Q_LOGGING_CATEGORY(LOG, "qtc.autotest.frameworkmanager", QtWarningMsg)
|
||||
|
||||
static TestTreeModel *s_instance = nullptr;
|
||||
|
||||
TestTreeModel::TestTreeModel(TestCodeParser *parser) :
|
||||
m_parser(parser)
|
||||
TestTreeModel::TestTreeModel(TestCodeParser *parser)
|
||||
: m_parser(parser)
|
||||
{
|
||||
s_instance = this;
|
||||
|
||||
connect(m_parser, &TestCodeParser::aboutToPerformFullParse, this,
|
||||
&TestTreeModel::removeAllTestItems, Qt::QueuedConnection);
|
||||
connect(m_parser, &TestCodeParser::testParseResultReady,
|
||||
this, &TestTreeModel::onParseResultReady);
|
||||
connect(m_parser, &TestCodeParser::testParseResultsReady,
|
||||
this, &TestTreeModel::onParseResultsReady);
|
||||
connect(m_parser, &TestCodeParser::parsingFinished,
|
||||
this, &TestTreeModel::sweep, Qt::QueuedConnection);
|
||||
connect(m_parser, &TestCodeParser::parsingFailed,
|
||||
@@ -678,14 +678,16 @@ void TestTreeModel::revalidateCheckState(ITestTreeItem *item)
|
||||
}
|
||||
}
|
||||
|
||||
void TestTreeModel::onParseResultReady(const TestParseResultPtr result)
|
||||
void TestTreeModel::onParseResultsReady(const QList<TestParseResultPtr> &results)
|
||||
{
|
||||
for (const auto &result : results) {
|
||||
ITestFramework *framework = result->framework;
|
||||
QTC_ASSERT(framework, return);
|
||||
TestTreeItem *rootNode = framework->rootNode();
|
||||
QTC_ASSERT(rootNode, return);
|
||||
handleParseResult(result.data(), rootNode);
|
||||
}
|
||||
}
|
||||
|
||||
void Autotest::TestTreeModel::onDataChanged(const QModelIndex &topLeft,
|
||||
const QModelIndex &bottomRight,
|
||||
|
||||
@@ -78,7 +78,7 @@ signals:
|
||||
#endif
|
||||
|
||||
private:
|
||||
void onParseResultReady(const TestParseResultPtr result);
|
||||
void onParseResultsReady(const QList<TestParseResultPtr> &results);
|
||||
void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
|
||||
const QVector<int> &roles);
|
||||
void handleParseResult(const TestParseResult *result, TestTreeItem *rootNode);
|
||||
|
||||
Reference in New Issue
Block a user