forked from qt-creator/qt-creator
AutoTest: Restrict Run and Debug from results pane
Ensure to enable Run and Debug from results pane only for items that are in fact capable to get re-run and debugged. Preparation for enabling the functionality for QTest and Quick Tests. Change-Id: I7ec28e51ae7c9caa462023d55443bd3194ae81dd Reviewed-by: Claus Steuer <claus755@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
@@ -583,15 +583,16 @@ void TestResultsPane::onCustomContextMenuRequested(const QPoint &pos)
|
|||||||
connect(action, &QAction::triggered, this, &TestResultsPane::onSaveWholeTriggered);
|
connect(action, &QAction::triggered, this, &TestResultsPane::onSaveWholeTriggered);
|
||||||
menu.addAction(action);
|
menu.addAction(action);
|
||||||
|
|
||||||
|
const auto correlatingItem = clicked ? clicked->findTestTreeItem() : nullptr;
|
||||||
action = new QAction(tr("Run This Test"), &menu);
|
action = new QAction(tr("Run This Test"), &menu);
|
||||||
action->setEnabled(clicked && clicked->findTestTreeItem());
|
action->setEnabled(correlatingItem && correlatingItem->canProvideTestConfiguration());
|
||||||
connect(action, &QAction::triggered, this, [this, clicked] {
|
connect(action, &QAction::triggered, this, [this, clicked] {
|
||||||
onRunThisTestTriggered(TestRunMode::Run, clicked);
|
onRunThisTestTriggered(TestRunMode::Run, clicked);
|
||||||
});
|
});
|
||||||
menu.addAction(action);
|
menu.addAction(action);
|
||||||
|
|
||||||
action = new QAction(tr("Debug This Test"), &menu);
|
action = new QAction(tr("Debug This Test"), &menu);
|
||||||
action->setEnabled(clicked && clicked->findTestTreeItem());
|
action->setEnabled(correlatingItem && correlatingItem->canProvideDebugConfiguration());
|
||||||
connect(action, &QAction::triggered, this, [this, clicked] {
|
connect(action, &QAction::triggered, this, [this, clicked] {
|
||||||
onRunThisTestTriggered(TestRunMode::Debug, clicked);
|
onRunThisTestTriggered(TestRunMode::Debug, clicked);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user