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;
|
QMenu menu;
|
||||||
QAction *runThisTest = 0;
|
QAction *runThisTest = 0;
|
||||||
|
QAction *runWithoutDeploy = 0;
|
||||||
QAction *debugThisTest = 0;
|
QAction *debugThisTest = 0;
|
||||||
|
QAction *debugWithoutDeploy = 0;
|
||||||
const QModelIndexList list = m_view->selectionModel()->selectedIndexes();
|
const QModelIndexList list = m_view->selectionModel()->selectedIndexes();
|
||||||
if (list.size() == 1) {
|
if (list.size() == 1) {
|
||||||
const QModelIndex index = list.first();
|
const QModelIndex index = list.first();
|
||||||
@@ -135,6 +137,12 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
this, [this] () {
|
this, [this] () {
|
||||||
onRunThisTestTriggered(TestRunner::Run);
|
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()) {
|
if (item->canProvideDebugConfiguration()) {
|
||||||
debugThisTest = new QAction(tr("Debug This Test"), &menu);
|
debugThisTest = new QAction(tr("Debug This Test"), &menu);
|
||||||
@@ -143,6 +151,12 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
this, [this] () {
|
this, [this] () {
|
||||||
onRunThisTestTriggered(TestRunner::Debug);
|
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);
|
deselectAll->setEnabled(enabled && hasTests);
|
||||||
rescan->setEnabled(enabled);
|
rescan->setEnabled(enabled);
|
||||||
|
|
||||||
if (runThisTest)
|
if (runThisTest) {
|
||||||
menu.addAction(runThisTest);
|
menu.addAction(runThisTest);
|
||||||
if (debugThisTest)
|
menu.addAction(runWithoutDeploy);
|
||||||
|
}
|
||||||
|
if (debugThisTest) {
|
||||||
menu.addAction(debugThisTest);
|
menu.addAction(debugThisTest);
|
||||||
|
menu.addAction(debugWithoutDeploy);
|
||||||
|
}
|
||||||
if (runThisTest || debugThisTest)
|
if (runThisTest || debugThisTest)
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
@@ -287,9 +305,11 @@ void TestNavigationWidget::onRunThisTestTriggered(TestRunner::Mode runMode)
|
|||||||
TestConfiguration *configuration;
|
TestConfiguration *configuration;
|
||||||
switch (runMode) {
|
switch (runMode) {
|
||||||
case TestRunner::Run:
|
case TestRunner::Run:
|
||||||
|
case TestRunner::RunWithoutDeploy:
|
||||||
configuration = item->testConfiguration();
|
configuration = item->testConfiguration();
|
||||||
break;
|
break;
|
||||||
case TestRunner::Debug:
|
case TestRunner::Debug:
|
||||||
|
case TestRunner::DebugWithoutDeploy:
|
||||||
configuration = item->debugConfiguration();
|
configuration = item->debugConfiguration();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@@ -256,7 +256,8 @@ void TestRunner::prepareToRunTests(Mode mode)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!projectExplorerSettings.buildBeforeDeploy) {
|
if (!projectExplorerSettings.buildBeforeDeploy || mode == TestRunner::DebugWithoutDeploy
|
||||||
|
|| mode == TestRunner::RunWithoutDeploy) {
|
||||||
runOrDebugTests();
|
runOrDebugTests();
|
||||||
} else {
|
} else {
|
||||||
if (project->hasActiveBuildSettings()) {
|
if (project->hasActiveBuildSettings()) {
|
||||||
@@ -332,9 +333,11 @@ void TestRunner::runOrDebugTests()
|
|||||||
{
|
{
|
||||||
switch (m_runMode) {
|
switch (m_runMode) {
|
||||||
case Run:
|
case Run:
|
||||||
|
case RunWithoutDeploy:
|
||||||
runTests();
|
runTests();
|
||||||
break;
|
break;
|
||||||
case Debug:
|
case Debug:
|
||||||
|
case DebugWithoutDeploy:
|
||||||
debugTests();
|
debugTests();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@@ -47,7 +47,9 @@ public:
|
|||||||
enum Mode
|
enum Mode
|
||||||
{
|
{
|
||||||
Run,
|
Run,
|
||||||
Debug
|
RunWithoutDeploy,
|
||||||
|
Debug,
|
||||||
|
DebugWithoutDeploy
|
||||||
};
|
};
|
||||||
|
|
||||||
static TestRunner* instance();
|
static TestRunner* instance();
|
||||||
|
Reference in New Issue
Block a user