aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/autotest/autotestconstants.h1
-rw-r--r--src/plugins/autotest/autotesticons.h2
-rw-r--r--src/plugins/autotest/autotestplugin.cpp29
-rw-r--r--src/plugins/autotest/testresultspane.cpp4
-rw-r--r--src/plugins/autotest/testresultspane.h2
5 files changed, 34 insertions, 4 deletions
diff --git a/src/plugins/autotest/autotestconstants.h b/src/plugins/autotest/autotestconstants.h
index d3e56824c7d..c90cc5269ff 100644
--- a/src/plugins/autotest/autotestconstants.h
+++ b/src/plugins/autotest/autotestconstants.h
@@ -33,6 +33,7 @@ namespace Constants {
const char ACTION_SCAN_ID[] = "AutoTest.ScanAction";
const char ACTION_RUN_ALL_ID[] = "AutoTest.RunAll";
const char ACTION_RUN_SELECTED_ID[] = "AutoTest.RunSelected";
+const char ACTION_RUN_FAILED_ID[] = "AutoTest.RunFailed";
const char ACTION_RUN_FILE_ID[] = "AutoTest.RunFile";
const char ACTION_RUN_UCURSOR[] = "AutoTest.RunUnderCursor";
const char ACTION_RUN_DBG_UCURSOR[] = "AutoTest.RunDebugUnderCursor";
diff --git a/src/plugins/autotest/autotesticons.h b/src/plugins/autotest/autotesticons.h
index 7b6714d8616..ab96f631fc1 100644
--- a/src/plugins/autotest/autotesticons.h
+++ b/src/plugins/autotest/autotesticons.h
@@ -36,6 +36,8 @@ const Utils::Icon SORT_NATURALLY({
const Utils::Icon RUN_SELECTED_OVERLAY({
{":/utils/images/runselected_boxes.png", Utils::Theme::BackgroundColorDark},
{":/utils/images/runselected_tickmarks.png", Utils::Theme::IconsBaseColor}});
+const Utils::Icon RUN_FAILED_OVERLAY({
+ {":utils/images/iconoverlay_reset.png", Utils::Theme::OutputPanes_TestXPassTextColor}});
const Utils::Icon RUN_FILE_OVERLAY({
{":/utils/images/run_file.png", Utils::Theme::IconsBaseColor}});
const Utils::Icon RESULT_PASS({
diff --git a/src/plugins/autotest/autotestplugin.cpp b/src/plugins/autotest/autotestplugin.cpp
index bf0b3e70197..ba40457e1ea 100644
--- a/src/plugins/autotest/autotestplugin.cpp
+++ b/src/plugins/autotest/autotestplugin.cpp
@@ -97,6 +97,7 @@ public:
void initializeMenuEntries();
void onRunAllTriggered();
void onRunSelectedTriggered();
+ void onRunFailedTriggered();
void onRunFileTriggered();
void onRunUnderCursorTriggered(TestRunMode mode);
@@ -222,7 +223,20 @@ void AutotestPluginPrivate::initializeMenuEntries()
action->setEnabled(false);
menu->addAction(command);
- action = new QAction(tr("Run Tests for Current &File"), this);
+ action = new QAction(tr("Run &Failed Tests"), this);
+ Utils::Icon runFailedIcon = Utils::Icons::RUN_SMALL_TOOLBAR;
+ for (const Utils::IconMaskAndColor &maskAndColor: Icons::RUN_FAILED_OVERLAY)
+ runFailedIcon.append(maskAndColor);
+ action->setIcon(runFailedIcon.icon());
+ action->setToolTip(tr("Run Failed Tests"));
+ command = ActionManager::registerAction(action, Constants::ACTION_RUN_FAILED_ID);
+ command->setDefaultKeySequence(
+ useMacShortcuts ? tr("Ctrl+Meta+T, Ctrl+Meta+F") : tr("Alt+Shift+T,Alt+F"));
+ connect(action, &QAction::triggered, this, &AutotestPluginPrivate::onRunFailedTriggered);
+ action->setEnabled(false);
+ menu->addAction(command);
+
+ action = new QAction(tr("Run Tests for &Current File"), this);
Utils::Icon runFileIcon = Utils::Icons::RUN_SMALL_TOOLBAR;
for (const Utils::IconMaskAndColor &maskAndColor : Icons::RUN_FILE_OVERLAY)
runFileIcon.append(maskAndColor);
@@ -230,7 +244,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
action->setToolTip(tr("Run Tests for Current File"));
command = ActionManager::registerAction(action, Constants::ACTION_RUN_FILE_ID);
command->setDefaultKeySequence(
- QKeySequence(useMacShortcuts ? tr("Ctrl+Meta+T, Ctrl+Meta+F") : tr("Alt+Shift+T,Alt+F")));
+ QKeySequence(useMacShortcuts ? tr("Ctrl+Meta+T, Ctrl+Meta+C") : tr("Alt+Shift+T,Alt+C")));
connect(action, &QAction::triggered, this, &AutotestPluginPrivate::onRunFileTriggered);
action->setEnabled(false);
menu->addAction(command);
@@ -311,6 +325,15 @@ void AutotestPluginPrivate::onRunSelectedTriggered()
m_testRunner.prepareToRunTests(TestRunMode::Run);
}
+void AutotestPluginPrivate::onRunFailedTriggered()
+{
+ const QList<TestConfiguration *> failed = m_testTreeModel.getFailedTests();
+ if (failed.isEmpty()) // the framework might not be able to provide them
+ return;
+ m_testRunner.setSelectedTests(failed);
+ m_testRunner.prepareToRunTests(TestRunMode::Run);
+}
+
void AutotestPluginPrivate::onRunFileTriggered()
{
const IDocument *document = EditorManager::currentDocument();
@@ -384,9 +407,11 @@ void AutotestPlugin::updateMenuItemsEnabledState()
&& project && !project->needsConfiguration()
&& target && target->activeRunConfiguration()
&& !ProjectExplorer::BuildManager::isBuilding();
+ const bool canRunFailed = canRun && dd->m_testTreeModel.hasFailedTests();
ActionManager::command(Constants::ACTION_RUN_ALL_ID)->action()->setEnabled(canRun);
ActionManager::command(Constants::ACTION_RUN_SELECTED_ID)->action()->setEnabled(canRun);
+ ActionManager::command(Constants::ACTION_RUN_FAILED_ID)->action()->setEnabled(canRunFailed);
ActionManager::command(Constants::ACTION_RUN_FILE_ID)->action()->setEnabled(canRun);
ActionManager::command(Constants::ACTION_SCAN_ID)->action()->setEnabled(canScan);
diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp
index d3863d26686..c3518b44e7a 100644
--- a/src/plugins/autotest/testresultspane.cpp
+++ b/src/plugins/autotest/testresultspane.cpp
@@ -185,6 +185,8 @@ void TestResultsPane::createToolButtons()
m_runSelected = new QToolButton(m_treeView);
m_runSelected->setDefaultAction(ActionManager::command(Constants::ACTION_RUN_SELECTED_ID)->action());
+ m_runFailed = new QToolButton(m_treeView);
+ m_runFailed->setDefaultAction(ActionManager::command(Constants::ACTION_RUN_FAILED_ID)->action());
m_runFile = new QToolButton(m_treeView);
m_runFile->setDefaultAction(ActionManager::command(Constants::ACTION_RUN_FILE_ID)->action());
@@ -304,7 +306,7 @@ QWidget *TestResultsPane::outputWidget(QWidget *parent)
QList<QWidget *> TestResultsPane::toolBarWidgets() const
{
- return {m_expandCollapse, m_runAll, m_runSelected, m_runFile, m_stopTestRun,
+ return {m_expandCollapse, m_runAll, m_runSelected, m_runFailed, m_runFile, m_stopTestRun,
m_outputToggleButton, m_filterButton};
}
diff --git a/src/plugins/autotest/testresultspane.h b/src/plugins/autotest/testresultspane.h
index ac835fd5082..658165f01db 100644
--- a/src/plugins/autotest/testresultspane.h
+++ b/src/plugins/autotest/testresultspane.h
@@ -98,7 +98,6 @@ public:
void addTestResult(const TestResultPtr &result);
void addOutputLine(const QByteArray &outputLine, OutputChannel channel);
void showTestResult(const QModelIndex &index);
-
private:
explicit TestResultsPane(QObject *parent = nullptr);
@@ -136,6 +135,7 @@ private:
QToolButton *m_expandCollapse;
QToolButton *m_runAll;
QToolButton *m_runSelected;
+ QToolButton *m_runFailed;
QToolButton *m_runFile;
QToolButton *m_stopTestRun;
QToolButton *m_filterButton;