From c42bda94576bb6c9f7364414a58f86c55d171df9 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Fri, 12 Jun 2015 13:00:10 +0200 Subject: Handle squishrunner quickly returning Change-Id: Idc77d3fc5defd46e912b4ab0cdc4e82214ec75e9 Reviewed-by: Christian Stenger --- plugins/autotest/testresultspane.cpp | 2 ++ plugins/autotest/testresultspane.h | 2 +- plugins/autotest/testsquishtools.cpp | 10 ++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/autotest/testresultspane.cpp b/plugins/autotest/testresultspane.cpp index d2425ce80b..29c6549ffe 100644 --- a/plugins/autotest/testresultspane.cpp +++ b/plugins/autotest/testresultspane.cpp @@ -159,6 +159,8 @@ TestResultsPane::~TestResultsPane() void TestResultsPane::addTestResult(const TestResult &result) { m_model->addTestResult(result); + if (result.result() >= Result::SQUISH_GROUP_BEGIN && result.result() <= Result::SQUISH_GROUP_END) + updateSquishSummaryLabel(); if (!m_treeView->isVisible()) popup(Core::IOutputPane::NoModeSwitch); flash(); diff --git a/plugins/autotest/testresultspane.h b/plugins/autotest/testresultspane.h index a448fe6f04..f1d9911a7a 100644 --- a/plugins/autotest/testresultspane.h +++ b/plugins/autotest/testresultspane.h @@ -70,13 +70,13 @@ public: bool canPrevious() const; void goToNext(); void goToPrev(); + void updateSquishSummaryLabel(); signals: public slots: void addTestResult(const TestResult &result); void addLogoutput(const QString &output); - void updateSquishSummaryLabel(); private slots: void onItemActivated(const QModelIndex &index); diff --git a/plugins/autotest/testsquishtools.cpp b/plugins/autotest/testsquishtools.cpp index 62bde4e62b..523315f6c2 100644 --- a/plugins/autotest/testsquishtools.cpp +++ b/plugins/autotest/testsquishtools.cpp @@ -65,8 +65,6 @@ TestSquishTools::TestSquishTools(QObject *parent) resultPane, &TestResultsPane::addLogoutput, Qt::QueuedConnection); connect(this, &TestSquishTools::squishTestRunStarted, resultPane, &TestResultsPane::clearContents); - connect(this, &TestSquishTools::squishTestRunFinished, - resultPane, &TestResultsPane::updateSquishSummaryLabel); } TestSquishTools::~TestSquishTools() @@ -505,6 +503,9 @@ void TestSquishTools::onRunnerFinished(int, QProcess::ExitStatus) m_resultsFileWatcher = 0; } if (m_currentResultsXML) { + // make sure results are being read if not done yet + if (m_currentResultsXML->exists() && !m_currentResultsXML->isOpen()) + onResultsDirChanged(m_currentResultsXML->fileName()); if (m_currentResultsXML->isOpen()) m_currentResultsXML->close(); delete m_currentResultsXML; @@ -634,6 +635,9 @@ void TestSquishTools::onRunnerErrorOutput() void TestSquishTools::onResultsDirChanged(const QString &filePath) { + if (!m_currentResultsXML) + return; // runner finished before, m_currentResultsXML deleted + if (m_currentResultsXML->exists()) { delete m_resultsFileWatcher; m_resultsFileWatcher = 0; @@ -643,6 +647,8 @@ void TestSquishTools::onResultsDirChanged(const QString &filePath) m_resultsFileWatcher->addPath(m_currentResultsXML->fileName()); connect(m_resultsFileWatcher, &QFileSystemWatcher::fileChanged, this, &TestSquishTools::onRunnerOutput); + // squishrunner might have finished already, call once at least + onRunnerOutput(m_currentResultsXML->fileName()); } else { // TODO set a flag to process results.xml as soon the complete test run has finished qWarning() << "could not open results.xml although it exists" -- cgit v1.2.1