http://code.google.com/p/gtest-runner-qt/source/detail?r=22
Added:
/trunk/include/GTestCollectionResults.h
/trunk/include/GTestItem.h
/trunk/include/GTestResults.h
/trunk/include/GTestSuiteResults.h
/trunk/src/GTestCollectionResults.cpp
/trunk/src/GTestResults.cpp
/trunk/src/GTestSuiteResults.cpp
Modified:
/trunk/GTestRunner.pro
/trunk/include/GTest.h
/trunk/include/GTestExecutable.h
/trunk/include/GTestExecutableResults.h
/trunk/include/GTestParser.h
/trunk/include/GTestRunner.h
/trunk/include/GTestSuite.h
/trunk/src/GTest.cpp
/trunk/src/GTestExecutable.cpp
/trunk/src/GTestExecutableResults.cpp
/trunk/src/GTestParser.cpp
/trunk/src/GTestRunner.cpp
/trunk/src/GTestSuite.cpp
=======================================
--- /dev/null
+++ /trunk/include/GTestCollectionResults.h Thu Jul 29 17:53:34 2010
@@ -0,0 +1,64 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * *
+ * GTestCollectionResults.h - Created on 2010-07-27
+ *
+ * Copyright (C) 2010 Sandy Chapman
+ *
+ * This library is free software; you can redistribute it and/or modify it
under the
+ * terms of the GNU Lesser General Public License as published by the Free
Software
+ * Foundation; either version 2.1 of the License, or (at your option) any
later version.
+ * This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public
License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * */
+
+#ifndef GTESTCOLLECTIONRESULTS_H_
+#define GTESTCOLLECTIONRESULTS_H_
+
+#include <QString>
+
+class GTestCollectionResults {
+
+protected:
+ QString exeName;
+ uint numTests;
+ uint numFailures;
+ uint numErrors;
+ uint totalTime;
+
+public:
+ GTestCollectionResults(QString name);
+ void setTestRunCount(uint count);
+ void setTestFailureCount(uint count);
+ void setTestErrorCount(uint count);
+ void setTestTotalTime(uint count);
+ uint getTestRunCount() const;
+ uint getTestFailureCount() const;
+ uint getTestErrorCount() const;
+ uint getTestTotalTime() const;
+ QString getTestName() const;
+
+};
+
+inline void GTestCollectionResults::setTestRunCount(uint count) { numTests
= count; }
+
+inline void GTestCollectionResults::setTestFailureCount(uint count) {
numFailures = count; }
+
+inline void GTestCollectionResults::setTestErrorCount(uint count) {
numErrors = count; }
+
+inline void GTestCollectionResults::setTestTotalTime(uint count) {
totalTime = count; }
+
+inline uint GTestCollectionResults::getTestRunCount() const { return
numTests; }
+
+inline uint GTestCollectionResults::getTestFailureCount() const { return
numFailures; }
+
+inline uint GTestCollectionResults::getTestErrorCount() const { return
numErrors; }
+
+inline uint GTestCollectionResults::getTestTotalTime() const { return
totalTime; }
+
+inline QString GTestCollectionResults::getTestName() const { return
exeName; }
+
+
+#endif /* GTESTCOLLECTIONRESULTS_H_ */
=======================================
--- /dev/null
+++ /trunk/include/GTestItem.h Thu Jul 29 17:53:34 2010
@@ -0,0 +1,29 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * *
+ * GTestItem.h - Created on 2010-07-29
+ *
+ * Copyright (C) 2010 Sandy Chapman
+ *
+ * This library is free software; you can redistribute it and/or modify it
under the
+ * terms of the GNU Lesser General Public License as published by the Free
Software
+ * Foundation; either version 2.1 of the License, or (at your option) any
later version.
+ * This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public
License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * */
+
+#ifndef GTESTITEM_H_
+#define GTESTITEM_H_
+
+#include <QObject>
+
+class GTestItem : public QObject {
+
+private:
+ QString name;
+
+};
+
+#endif /* GTESTITEM_H_ */
=======================================
--- /dev/null
+++ /trunk/include/GTestResults.h Thu Jul 29 17:53:34 2010
@@ -0,0 +1,85 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * *
+ * GTestResults.h - Created on 2010-07-27
+ *
+ * Copyright (C) 2010 Sandy Chapman
+ *
+ * This library is free software; you can redistribute it and/or modify it
under the
+ * terms of the GNU Lesser General Public License as published by the Free
Software
+ * Foundation; either version 2.1 of the License, or (at your option) any
later version.
+ * This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public
License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * */
+
+#ifndef GTESTRESULTS_H_
+#define GTESTRESULTS_H_
+
+#include <QStringList>
+
+class GTestResults {
+
+public:
+ enum STATUS {
+ RUN,
+ UNDEFINED
+ };
+
+private:
+ QString name;
+ uint time;
+ QStringList failureMessages;
+ STATUS status;
+
+public:
+ GTestResults(QString name);
+ void setStatus(QString status);
+ void setRunningTime(uint runTime);
+ void addFailureMessage(QString failureMsg);
+ STATUS getStatus() const;
+ QString getName() const;
+ uint getRunningTime() const;
+ uint getFailureMessageCount() const;
+ QString getFailureMessage(uint num) const;
+ QStringList getFailureMessages() const;
+
+};
+
+inline void GTestResults::setStatus(QString statusString) {
+ if(statusString == "run")
+ status = RUN;
+}
+
+inline void GTestResults::setRunningTime(uint runTime) {
+ time = runTime;
+}
+
+inline void GTestResults::addFailureMessage(QString failureMsg) {
+ failureMessages.append(failureMsg);
+}
+
+inline GTestResults::STATUS GTestResults::getStatus() const { return
status; }
+
+inline QString GTestResults::getName() const {
+ return name;
+}
+
+inline uint GTestResults::getRunningTime() const {
+ return time;
+}
+
+inline uint GTestResults::getFailureMessageCount() const {
+ return failureMessages.size();
+}
+
+inline QString GTestResults::getFailureMessage(uint num) const {
+ return failureMessages.at(num);
+}
+
+inline QStringList GTestResults::getFailureMessages() const {
+ return failureMessages;
+}
+
+#endif /* GTESTRESULTS_H_ */
=======================================
--- /dev/null
+++ /trunk/include/GTestSuiteResults.h Thu Jul 29 17:53:34 2010
@@ -0,0 +1,46 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * *
+ * GTestSuiteResults.h - Created on 2010-07-27
+ *
+ * Copyright (C) 2010 Sandy Chapman
+ *
+ * This library is free software; you can redistribute it and/or modify it
under the
+ * terms of the GNU Lesser General Public License as published by the Free
Software
+ * Foundation; either version 2.1 of the License, or (at your option) any
later version.
+ * This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public
License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * */
+
+#ifndef GTESTSUITERESULTS_H_
+#define GTESTSUITERESULTS_H_
+
+#include <QHash>
+#include <QString>
+
+#include "GTestCollectionResults.h"
+#include "GTestResults.h"
+
+class GTestSuiteResults : public GTestCollectionResults {
+
+private:
+ QHash<QString, GTestResults*> testResultsHash;
+
+public:
+ GTestSuiteResults(QString name);
+ void addTestResults(GTestResults* testResults);
+ GTestResults* getTestResults(QString testName);
+
+};
+
+inline void GTestSuiteResults::addTestResults(GTestResults* testResults) {
+ testResultsHash.insert(testResults->getName(), testResults);
+}
+
+inline GTestResults* GTestSuiteResults::getTestResults(QString testName) {
+ return testResultsHash.value(testName);
+}
+
+#endif /* GTESTSUITERESULTS_H_ */
=======================================
--- /dev/null
+++ /trunk/src/GTestCollectionResults.cpp Thu Jul 29 17:53:34 2010
@@ -0,0 +1,21 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * *
+ * GTestCollectionResults.cpp - Created on 2010-07-27
+ *
+ * Copyright (C) 2010 Sandy Chapman
+ *
+ * This library is free software; you can redistribute it and/or modify it
under the
+ * terms of the GNU Lesser General Public License as published by the Free
Software
+ * Foundation; either version 2.1 of the License, or (at your option) any
later version.
+ * This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public
License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * */
+
+#include "GTestCollectionResults.h"
+
+GTestCollectionResults::GTestCollectionResults(QString exeName)
+: exeName(exeName)
+{}
=======================================
--- /dev/null
+++ /trunk/src/GTestResults.cpp Thu Jul 29 17:53:34 2010
@@ -0,0 +1,21 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * *
+ * GTestResults.cpp - Created on 2010-07-27
+ *
+ * Copyright (C) 2010 Sandy Chapman
+ *
+ * This library is free software; you can redistribute it and/or modify it
under the
+ * terms of the GNU Lesser General Public License as published by the Free
Software
+ * Foundation; either version 2.1 of the License, or (at your option) any
later version.
+ * This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public
License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * */
+
+#include "GTestResults.h"
+
+GTestResults::GTestResults(QString name)
+: name(name), time(-1), failureMessages(), status(UNDEFINED)
+{}
=======================================
--- /dev/null
+++ /trunk/src/GTestSuiteResults.cpp Thu Jul 29 17:53:34 2010
@@ -0,0 +1,22 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * *
+ * GTestSuiteResults.h - Created on 2010-07-27
+ *
+ * Copyright (C) 2010 Sandy Chapman
+ *
+ * This library is free software; you can redistribute it and/or modify it
under the
+ * terms of the GNU Lesser General Public License as published by the Free
Software
+ * Foundation; either version 2.1 of the License, or (at your option) any
later version.
+ * This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public
License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * */
+
+#include "GTestSuiteResults.h"
+
+GTestSuiteResults::GTestSuiteResults(QString name)
+: GTestCollectionResults(name)
+{}
+
=======================================
--- /trunk/GTestRunner.pro Tue Jul 27 16:50:43 2010
+++ /trunk/GTestRunner.pro Thu Jul 29 17:53:34 2010
@@ -2,7 +2,8 @@
TARGET = GTestRunner
QT += core \
gui
-HEADERS += include/GTestCollectionResults.h \
+HEADERS += include/GTestItem.h \
+ include/GTestCollectionResults.h \
include/GTestSuiteResults.h \
include/GTestResults.h \
include/GTestSuite.h \
=======================================
--- /trunk/include/GTest.h Mon Jul 26 15:58:53 2010
+++ /trunk/include/GTest.h Thu Jul 29 17:53:34 2010
@@ -21,35 +21,34 @@
#include <QObject>
#include <QString>
+#include "GTestResults.h"
+
class GTest : public QObject {
Q_OBJECT
public:
- enum STATE {
- PASSED,
- FAILED,
- NOT_RUN
- };
+ GTestResults* testResults;
private:
QString name;
- STATE state;
signals:
void requestingRun(QString testName);
+ void testResultsReady();
public:
GTest(QString name);
- STATE getState() const;
void run();
+ QString getName() const;
+ void receiveTestResults(GTestResults* testResults);
};
Q_DECLARE_METATYPE(GTest*);
-
-inline GTest::STATE GTest::getState() const { return state; }
inline void GTest::run() { emit requestingRun(name); }
+
+inline QString GTest::getName() const { return name; }
#endif /* GTEST_H_ */
=======================================
--- /trunk/include/GTestExecutable.h Tue Jul 27 16:50:43 2010
+++ /trunk/include/GTestExecutable.h Thu Jul 29 17:53:34 2010
@@ -23,6 +23,7 @@
#include <QMetaType>
#include <QMutex>
+#include "GTestExecutableResults.h"
#include "GTestSuite.h"
class GTestExecutable : public QObject {
@@ -48,6 +49,7 @@
QList<GTestSuite*> runList;
QStringList testsToRun;
bool runOnSignal;
+ GTestExecutableResults* testResults;
QProcess::ProcessError error;
QProcess::ExitStatus exitStatus;
@@ -89,8 +91,8 @@
//METHODS:
void produceListing();
- void addTestCase(GTestSuite* testCase);
- void removeTestCase(GTestSuite* testCase);
+ void addTestSuite(GTestSuite* testCase);
+ void removeTestSuite(GTestSuite* testCase);
};
@@ -110,13 +112,13 @@
inline void GTestExecutable::setRunFlag(bool runOnSignal) {
this->runOnSignal = runOnSignal; }
-inline void GTestExecutable::addTestCase(GTestSuite* testCase) {
- QObject::connect(testCase, SIGNAL(requestRun(QString, QString)),
+inline void GTestExecutable::addTestSuite(GTestSuite* testCase) {
+ QObject::connect(testCase, SIGNAL(requestingRun(QString, QString)),
this, SLOT(receiveRunRequest(QString, QString)));
}
-inline void GTestExecutable::removeTestCase(GTestSuite* testCase) {
- QObject::disconnect(testCase, SIGNAL(requestRun(QString, QString)),
+inline void GTestExecutable::removeTestSuite(GTestSuite* testCase) {
+ QObject::disconnect(testCase, SIGNAL(requestingRun(QString, QString)),
this, SLOT(receiveRunRequest(QString, QString)));
}
=======================================
--- /trunk/include/GTestExecutableResults.h Tue Jul 27 16:50:43 2010
+++ /trunk/include/GTestExecutableResults.h Thu Jul 29 17:53:34 2010
@@ -17,7 +17,7 @@
#ifndef GTESTEXECUTABLERESULTS_H_
#define GTESTEXECUTABLERESULTS_H_
-#include <QList>
+#include <QHash>
#include <QString>
#include "Defines.h"
@@ -27,16 +27,21 @@
class GTestExecutableResults : public GTestCollectionResults {
private:
- QList<GTestSuiteResults*> suiteResultsList;
+ QHash<QString, GTestSuiteResults*> suiteResultsHash;
public:
GTestExecutableResults(QString name);
void addTestSuiteResults(GTestSuiteResults* testSuiteResults);
+ GTestSuiteResults* getTestSuiteResults(QString testSuiteName);
};
inline void GTestExecutableResults::addTestSuiteResults(GTestSuiteResults*
testSuiteResults) {
- suiteResultsList.append(testSuiteResults);
+ suiteResultsHash.insert(testSuiteResults->getTestName(),
testSuiteResults);
+}
+
+inline GTestSuiteResults*
GTestExecutableResults::getTestSuiteResults(QString testSuiteName) {
+ return suiteResultsHash.value(testSuiteName);
}
#endif /* GTESTEXECUTABLERESULTS_H_ */
=======================================
--- /trunk/include/GTestParser.h Mon Jul 26 15:58:53 2010
+++ /trunk/include/GTestParser.h Thu Jul 29 17:53:34 2010
@@ -29,7 +29,7 @@
public:
GTestParser(QIODevice *inStream);
- void parse();
+ GTestExecutableResults* parse();
};
=======================================
--- /trunk/include/GTestRunner.h Mon Jul 26 15:58:53 2010
+++ /trunk/include/GTestRunner.h Thu Jul 29 17:53:34 2010
@@ -18,6 +18,7 @@
#define GTESTRUNNER_H
#include <QFile>
+#include <QHash>
#include <QList>
#include <QMainWindow>
#include <QMenu>
=======================================
--- /trunk/include/GTestSuite.h Tue Jul 27 15:12:07 2010
+++ /trunk/include/GTestSuite.h Thu Jul 29 17:53:34 2010
@@ -22,6 +22,7 @@
#include <QObject>
#include "GTest.h"
+#include "GTestSuiteResults.h"
class GTestSuite : public QObject {
@@ -30,10 +31,11 @@
private:
QString name;
QList<GTest*> runList;
+ GTestSuiteResults* testSuiteResults;
signals:
- void requestRun(QString caseName, QString testName);
- void resultsReceived();
+ void requestingRun(QString caseName, QString testName);
+ void testResultsReady();
public slots:
void receiveRunRequest(QString testName);
@@ -43,19 +45,24 @@
void addTest(GTest* test);
void removeTest(GTest* test);
void run();
+ QString getName() const;
+ void receiveTestResults(GTestSuiteResults* testResults);
+ GTest* getTestResults(QString testName);
};
Q_DECLARE_METATYPE(GTestSuite*);
inline void GTestSuite::addTest(GTest* test) {
- QObject::connect(test, SIGNAL(requestRun(QString)),
+ QObject::connect(test, SIGNAL(requestingRun(QString)),
this, SLOT(receiveRunRequest(QString)));
}
inline void GTestSuite::removeTest(GTest* test) {
- QObject::disconnect(test, SIGNAL(requestRun(QString)),
+ QObject::disconnect(test, SIGNAL(requestingRun(QString)),
this, SLOT(receiveRunRequest(QString)));
}
+
+inline QString GTestSuite::getName() const { return name; }
#endif /* GTESTFIXTURE_H_ */
=======================================
--- /trunk/src/GTest.cpp Sun Jul 25 14:04:38 2010
+++ /trunk/src/GTest.cpp Thu Jul 29 17:53:34 2010
@@ -17,5 +17,13 @@
#include "GTest.h"
GTest::GTest(QString name)
-: name(name), state(NOT_RUN)
+: name(name), testResults(0)
{}
+
+void GTest::receiveTestResults(GTestResults* testResults) {
+ this->testResults = testResults;
+ emit testResultsReady();
+}
+
+
+
=======================================
--- /trunk/src/GTestExecutable.cpp Tue Jul 27 16:50:43 2010
+++ /trunk/src/GTestExecutable.cpp Thu Jul 29 17:53:34 2010
@@ -97,7 +97,15 @@
return;
QFile xmlFile("./test_detail_1337.xml");
GTestParser parser(&xmlFile);
- parser.parse();
+ testResults = parser.parse();
+ QList<GTestSuite*>::iterator it = runList.begin();
+ GTestSuiteResults* testSuiteResults;
+ while(it != runList.end()) {
+ testSuiteResults = testResults->getTestSuiteResults((*it)->getName());
+ (*it)->receiveTestResults(testSuiteResults);
+ ++it;
+ }
+ runList.clear();
executableFinished(exitCode, exitStatus);
emit testResultsReady(this);
}
=======================================
--- /trunk/src/GTestExecutableResults.cpp Tue Jul 27 16:50:43 2010
+++ /trunk/src/GTestExecutableResults.cpp Thu Jul 29 17:53:34 2010
@@ -17,5 +17,12 @@
#include "GTestExecutableResults.h"
GTestExecutableResults::GTestExecutableResults(QString name)
-: GTestCollectionResults(name)
+: GTestCollectionResults(name), suiteResultsHash()
{}
+
+
+
+
+
+
+
=======================================
--- /trunk/src/GTestParser.cpp Tue Jul 27 16:50:43 2010
+++ /trunk/src/GTestParser.cpp Thu Jul 29 17:53:34 2010
@@ -25,7 +25,7 @@
: xmlSource(inStream)
{}
-void GTestParser::parse() {
+GTestExecutableResults* GTestParser::parse() {
xmlSource->open(QIODevice::ReadOnly);
xmlSource->seek(0);
QXmlStreamReader xmlStream(xmlSource);
@@ -48,6 +48,7 @@
attributes = xmlStream.attributes();
testResults->addFailureMessage(attributes.value("message").toString());
}
+ testSuiteResults->addTestResults(testResults);
}
else if(xmlStream.name() == "testsuite") {
testSuiteResults = new
GTestSuiteResults(attributes.value("name").toString());
@@ -68,4 +69,5 @@
qDebug() << xmlStream.errorString();
}
}
-}
+ return testExeResults;
+}
=======================================
--- /trunk/src/GTestRunner.cpp Tue Jul 27 15:12:07 2010
+++ /trunk/src/GTestRunner.cpp Thu Jul 29 17:53:34 2010
@@ -212,19 +212,20 @@
QTreeWidgetItem* topLevelItem = 0;
QTreeWidgetItem* newItem = 0;
- GTestSuite* fixture = 0;
+ GTestSuite* suite = 0;
GTest* test = 0;
while(it != testList.end()) {
qDebug() << *it;
if(it->endsWith(".")) {
//drop the '.' and make it a data item
- QString fixtureName = it->left(it->size()-1);
- topLevelItem = new QTreeWidgetItem(testContainer,
QStringList()<<fixtureName);
+ QString suiteName = it->left(it->size()-1);
+ topLevelItem = new QTreeWidgetItem(testContainer,
QStringList()<<suiteName);
topLevelItem->setFlags(Qt::ItemIsTristate | Qt::ItemIsSelectable |
Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
topLevelItem->setCheckState(0, Qt::Checked);
- fixture = new GTestSuite(fixtureName);
- var.setValue<GTestSuite*>(fixture);
+ suite = new GTestSuite(suiteName);
+ var.setValue<GTestSuite*>(suite);
topLevelItem->setData(0,Qt::UserRole,var);
+ gtest->addTestSuite(suite);
}
else {
//drop the spaces and make it a data item
@@ -235,6 +236,7 @@
test = new GTest(testName);
var.setValue<GTest*>(test);
newItem->setData(0,Qt::UserRole,var);
+ suite->addTest(test);
}
++it;
}
@@ -270,7 +272,17 @@
emit runningTests();
}
-void GTestRunner::fillTestResults(GTestExecutable* gtest) {
+//TODO::Refactor the three copies of setTestResults to one function
+//TODO::The above will require a common base class, or a templated function
+void GTestRunner::setTestResult(GTest* gtest) {
+
+}
+
+void GTestRunner::setTestResult(GTest* gtest) {
+
+}
+
+void GTestRunner::setTestResult(GTest* gtest) {
}
=======================================
--- /trunk/src/GTestSuite.cpp Tue Jul 27 15:12:07 2010
+++ /trunk/src/GTestSuite.cpp Thu Jul 29 17:53:34 2010
@@ -15,12 +15,27 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * */
#include "GTestSuite.h"
+#include "GTestResults.h"
GTestSuite::GTestSuite(QString name)
-: name(name), runList()
+: name(name), runList(), testSuiteResults(0)
{}
void GTestSuite::receiveRunRequest(QString testName) {
runList.append((GTest*)QObject::sender());
- emit requestRun(name, testName);
-}
+ emit requestingRun(name, testName);
+}
+
+void GTestSuite::receiveTestResults(GTestSuiteResults* testSuiteResults) {
+ this->testSuiteResults = testSuiteResults;
+ QList<GTest*>::iterator it = runList.begin();
+ GTestResults* testResults;
+ while(it != runList.end()) {
+ testResults = testSuiteResults->getTestResults((*it)->getName());
+ (*it)->receiveTestResults(testResults);
+ ++it;
+ }
+ runList.clear();
+ emit testResultsReady();
+}
+