AutoTest: Modernize code a bit

Change-Id: Ie56f6e5cb8a4f1962bd8df5e57214911ae609921
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2016-09-29 12:15:43 +02:00
parent 8b579fca6a
commit b0bf07c64a
44 changed files with 207 additions and 235 deletions

View File

@@ -77,10 +77,7 @@ void ResultsTreeView::keyPressEvent(QKeyEvent *event)
TestResultsPane::TestResultsPane(QObject *parent) :
Core::IOutputPane(parent),
m_context(new Core::IContext(this)),
m_wasVisibleBefore(false),
m_autoScroll(false),
m_testRunning(false)
m_context(new Core::IContext(this))
{
m_outputWidget = new QWidget;
QVBoxLayout *outputLayout = new QVBoxLayout;
@@ -441,32 +438,28 @@ void TestResultsPane::initializeFilterMenu()
void TestResultsPane::updateSummaryLabel()
{
QString labelText = QString::fromLatin1("<p>Test summary:&nbsp;&nbsp; %1 %2, %3 %4")
QString labelText = QString("<p>Test summary:&nbsp;&nbsp; %1 %2, %3 %4")
.arg(QString::number(m_model->resultTypeCount(Result::Pass)), tr("passes"),
QString::number(m_model->resultTypeCount(Result::Fail)), tr("fails"));
int count = m_model->resultTypeCount(Result::UnexpectedPass);
if (count)
labelText.append(QString::fromLatin1(", %1 %2")
.arg(QString::number(count), tr("unexpected passes")));
labelText.append(QString(", %1 %2").arg(QString::number(count), tr("unexpected passes")));
count = m_model->resultTypeCount(Result::ExpectedFail);
if (count)
labelText.append(QString::fromLatin1(", %1 %2")
.arg(QString::number(count), tr("expected fails")));
labelText.append(QString(", %1 %2").arg(QString::number(count), tr("expected fails")));
count = m_model->resultTypeCount(Result::MessageFatal);
if (count)
labelText.append(QString::fromLatin1(", %1 %2")
.arg(QString::number(count), tr("fatals")));
labelText.append(QString(", %1 %2").arg(QString::number(count), tr("fatals")));
count = m_model->resultTypeCount(Result::BlacklistedFail)
+ m_model->resultTypeCount(Result::BlacklistedPass);
if (count)
labelText.append(QString::fromLatin1(", %1 %2")
.arg(QString::number(count), tr("blacklisted")));
labelText.append(QString(", %1 %2").arg(QString::number(count), tr("blacklisted")));
count = m_model->disabledTests();
if (count)
labelText.append(tr(", %1 disabled").arg(count));
labelText.append(QLatin1String(".</p>"));
labelText.append(".</p>");
m_summaryLabel->setText(labelText);
}
@@ -586,8 +579,8 @@ QString TestResultsPane::getWholeOutput(const QModelIndex &parent)
QModelIndex current = m_model->index(row, 0, parent);
const TestResult *result = m_model->testResult(current);
QTC_ASSERT(result, continue);
output.append(TestResult::resultToString(result->result())).append(QLatin1Char('\t'));
output.append(result->outputString(true)).append(QLatin1Char('\n'));
output.append(TestResult::resultToString(result->result())).append('\t');
output.append(result->outputString(true)).append('\n');
output.append(getWholeOutput(current));
}
return output;