forked from qt-creator/qt-creator
TestRunner: Use QList instead of QQueue
There is not a big benefit when using QQueue - QQueue::dequeue() has its counterpart in QList::takeFirst(). Using list makes it possible to assign another list into m_selectedTests. Make use of QList API consistent in this file (use isEmpty(), first()). Change-Id: I4a320469f5b44c61f8c51196c104a6ca0d0534e3 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -104,7 +104,7 @@ void TestRunner::runTest(TestRunMode mode, const ITestTreeItem *item)
|
|||||||
|
|
||||||
static QString processInformation(const QtcProcess *proc)
|
static QString processInformation(const QtcProcess *proc)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(proc, return QString());
|
QTC_ASSERT(proc, return {});
|
||||||
const Utils::CommandLine command = proc->commandLine();
|
const Utils::CommandLine command = proc->commandLine();
|
||||||
QString information("\nCommand line: " + command.executable().toUserOutput() + ' ' + command.arguments());
|
QString information("\nCommand line: " + command.executable().toUserOutput() + ' ' + command.arguments());
|
||||||
QStringList important = { "PATH" };
|
QStringList important = { "PATH" };
|
||||||
@@ -226,7 +226,7 @@ void TestRunner::scheduleNext()
|
|||||||
QTC_ASSERT(m_fakeFutureInterface, onFinished(); return);
|
QTC_ASSERT(m_fakeFutureInterface, onFinished(); return);
|
||||||
QTC_ASSERT(!m_canceled, onFinished(); return);
|
QTC_ASSERT(!m_canceled, onFinished(); return);
|
||||||
|
|
||||||
m_currentConfig = m_selectedTests.dequeue();
|
m_currentConfig = m_selectedTests.takeFirst();
|
||||||
|
|
||||||
if (!currentConfigValid())
|
if (!currentConfigValid())
|
||||||
return;
|
return;
|
||||||
@@ -340,8 +340,7 @@ void TestRunner::runTests(TestRunMode mode, const QList<ITestConfiguration *> &s
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(!m_executingTests, return);
|
QTC_ASSERT(!m_executingTests, return);
|
||||||
qDeleteAll(m_selectedTests);
|
qDeleteAll(m_selectedTests);
|
||||||
m_selectedTests.clear();
|
m_selectedTests = selectedTests;
|
||||||
m_selectedTests.append(selectedTests);
|
|
||||||
|
|
||||||
m_skipTargetsCheck = false;
|
m_skipTargetsCheck = false;
|
||||||
m_runMode = mode;
|
m_runMode = mode;
|
||||||
@@ -362,13 +361,13 @@ void TestRunner::runTests(TestRunMode mode, const QList<ITestConfiguration *> &s
|
|||||||
TestResultsPane::instance()->clearContents();
|
TestResultsPane::instance()->clearContents();
|
||||||
TestTreeModel::instance()->clearFailedMarks();
|
TestTreeModel::instance()->clearFailedMarks();
|
||||||
|
|
||||||
if (m_selectedTests.empty()) {
|
if (m_selectedTests.isEmpty()) {
|
||||||
reportResult(ResultType::MessageWarn, Tr::tr("No tests selected. Canceling test run."));
|
reportResult(ResultType::MessageWarn, Tr::tr("No tests selected. Canceling test run."));
|
||||||
onFinished();
|
onFinished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Project *project = m_selectedTests.at(0)->project();
|
Project *project = m_selectedTests.first()->project();
|
||||||
if (!project) {
|
if (!project) {
|
||||||
reportResult(ResultType::MessageWarn,
|
reportResult(ResultType::MessageWarn,
|
||||||
Tr::tr("Project is null. Canceling test run.\n"
|
Tr::tr("Project is null. Canceling test run.\n"
|
||||||
@@ -875,7 +874,7 @@ bool RunConfigurationSelectionDialog::rememberChoice() const
|
|||||||
|
|
||||||
void RunConfigurationSelectionDialog::populate()
|
void RunConfigurationSelectionDialog::populate()
|
||||||
{
|
{
|
||||||
m_rcCombo->addItem(QString(), QStringList({QString(), QString(), QString()})); // empty default
|
m_rcCombo->addItem({}, QStringList{{}, {}, {}}); // empty default
|
||||||
|
|
||||||
if (auto project = SessionManager::startupProject()) {
|
if (auto project = SessionManager::startupProject()) {
|
||||||
if (auto target = project->activeTarget()) {
|
if (auto target = project->activeTarget()) {
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
|
#include <QList>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QQueue>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -78,7 +78,7 @@ private:
|
|||||||
|
|
||||||
QFutureWatcher<TestResultPtr> m_futureWatcher;
|
QFutureWatcher<TestResultPtr> m_futureWatcher;
|
||||||
QFutureInterface<TestResultPtr> *m_fakeFutureInterface = nullptr;
|
QFutureInterface<TestResultPtr> *m_fakeFutureInterface = nullptr;
|
||||||
QQueue<ITestConfiguration *> m_selectedTests;
|
QList<ITestConfiguration *> m_selectedTests;
|
||||||
bool m_executingTests = false;
|
bool m_executingTests = false;
|
||||||
bool m_canceled = false;
|
bool m_canceled = false;
|
||||||
ITestConfiguration *m_currentConfig = nullptr;
|
ITestConfiguration *m_currentConfig = nullptr;
|
||||||
|
Reference in New Issue
Block a user