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;
|
++*storage;
|
||||||
};
|
};
|
||||||
const auto onDone = [this](const Async<TestParseResultPtr> &async) {
|
const auto onDone = [this](const Async<TestParseResultPtr> &async) {
|
||||||
const QList<TestParseResultPtr> results = async.results();
|
const QList<TestParseResultPtr> &results = async.results();
|
||||||
for (const TestParseResultPtr &result : results)
|
if (!results.isEmpty())
|
||||||
emit testParseResultReady(result);
|
emit testParseResultsReady(results);
|
||||||
};
|
};
|
||||||
const Group root {
|
const Group root {
|
||||||
parallelLimit(limit),
|
parallelLimit(limit),
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void aboutToPerformFullParse();
|
void aboutToPerformFullParse();
|
||||||
void testParseResultReady(const TestParseResultPtr result); // TODO: pass list of results?
|
void testParseResultsReady(const QList<TestParseResultPtr> &results);
|
||||||
void parsingStarted();
|
void parsingStarted();
|
||||||
void parsingFinished();
|
void parsingFinished();
|
||||||
void parsingFailed();
|
void parsingFailed();
|
||||||
|
|||||||
@@ -34,15 +34,15 @@ static Q_LOGGING_CATEGORY(LOG, "qtc.autotest.frameworkmanager", QtWarningMsg)
|
|||||||
|
|
||||||
static TestTreeModel *s_instance = nullptr;
|
static TestTreeModel *s_instance = nullptr;
|
||||||
|
|
||||||
TestTreeModel::TestTreeModel(TestCodeParser *parser) :
|
TestTreeModel::TestTreeModel(TestCodeParser *parser)
|
||||||
m_parser(parser)
|
: m_parser(parser)
|
||||||
{
|
{
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
|
|
||||||
connect(m_parser, &TestCodeParser::aboutToPerformFullParse, this,
|
connect(m_parser, &TestCodeParser::aboutToPerformFullParse, this,
|
||||||
&TestTreeModel::removeAllTestItems, Qt::QueuedConnection);
|
&TestTreeModel::removeAllTestItems, Qt::QueuedConnection);
|
||||||
connect(m_parser, &TestCodeParser::testParseResultReady,
|
connect(m_parser, &TestCodeParser::testParseResultsReady,
|
||||||
this, &TestTreeModel::onParseResultReady);
|
this, &TestTreeModel::onParseResultsReady);
|
||||||
connect(m_parser, &TestCodeParser::parsingFinished,
|
connect(m_parser, &TestCodeParser::parsingFinished,
|
||||||
this, &TestTreeModel::sweep, Qt::QueuedConnection);
|
this, &TestTreeModel::sweep, Qt::QueuedConnection);
|
||||||
connect(m_parser, &TestCodeParser::parsingFailed,
|
connect(m_parser, &TestCodeParser::parsingFailed,
|
||||||
@@ -678,13 +678,15 @@ 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;
|
ITestFramework *framework = result->framework;
|
||||||
QTC_ASSERT(framework, return);
|
QTC_ASSERT(framework, return);
|
||||||
TestTreeItem *rootNode = framework->rootNode();
|
TestTreeItem *rootNode = framework->rootNode();
|
||||||
QTC_ASSERT(rootNode, return);
|
QTC_ASSERT(rootNode, return);
|
||||||
handleParseResult(result.data(), rootNode);
|
handleParseResult(result.data(), rootNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autotest::TestTreeModel::onDataChanged(const QModelIndex &topLeft,
|
void Autotest::TestTreeModel::onDataChanged(const QModelIndex &topLeft,
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ signals:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onParseResultReady(const TestParseResultPtr result);
|
void onParseResultsReady(const QList<TestParseResultPtr> &results);
|
||||||
void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
|
void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
|
||||||
const QVector<int> &roles);
|
const QVector<int> &roles);
|
||||||
void handleParseResult(const TestParseResult *result, TestTreeItem *rootNode);
|
void handleParseResult(const TestParseResult *result, TestTreeItem *rootNode);
|
||||||
|
|||||||
Reference in New Issue
Block a user