From e70adf820ee42578f4a412572bedf3b745492619 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 27 Jun 2016 11:07:16 +0200 Subject: [PATCH] AutoTest: Allow run/debug without deployment Task-number: QTCREATORBUG-16486 Change-Id: I7ef5887e065830152744a9bd7d7727058b4521d9 Reviewed-by: David Schulz Reviewed-by: Nikolai Kosjar --- src/plugins/autotest/testnavigationwidget.cpp | 24 +++++++++++++++++-- src/plugins/autotest/testrunner.cpp | 5 +++- src/plugins/autotest/testrunner.h | 4 +++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/plugins/autotest/testnavigationwidget.cpp b/src/plugins/autotest/testnavigationwidget.cpp index 6f91f4b1220..2b08551159e 100644 --- a/src/plugins/autotest/testnavigationwidget.cpp +++ b/src/plugins/autotest/testnavigationwidget.cpp @@ -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: diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp index 1802d278bf4..47286205363 100644 --- a/src/plugins/autotest/testrunner.cpp +++ b/src/plugins/autotest/testrunner.cpp @@ -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: diff --git a/src/plugins/autotest/testrunner.h b/src/plugins/autotest/testrunner.h index 2e3621b29d0..cb796ae5a0b 100644 --- a/src/plugins/autotest/testrunner.h +++ b/src/plugins/autotest/testrunner.h @@ -47,7 +47,9 @@ public: enum Mode { Run, - Debug + RunWithoutDeploy, + Debug, + DebugWithoutDeploy }; static TestRunner* instance();