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:
Christian Stenger
2017-09-29 12:36:26 +02:00
parent cf5d8509aa
commit 1fa26bd9b3

View File

@@ -583,15 +583,16 @@ void TestResultsPane::onCustomContextMenuRequested(const QPoint &pos)
connect(action, &QAction::triggered, this, &TestResultsPane::onSaveWholeTriggered);
menu.addAction(action);
const auto correlatingItem = clicked ? clicked->findTestTreeItem() : nullptr;
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] {
onRunThisTestTriggered(TestRunMode::Run, clicked);
});
menu.addAction(action);
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] {
onRunThisTestTriggered(TestRunMode::Debug, clicked);
});