forked from qt-creator/qt-creator
AutoTest: Allow run/debug without deployment
Task-number: QTCREATORBUG-16486 Change-Id: I7ef5887e065830152744a9bd7d7727058b4521d9 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -120,7 +120,9 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
QMenu menu;
|
||||
QAction *runThisTest = 0;
|
||||
QAction *runWithoutDeploy = 0;
|
||||
QAction *debugThisTest = 0;
|
||||
QAction *debugWithoutDeploy = 0;
|
||||
const QModelIndexList list = m_view->selectionModel()->selectedIndexes();
|
||||
if (list.size() == 1) {
|
||||
const QModelIndex index = list.first();
|
||||
@@ -135,6 +137,12 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
this, [this] () {
|
||||
onRunThisTestTriggered(TestRunner::Run);
|
||||
});
|
||||
runWithoutDeploy = new QAction(tr("Run Without Deployment"), &menu);
|
||||
runWithoutDeploy->setEnabled(enabled);
|
||||
connect(runWithoutDeploy, &QAction::triggered,
|
||||
this, [this] () {
|
||||
onRunThisTestTriggered(TestRunner::RunWithoutDeploy);
|
||||
});
|
||||
}
|
||||
if (item->canProvideDebugConfiguration()) {
|
||||
debugThisTest = new QAction(tr("Debug This Test"), &menu);
|
||||
@@ -143,6 +151,12 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
this, [this] () {
|
||||
onRunThisTestTriggered(TestRunner::Debug);
|
||||
});
|
||||
debugWithoutDeploy = new QAction(tr("Debug Without Deployment"), &menu);
|
||||
debugWithoutDeploy->setEnabled(enabled);
|
||||
connect(debugWithoutDeploy, &QAction::triggered,
|
||||
this, [this] () {
|
||||
onRunThisTestTriggered(TestRunner::DebugWithoutDeploy);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,10 +177,14 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
deselectAll->setEnabled(enabled && hasTests);
|
||||
rescan->setEnabled(enabled);
|
||||
|
||||
if (runThisTest)
|
||||
if (runThisTest) {
|
||||
menu.addAction(runThisTest);
|
||||
if (debugThisTest)
|
||||
menu.addAction(runWithoutDeploy);
|
||||
}
|
||||
if (debugThisTest) {
|
||||
menu.addAction(debugThisTest);
|
||||
menu.addAction(debugWithoutDeploy);
|
||||
}
|
||||
if (runThisTest || debugThisTest)
|
||||
menu.addSeparator();
|
||||
|
||||
@@ -287,9 +305,11 @@ void TestNavigationWidget::onRunThisTestTriggered(TestRunner::Mode runMode)
|
||||
TestConfiguration *configuration;
|
||||
switch (runMode) {
|
||||
case TestRunner::Run:
|
||||
case TestRunner::RunWithoutDeploy:
|
||||
configuration = item->testConfiguration();
|
||||
break;
|
||||
case TestRunner::Debug:
|
||||
case TestRunner::DebugWithoutDeploy:
|
||||
configuration = item->debugConfiguration();
|
||||
break;
|
||||
default:
|
||||
|
@@ -256,7 +256,8 @@ void TestRunner::prepareToRunTests(Mode mode)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!projectExplorerSettings.buildBeforeDeploy) {
|
||||
if (!projectExplorerSettings.buildBeforeDeploy || mode == TestRunner::DebugWithoutDeploy
|
||||
|| mode == TestRunner::RunWithoutDeploy) {
|
||||
runOrDebugTests();
|
||||
} else {
|
||||
if (project->hasActiveBuildSettings()) {
|
||||
@@ -332,9 +333,11 @@ void TestRunner::runOrDebugTests()
|
||||
{
|
||||
switch (m_runMode) {
|
||||
case Run:
|
||||
case RunWithoutDeploy:
|
||||
runTests();
|
||||
break;
|
||||
case Debug:
|
||||
case DebugWithoutDeploy:
|
||||
debugTests();
|
||||
break;
|
||||
default:
|
||||
|
@@ -47,7 +47,9 @@ public:
|
||||
enum Mode
|
||||
{
|
||||
Run,
|
||||
Debug
|
||||
RunWithoutDeploy,
|
||||
Debug,
|
||||
DebugWithoutDeploy
|
||||
};
|
||||
|
||||
static TestRunner* instance();
|
||||
|
Reference in New Issue
Block a user