[gtest-runner-qt] r23 committed - Finished the test display function now that results are being produced...

5 views
Skip to first unread message

gtest-r...@googlecode.com

unread,
Aug 7, 2010, 2:13:27 PM8/7/10
to gtest-r...@googlegroups.com
Revision: 23
Author: sandychapman
Date: Sat Aug 7 11:11:45 2010
Log: Finished the test display function now that results are being produced.
Refactored GTest classes so that the executable derives the suite derives
the
test. Mirrored this hierarchy on the testResult side as well.

Success! Tests can now be run.

http://code.google.com/p/gtest-runner-qt/source/detail?r=23

Added:
/trunk/include/GTestResultsItem.h
/trunk/include/TestTreeWidget.h
/trunk/include/TestTreeWidgetItem.h
/trunk/src/TestTreeWidget.cpp
/trunk/src/TestTreeWidgetItem.cpp
Modified:
/trunk/GTestRunner.pro
/trunk/Makefile
/trunk/Makefile.Debug
/trunk/Makefile.Release
/trunk/include/GTest.h
/trunk/include/GTestExecutable.h
/trunk/include/GTestExecutableResults.h
/trunk/include/GTestResults.h
/trunk/include/GTestRunner.h
/trunk/include/GTestSuite.h
/trunk/include/GTestSuiteResults.h
/trunk/src/GTest.cpp
/trunk/src/GTestExecutable.cpp
/trunk/src/GTestExecutableResults.cpp
/trunk/src/GTestParser.cpp
/trunk/src/GTestResults.cpp
/trunk/src/GTestRunner.cpp
/trunk/src/GTestSuite.cpp
/trunk/src/GTestSuiteResults.cpp

=======================================
--- /dev/null
+++ /trunk/include/GTestResultsItem.h Sat Aug 7 11:11:45 2010
@@ -0,0 +1,24 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * *
+ * GTestResultItem.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 GTESTRESULTITEM_H_
+#define GTESTRESULTITEM_H_
+
+class GTestResultsItem {
+
+};
+
+#endif /* GTESTRESULTITEM_H_ */
=======================================
--- /dev/null
+++ /trunk/include/TestTreeWidget.h Sat Aug 7 11:11:45 2010
@@ -0,0 +1,41 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * *
+ * TestTreeWidget.h - Created on 2010-08-07
+ *
+ * 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 TESTTREEWIDGET_H_
+#define TESTTREEWIDGET_H_
+
+#include <QTreeWidget>
+#include <QTreeWidgetItem>
+
+#include "GTest.h"
+#include "GTestResults.h"
+#include "TestTreeWidgetItem.h"
+
+class TestTreeWidget : public QTreeWidget {
+
+Q_OBJECT
+
+public slots:
+ void populateTestResult(QObject* item);
+
+public:
+ TestTreeWidget(QWidget* parent = 0);
+ virtual ~TestTreeWidget();
+
+};
+
+
+#endif /* TESTTREEWIDGET_H_ */
=======================================
--- /dev/null
+++ /trunk/include/TestTreeWidgetItem.h Sat Aug 7 11:11:45 2010
@@ -0,0 +1,36 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * *
+ * TestTreeWidgetItem.h - Created on 2010-08-07
+ *
+ * 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 TESTTREEWIDGETITEM_H_
+#define TESTTREEWIDGETITEM_H_
+
+#include <QObject>
+#include <QTreeWidgetItem>
+
+#include "GTestResults.h"
+
+class TestTreeWidgetItem : public QObject, public QTreeWidgetItem {
+
+Q_OBJECT
+
+public:
+ TestTreeWidgetItem(QTreeWidget* parent, const QStringList& strings, int
type = Type);
+ TestTreeWidgetItem(QTreeWidgetItem* parent, const QStringList& strings,
int type = Type);
+ virtual ~TestTreeWidgetItem();
+
+};
+
+#endif /* TESTTREEWIDGETITEM_H_ */
=======================================
--- /dev/null
+++ /trunk/src/TestTreeWidget.cpp Sat Aug 7 11:11:45 2010
@@ -0,0 +1,56 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * *
+ * TestTreeWidget.cpp - Created on 2010-08-07
+ *
+ * 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 "TestTreeWidget.h"
+#include "GTestSuite.h"
+#include "GTestExecutable.h"
+
+TestTreeWidget::TestTreeWidget(QWidget* parent)
+: QTreeWidget(parent)
+{}
+
+TestTreeWidget::~TestTreeWidget()
+{}
+
+void TestTreeWidget::populateTestResult(QObject* item) {
+ TestTreeWidgetItem* treeItem = static_cast<TestTreeWidgetItem*>(item);
+ if(treeItem == 0)
+ return; //TODO:: exception management stuff here
+
+ QVariant var = treeItem->data(0,Qt::UserRole);
+ GTest* testItem = var.value<GTest*>();
+ if(testItem == 0) {
+ testItem = var.value<GTestSuite*>();
+ if(testItem == 0) {
+ testItem = var.value<GTestExecutable*>();
+ if(testItem == 0)
+ return;
+ }
+ }
+
+ const GTestResults* testResults = testItem->getTestResults();
+ if(testResults == 0)
+ return;
+
+ if(testResults->getFailureCount() == 0)
+ treeItem->setBackgroundColor(0,Qt::green);
+ else
+ treeItem->setBackgroundColor(0,Qt::red);
+}
+
+
+
+
=======================================
--- /dev/null
+++ /trunk/src/TestTreeWidgetItem.cpp Sat Aug 7 11:11:45 2010
@@ -0,0 +1,29 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * *
+ * TestTreeWidgetItem.cpp - Created on 2010-08-07
+ *
+ * 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 "TestTreeWidgetItem.h"
+
+
+TestTreeWidgetItem::TestTreeWidgetItem(QTreeWidget* parent, const
QStringList& strings, int type)
+: QObject(), QTreeWidgetItem(parent, strings, type)
+{}
+
+TestTreeWidgetItem::TestTreeWidgetItem(QTreeWidgetItem* parent, const
QStringList& strings, int type)
+: QObject(), QTreeWidgetItem(parent, strings, type)
+{}
+
+TestTreeWidgetItem::~TestTreeWidgetItem()
+{}
=======================================
--- /trunk/GTestRunner.pro Thu Jul 29 17:53:34 2010
+++ /trunk/GTestRunner.pro Sat Aug 7 11:11:45 2010
@@ -2,8 +2,9 @@
TARGET = GTestRunner
QT += core \
gui
-HEADERS += include/GTestItem.h \
- include/GTestCollectionResults.h \
+HEADERS += include/TestTreeWidgetItem.h \
+ include/TestTreeWidget.h \
+ include/GTestResultsItem.h \
include/GTestSuiteResults.h \
include/GTestResults.h \
include/GTestSuite.h \
@@ -13,8 +14,9 @@
include/GTestExecutable.h \
include/GTestParser.h \
include/GTestRunner.h
-SOURCES += src/GTestResults.cpp \
- src/GTestCollectionResults.cpp \
+SOURCES += src/TestTreeWidgetItem.cpp \
+ src/TestTreeWidget.cpp \
+ src/GTestResults.cpp \
src/GTestSuiteResults.cpp \
src/GTestSuite.cpp \
src/GTestExecutableResults.cpp \
=======================================
--- /trunk/Makefile Tue Jul 27 16:50:43 2010
+++ /trunk/Makefile Sat Aug 7 11:11:45 2010
@@ -1,6 +1,6 @@

#############################################################################
# Makefile for building: GTestRunner
-# Generated by qmake (2.01a) (Qt 4.6.2) on: Tue Jul 27 20:05:17 2010
+# Generated by qmake (2.01a) (Qt 4.6.2) on: Sat Aug 7 14:42:20 2010
# Project: GTestRunner.pro
# Template: app
# Command: /usr/local/Trolltech/Qt-4.6.2/bin/qmake -unix
CONFIG+=debug_and_release -o Makefile GTestRunner.pro
=======================================
--- /trunk/Makefile.Debug Tue Jul 27 16:50:43 2010
+++ /trunk/Makefile.Debug Sat Aug 7 11:11:45 2010
@@ -1,6 +1,6 @@

#############################################################################
# Makefile for building: GTestRunner
-# Generated by qmake (2.01a) (Qt 4.6.2) on: Tue Jul 27 20:05:17 2010
+# Generated by qmake (2.01a) (Qt 4.6.2) on: Sat Aug 7 14:42:20 2010
# Project: GTestRunner.pro
# Template: app

#############################################################################
@@ -42,8 +42,9 @@

####### Files

-SOURCES = src/GTestResults.cpp \
- src/GTestCollectionResults.cpp \
+SOURCES = src/TestTreeWidgetItem.cpp \
+ src/TestTreeWidget.cpp \
+ src/GTestResults.cpp \
src/GTestSuiteResults.cpp \
src/GTestSuite.cpp \
src/GTestExecutableResults.cpp \
@@ -51,12 +52,15 @@
src/GTestExecutable.cpp \
main.cpp \
src/GTestParser.cpp \
- src/GTestRunner.cpp debug/moc_GTestSuite.cpp \
+ src/GTestRunner.cpp debug/moc_TestTreeWidgetItem.cpp \
+ debug/moc_TestTreeWidget.cpp \
+ debug/moc_GTestSuite.cpp \
debug/moc_GTest.cpp \
debug/moc_GTestExecutable.cpp \
debug/moc_GTestRunner.cpp
-OBJECTS = debug/GTestResults.o \
- debug/GTestCollectionResults.o \
+OBJECTS = debug/TestTreeWidgetItem.o \
+ debug/TestTreeWidget.o \
+ debug/GTestResults.o \
debug/GTestSuiteResults.o \
debug/GTestSuite.o \
debug/GTestExecutableResults.o \
@@ -65,6 +69,8 @@
debug/main.o \
debug/GTestParser.o \
debug/GTestRunner.o \
+ debug/moc_TestTreeWidgetItem.o \
+ debug/moc_TestTreeWidget.o \
debug/moc_GTestSuite.o \
debug/moc_GTest.o \
debug/moc_GTestExecutable.o \
@@ -127,7 +133,7 @@

dist:
@$(CHK_DIR_EXISTS) debug/GTestRunner1.0.0 || $(MKDIR)
debug/GTestRunner1.0.0
- $(COPY_FILE) --parents $(SOURCES) $(DIST) debug/GTestRunner1.0.0/ &&
$(COPY_FILE) --parents include/GTestCollectionResults.h
include/GTestSuiteResults.h include/GTestResults.h include/GTestSuite.h
include/Defines.h include/GTestExecutableResults.h include/GTest.h
include/GTestExecutable.h include/GTestParser.h include/GTestRunner.h
debug/GTestRunner1.0.0/ && $(COPY_FILE) --parents src/GTestResults.cpp
src/GTestCollectionResults.cpp src/GTestSuiteResults.cpp src/GTestSuite.cpp
src/GTestExecutableResults.cpp src/GTest.cpp src/GTestExecutable.cpp
main.cpp src/GTestParser.cpp src/GTestRunner.cpp debug/GTestRunner1.0.0/ &&
(cd `dirname debug/GTestRunner1.0.0` && $(TAR) GTestRunner1.0.0.tar
GTestRunner1.0.0 && $(COMPRESS) GTestRunner1.0.0.tar) && $(MOVE) `dirname
debug/GTestRunner1.0.0`/GTestRunner1.0.0.tar.gz . && $(DEL_FILE) -r
debug/GTestRunner1.0.0
+ $(COPY_FILE) --parents $(SOURCES) $(DIST) debug/GTestRunner1.0.0/ &&
$(COPY_FILE) --parents include/TestTreeWidgetItem.h
include/TestTreeWidget.h include/GTestResultsItem.h
include/GTestSuiteResults.h include/GTestResults.h include/GTestSuite.h
include/Defines.h include/GTestExecutableResults.h include/GTest.h
include/GTestExecutable.h include/GTestParser.h include/GTestRunner.h
debug/GTestRunner1.0.0/ && $(COPY_FILE) --parents
src/TestTreeWidgetItem.cpp src/TestTreeWidget.cpp src/GTestResults.cpp
src/GTestSuiteResults.cpp src/GTestSuite.cpp src/GTestExecutableResults.cpp
src/GTest.cpp src/GTestExecutable.cpp main.cpp src/GTestParser.cpp
src/GTestRunner.cpp debug/GTestRunner1.0.0/ && (cd `dirname
debug/GTestRunner1.0.0` && $(TAR) GTestRunner1.0.0.tar GTestRunner1.0.0 &&
$(COMPRESS) GTestRunner1.0.0.tar) && $(MOVE) `dirname
debug/GTestRunner1.0.0`/GTestRunner1.0.0.tar.gz . && $(DEL_FILE) -r
debug/GTestRunner1.0.0


clean:compiler_clean
@@ -146,24 +152,47 @@

mocables: compiler_moc_header_make_all compiler_moc_source_make_all

-compiler_moc_header_make_all: debug/moc_GTestSuite.cpp debug/moc_GTest.cpp
debug/moc_GTestExecutable.cpp debug/moc_GTestRunner.cpp
+compiler_moc_header_make_all: debug/moc_TestTreeWidgetItem.cpp
debug/moc_TestTreeWidget.cpp debug/moc_GTestSuite.cpp debug/moc_GTest.cpp
debug/moc_GTestExecutable.cpp debug/moc_GTestRunner.cpp
compiler_moc_header_clean:
- -$(DEL_FILE) debug/moc_GTestSuite.cpp debug/moc_GTest.cpp
debug/moc_GTestExecutable.cpp debug/moc_GTestRunner.cpp
+ -$(DEL_FILE) debug/moc_TestTreeWidgetItem.cpp
debug/moc_TestTreeWidget.cpp debug/moc_GTestSuite.cpp debug/moc_GTest.cpp
debug/moc_GTestExecutable.cpp debug/moc_GTestRunner.cpp
+debug/moc_TestTreeWidgetItem.cpp: include/GTestResults.h \
+ include/TestTreeWidgetItem.h
+ /usr/local/Trolltech/Qt-4.6.2/bin/moc $(DEFINES) $(INCPATH)
include/TestTreeWidgetItem.h -o debug/moc_TestTreeWidgetItem.cpp
+
+debug/moc_TestTreeWidget.cpp: include/GTest.h \
+ include/GTestResults.h \
+ include/TestTreeWidgetItem.h \
+ include/TestTreeWidget.h
+ /usr/local/Trolltech/Qt-4.6.2/bin/moc $(DEFINES) $(INCPATH)
include/TestTreeWidget.h -o debug/moc_TestTreeWidget.cpp
+
debug/moc_GTestSuite.cpp: include/GTest.h \
+ include/GTestResults.h \
+ include/GTestSuiteResults.h \
include/GTestSuite.h
/usr/local/Trolltech/Qt-4.6.2/bin/moc $(DEFINES) $(INCPATH)
include/GTestSuite.h -o debug/moc_GTestSuite.cpp

-debug/moc_GTest.cpp: include/GTest.h
+debug/moc_GTest.cpp: include/GTestResults.h \
+ include/GTest.h
/usr/local/Trolltech/Qt-4.6.2/bin/moc $(DEFINES) $(INCPATH)
include/GTest.h -o debug/moc_GTest.cpp

-debug/moc_GTestExecutable.cpp: include/GTestSuite.h \
+debug/moc_GTestExecutable.cpp: include/GTestExecutableResults.h \
+ include/Defines.h \
+ include/GTestSuiteResults.h \
+ include/GTestResults.h \
+ include/GTestSuite.h \
include/GTest.h \
include/GTestExecutable.h
/usr/local/Trolltech/Qt-4.6.2/bin/moc $(DEFINES) $(INCPATH)
include/GTestExecutable.h -o debug/moc_GTestExecutable.cpp

debug/moc_GTestRunner.cpp: include/GTestExecutable.h \
+ include/GTestExecutableResults.h \
+ include/Defines.h \
+ include/GTestSuiteResults.h \
+ include/GTestResults.h \
include/GTestSuite.h \
include/GTest.h \
+ include/TestTreeWidget.h \
+ include/TestTreeWidgetItem.h \
include/GTestRunner.h
/usr/local/Trolltech/Qt-4.6.2/bin/moc $(DEFINES) $(INCPATH)
include/GTestRunner.h -o debug/moc_GTestRunner.cpp

@@ -186,12 +215,15 @@

####### Compile

+debug/TestTreeWidgetItem.o: src/TestTreeWidgetItem.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/TestTreeWidgetItem.o
src/TestTreeWidgetItem.cpp
+
+debug/TestTreeWidget.o: src/TestTreeWidget.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/TestTreeWidget.o
src/TestTreeWidget.cpp
+
debug/GTestResults.o: src/GTestResults.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/GTestResults.o
src/GTestResults.cpp

-debug/GTestCollectionResults.o: src/GTestCollectionResults.cpp
- $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/GTestCollectionResults.o
src/GTestCollectionResults.cpp
-
debug/GTestSuiteResults.o: src/GTestSuiteResults.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/GTestSuiteResults.o
src/GTestSuiteResults.cpp

@@ -216,6 +248,12 @@
debug/GTestRunner.o: src/GTestRunner.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/GTestRunner.o
src/GTestRunner.cpp

+debug/moc_TestTreeWidgetItem.o: debug/moc_TestTreeWidgetItem.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/moc_TestTreeWidgetItem.o
debug/moc_TestTreeWidgetItem.cpp
+
+debug/moc_TestTreeWidget.o: debug/moc_TestTreeWidget.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/moc_TestTreeWidget.o
debug/moc_TestTreeWidget.cpp
+
debug/moc_GTestSuite.o: debug/moc_GTestSuite.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/moc_GTestSuite.o
debug/moc_GTestSuite.cpp

=======================================
--- /trunk/Makefile.Release Tue Jul 27 16:50:43 2010
+++ /trunk/Makefile.Release Sat Aug 7 11:11:45 2010
@@ -1,6 +1,6 @@

#############################################################################
# Makefile for building: GTestRunner
-# Generated by qmake (2.01a) (Qt 4.6.2) on: Tue Jul 27 20:05:17 2010
+# Generated by qmake (2.01a) (Qt 4.6.2) on: Sat Aug 7 14:42:20 2010
# Project: GTestRunner.pro
# Template: app

#############################################################################
@@ -42,8 +42,9 @@

####### Files

-SOURCES = src/GTestResults.cpp \
- src/GTestCollectionResults.cpp \
+SOURCES = src/TestTreeWidgetItem.cpp \
+ src/TestTreeWidget.cpp \
+ src/GTestResults.cpp \
src/GTestSuiteResults.cpp \
src/GTestSuite.cpp \
src/GTestExecutableResults.cpp \
@@ -51,12 +52,15 @@
src/GTestExecutable.cpp \
main.cpp \
src/GTestParser.cpp \
- src/GTestRunner.cpp release/moc_GTestSuite.cpp \
+ src/GTestRunner.cpp release/moc_TestTreeWidgetItem.cpp \
+ release/moc_TestTreeWidget.cpp \
+ release/moc_GTestSuite.cpp \
release/moc_GTest.cpp \
release/moc_GTestExecutable.cpp \
release/moc_GTestRunner.cpp
-OBJECTS = release/GTestResults.o \
- release/GTestCollectionResults.o \
+OBJECTS = release/TestTreeWidgetItem.o \
+ release/TestTreeWidget.o \
+ release/GTestResults.o \
release/GTestSuiteResults.o \
release/GTestSuite.o \
release/GTestExecutableResults.o \
@@ -65,6 +69,8 @@
release/main.o \
release/GTestParser.o \
release/GTestRunner.o \
+ release/moc_TestTreeWidgetItem.o \
+ release/moc_TestTreeWidget.o \
release/moc_GTestSuite.o \
release/moc_GTest.o \
release/moc_GTestExecutable.o \
@@ -127,7 +133,7 @@

dist:
@$(CHK_DIR_EXISTS) release/GTestRunner1.0.0 || $(MKDIR)
release/GTestRunner1.0.0
- $(COPY_FILE) --parents $(SOURCES) $(DIST) release/GTestRunner1.0.0/ &&
$(COPY_FILE) --parents include/GTestCollectionResults.h
include/GTestSuiteResults.h include/GTestResults.h include/GTestSuite.h
include/Defines.h include/GTestExecutableResults.h include/GTest.h
include/GTestExecutable.h include/GTestParser.h include/GTestRunner.h
release/GTestRunner1.0.0/ && $(COPY_FILE) --parents src/GTestResults.cpp
src/GTestCollectionResults.cpp src/GTestSuiteResults.cpp src/GTestSuite.cpp
src/GTestExecutableResults.cpp src/GTest.cpp src/GTestExecutable.cpp
main.cpp src/GTestParser.cpp src/GTestRunner.cpp release/GTestRunner1.0.0/
&& (cd `dirname release/GTestRunner1.0.0` && $(TAR) GTestRunner1.0.0.tar
GTestRunner1.0.0 && $(COMPRESS) GTestRunner1.0.0.tar) && $(MOVE) `dirname
release/GTestRunner1.0.0`/GTestRunner1.0.0.tar.gz . && $(DEL_FILE) -r
release/GTestRunner1.0.0
+ $(COPY_FILE) --parents $(SOURCES) $(DIST) release/GTestRunner1.0.0/ &&
$(COPY_FILE) --parents include/TestTreeWidgetItem.h
include/TestTreeWidget.h include/GTestResultsItem.h
include/GTestSuiteResults.h include/GTestResults.h include/GTestSuite.h
include/Defines.h include/GTestExecutableResults.h include/GTest.h
include/GTestExecutable.h include/GTestParser.h include/GTestRunner.h
release/GTestRunner1.0.0/ && $(COPY_FILE) --parents
src/TestTreeWidgetItem.cpp src/TestTreeWidget.cpp src/GTestResults.cpp
src/GTestSuiteResults.cpp src/GTestSuite.cpp src/GTestExecutableResults.cpp
src/GTest.cpp src/GTestExecutable.cpp main.cpp src/GTestParser.cpp
src/GTestRunner.cpp release/GTestRunner1.0.0/ && (cd `dirname
release/GTestRunner1.0.0` && $(TAR) GTestRunner1.0.0.tar GTestRunner1.0.0
&& $(COMPRESS) GTestRunner1.0.0.tar) && $(MOVE) `dirname
release/GTestRunner1.0.0`/GTestRunner1.0.0.tar.gz . && $(DEL_FILE) -r
release/GTestRunner1.0.0


clean:compiler_clean
@@ -146,24 +152,47 @@

mocables: compiler_moc_header_make_all compiler_moc_source_make_all

-compiler_moc_header_make_all: release/moc_GTestSuite.cpp
release/moc_GTest.cpp release/moc_GTestExecutable.cpp
release/moc_GTestRunner.cpp
+compiler_moc_header_make_all: release/moc_TestTreeWidgetItem.cpp
release/moc_TestTreeWidget.cpp release/moc_GTestSuite.cpp
release/moc_GTest.cpp release/moc_GTestExecutable.cpp
release/moc_GTestRunner.cpp
compiler_moc_header_clean:
- -$(DEL_FILE) release/moc_GTestSuite.cpp release/moc_GTest.cpp
release/moc_GTestExecutable.cpp release/moc_GTestRunner.cpp
+ -$(DEL_FILE) release/moc_TestTreeWidgetItem.cpp
release/moc_TestTreeWidget.cpp release/moc_GTestSuite.cpp
release/moc_GTest.cpp release/moc_GTestExecutable.cpp
release/moc_GTestRunner.cpp
+release/moc_TestTreeWidgetItem.cpp: include/GTestResults.h \
+ include/TestTreeWidgetItem.h
+ /usr/local/Trolltech/Qt-4.6.2/bin/moc $(DEFINES) $(INCPATH)
include/TestTreeWidgetItem.h -o release/moc_TestTreeWidgetItem.cpp
+
+release/moc_TestTreeWidget.cpp: include/GTest.h \
+ include/GTestResults.h \
+ include/TestTreeWidgetItem.h \
+ include/TestTreeWidget.h
+ /usr/local/Trolltech/Qt-4.6.2/bin/moc $(DEFINES) $(INCPATH)
include/TestTreeWidget.h -o release/moc_TestTreeWidget.cpp
+
release/moc_GTestSuite.cpp: include/GTest.h \
+ include/GTestResults.h \
+ include/GTestSuiteResults.h \
include/GTestSuite.h
/usr/local/Trolltech/Qt-4.6.2/bin/moc $(DEFINES) $(INCPATH)
include/GTestSuite.h -o release/moc_GTestSuite.cpp

-release/moc_GTest.cpp: include/GTest.h
+release/moc_GTest.cpp: include/GTestResults.h \
+ include/GTest.h
/usr/local/Trolltech/Qt-4.6.2/bin/moc $(DEFINES) $(INCPATH)
include/GTest.h -o release/moc_GTest.cpp

-release/moc_GTestExecutable.cpp: include/GTestSuite.h \
+release/moc_GTestExecutable.cpp: include/GTestExecutableResults.h \
+ include/Defines.h \
+ include/GTestSuiteResults.h \
+ include/GTestResults.h \
+ include/GTestSuite.h \
include/GTest.h \
include/GTestExecutable.h
/usr/local/Trolltech/Qt-4.6.2/bin/moc $(DEFINES) $(INCPATH)
include/GTestExecutable.h -o release/moc_GTestExecutable.cpp

release/moc_GTestRunner.cpp: include/GTestExecutable.h \
+ include/GTestExecutableResults.h \
+ include/Defines.h \
+ include/GTestSuiteResults.h \
+ include/GTestResults.h \
include/GTestSuite.h \
include/GTest.h \
+ include/TestTreeWidget.h \
+ include/TestTreeWidgetItem.h \
include/GTestRunner.h
/usr/local/Trolltech/Qt-4.6.2/bin/moc $(DEFINES) $(INCPATH)
include/GTestRunner.h -o release/moc_GTestRunner.cpp

@@ -186,12 +215,15 @@

####### Compile

+release/TestTreeWidgetItem.o: src/TestTreeWidgetItem.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/TestTreeWidgetItem.o
src/TestTreeWidgetItem.cpp
+
+release/TestTreeWidget.o: src/TestTreeWidget.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/TestTreeWidget.o
src/TestTreeWidget.cpp
+
release/GTestResults.o: src/GTestResults.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/GTestResults.o
src/GTestResults.cpp

-release/GTestCollectionResults.o: src/GTestCollectionResults.cpp
- $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/GTestCollectionResults.o
src/GTestCollectionResults.cpp
-
release/GTestSuiteResults.o: src/GTestSuiteResults.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/GTestSuiteResults.o
src/GTestSuiteResults.cpp

@@ -216,6 +248,12 @@
release/GTestRunner.o: src/GTestRunner.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/GTestRunner.o
src/GTestRunner.cpp

+release/moc_TestTreeWidgetItem.o: release/moc_TestTreeWidgetItem.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/moc_TestTreeWidgetItem.o
release/moc_TestTreeWidgetItem.cpp
+
+release/moc_TestTreeWidget.o: release/moc_TestTreeWidget.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/moc_TestTreeWidget.o
release/moc_TestTreeWidget.cpp
+
release/moc_GTestSuite.o: release/moc_GTestSuite.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/moc_GTestSuite.o
release/moc_GTestSuite.cpp

=======================================
--- /trunk/include/GTest.h Thu Jul 29 17:53:34 2010
+++ /trunk/include/GTest.h Sat Aug 7 11:11:45 2010
@@ -27,21 +27,23 @@

Q_OBJECT

-public:
+protected:
+ QString name;
GTestResults* testResults;

-private:
- QString name;
-
signals:
- void requestingRun(QString testName);
+ void requestingRun(QString testName, QString caseName = QString());
void testResultsReady();

public:
- GTest(QString name);
- void run();
+ GTest(QObject* parent = 0, QString name = QString());
+ GTest(const GTest& other);
+ virtual ~GTest();
QString getName() const;
- void receiveTestResults(GTestResults* testResults);
+ const GTestResults* getTestResults() const;
+
+ virtual void receiveTestResults(GTestResults* testResults);
+ virtual void run();

};

@@ -50,5 +52,7 @@
inline void GTest::run() { emit requestingRun(name); }

inline QString GTest::getName() const { return name; }
+
+inline const GTestResults* GTest::getTestResults() const { return
testResults; }

#endif /* GTEST_H_ */
=======================================
--- /trunk/include/GTestExecutable.h Thu Jul 29 17:53:34 2010
+++ /trunk/include/GTestExecutable.h Sat Aug 7 11:11:45 2010
@@ -26,7 +26,7 @@
#include "GTestExecutableResults.h"
#include "GTestSuite.h"

-class GTestExecutable : public QObject {
+class GTestExecutable : public GTestSuite {

Q_OBJECT

@@ -38,18 +38,15 @@
};

private:
- QString filePath;
STATE state;
QMutex processLock;
- QProcess *gtest;
QMutex outputLock;
+ QProcess *gtest;
QBuffer standardOutput;
QBuffer standardError;
QStringList listing;
- QList<GTestSuite*> runList;
QStringList testsToRun;
bool runOnSignal;
- GTestExecutableResults* testResults;

QProcess::ProcessError error;
QProcess::ExitStatus exitStatus;
@@ -60,7 +57,6 @@

signals:
void listingReady(GTestExecutable* sender);
- void testResultsReady(GTestExecutable* sender);

public slots:
void standardErrorAvailable();
@@ -69,13 +65,13 @@
void runTest();
void parseListing(int exitCode, QProcess::ExitStatus exitStatus);
void parseTestResults(int exitCode, QProcess::ExitStatus exitStatus);
- void receiveRunRequest(QString testCase, QString testName);
+ void resetRunState();

public:

GTestExecutable(QObject* parent = 0, QString executablePath = QString());
GTestExecutable(const GTestExecutable& other);
- ~GTestExecutable();
+ virtual ~GTestExecutable();

//GETS:
QProcess::ProcessError getError() const;
@@ -91,8 +87,6 @@

//METHODS:
void produceListing();
- void addTestSuite(GTestSuite* testCase);
- void removeTestSuite(GTestSuite* testCase);

};

@@ -100,7 +94,7 @@

inline QStringList GTestExecutable::getListing() const { return listing; }

-inline QString GTestExecutable::getExecutablePath() const { return
filePath; }
+inline QString GTestExecutable::getExecutablePath() const { return name; }

inline QProcess::ProcessError GTestExecutable::getError() const { return
error; }

@@ -108,18 +102,10 @@

inline int GTestExecutable::getExitCode() const { return exitCode; }

-inline void GTestExecutable::setExecutablePath(QString executablePath) {
this->filePath = executablePath; }
+inline void GTestExecutable::setExecutablePath(QString executablePath) {
this->name = executablePath; }

inline void GTestExecutable::setRunFlag(bool runOnSignal) {
this->runOnSignal = runOnSignal; }

-inline void GTestExecutable::addTestSuite(GTestSuite* testCase) {
- QObject::connect(testCase, SIGNAL(requestingRun(QString, QString)),
- this, SLOT(receiveRunRequest(QString, QString)));
-}
-
-inline void GTestExecutable::removeTestSuite(GTestSuite* testCase) {
- QObject::disconnect(testCase, SIGNAL(requestingRun(QString, QString)),
- this, SLOT(receiveRunRequest(QString, QString)));
-}
+inline void GTestExecutable::resetRunState() { setRunFlag(false); }

#endif /* GTESTEXECUTABLE_H_ */
=======================================
--- /trunk/include/GTestExecutableResults.h Thu Jul 29 17:53:34 2010
+++ /trunk/include/GTestExecutableResults.h Sat Aug 7 11:11:45 2010
@@ -17,31 +17,19 @@
#ifndef GTESTEXECUTABLERESULTS_H_
#define GTESTEXECUTABLERESULTS_H_

+
#include <QHash>
#include <QString>

#include "Defines.h"
-#include "GTestCollectionResults.h"
#include "GTestSuiteResults.h"

-class GTestExecutableResults : public GTestCollectionResults {
-
-private:
- QHash<QString, GTestSuiteResults*> suiteResultsHash;
+class GTestExecutableResults : public GTestSuiteResults {

public:
GTestExecutableResults(QString name);
- void addTestSuiteResults(GTestSuiteResults* testSuiteResults);
- GTestSuiteResults* getTestSuiteResults(QString testSuiteName);
+ virtual ~GTestExecutableResults();

};

-inline void GTestExecutableResults::addTestSuiteResults(GTestSuiteResults*
testSuiteResults) {
- suiteResultsHash.insert(testSuiteResults->getTestName(),
testSuiteResults);
-}
-
-inline GTestSuiteResults*
GTestExecutableResults::getTestSuiteResults(QString testSuiteName) {
- return suiteResultsHash.value(testSuiteName);
-}
-
#endif /* GTESTEXECUTABLERESULTS_H_ */
=======================================
--- /trunk/include/GTestResults.h Thu Jul 29 17:53:34 2010
+++ /trunk/include/GTestResults.h Sat Aug 7 11:11:45 2010
@@ -27,7 +27,12 @@
UNDEFINED
};

-private:
+ enum OUTCOME {
+ PASSED,
+ FAILED
+ };
+
+protected:
QString name;
uint time;
QStringList failureMessages;
@@ -35,16 +40,21 @@

public:
GTestResults(QString name);
+ virtual ~GTestResults();
+
void setStatus(QString status);
void setRunningTime(uint runTime);
void addFailureMessage(QString failureMsg);
+
STATUS getStatus() const;
QString getName() const;
uint getRunningTime() const;
- uint getFailureMessageCount() const;
+ virtual uint getFailureCount() const;
QString getFailureMessage(uint num) const;
QStringList getFailureMessages() const;

+ virtual GTestResults* getTestResults(QString name);
+
};

inline void GTestResults::setStatus(QString statusString) {
@@ -70,7 +80,7 @@
return time;
}

-inline uint GTestResults::getFailureMessageCount() const {
+inline uint GTestResults::getFailureCount() const {
return failureMessages.size();
}

@@ -81,5 +91,7 @@
inline QStringList GTestResults::getFailureMessages() const {
return failureMessages;
}
+
+inline GTestResults* GTestResults::getTestResults(QString name) { return
(name == this->name ? this : 0); }

#endif /* GTESTRESULTS_H_ */
=======================================
--- /trunk/include/GTestRunner.h Thu Jul 29 17:53:34 2010
+++ /trunk/include/GTestRunner.h Sat Aug 7 11:11:45 2010
@@ -31,6 +31,7 @@
#include <QTreeWidget>

#include "GTestExecutable.h"
+#include "TestTreeWidget.h"

class GTestRunner : public QMainWindow
{
@@ -48,11 +49,8 @@
void addTests();
void updateAllListings();
void runTests();
-
void updateListing(GTestExecutable* gtest);
-
- void fillTestResults(GTestExecutable* gtest);
-
+ void setTestResult(GTest* gtest);
void treeItemClicked(QTreeWidgetItem* item, int column);

private:
@@ -63,7 +61,7 @@

QWidget centralWidget;
QToolBar testTreeTools;
- QTreeWidget testTree;
+ TestTreeWidget testTree;

QList<GTestExecutable*> gtestList;

=======================================
--- /trunk/include/GTestSuite.h Thu Jul 29 17:53:34 2010
+++ /trunk/include/GTestSuite.h Sat Aug 7 11:11:45 2010
@@ -24,31 +24,25 @@
#include "GTest.h"
#include "GTestSuiteResults.h"

-class GTestSuite : public QObject {
+class GTestSuite : public GTest {

Q_OBJECT

-private:
- QString name;
+protected:
QList<GTest*> runList;
- GTestSuiteResults* testSuiteResults;
-
-signals:
- void requestingRun(QString caseName, QString testName);
- void testResultsReady();

public slots:
- void receiveRunRequest(QString testName);
+ virtual void receiveRunRequest(QString testName, QString testCase =
QString());

public:
- GTestSuite(QString name);
+ GTestSuite(QObject* parent = 0, QString name = QString());
+ GTestSuite(const GTestSuite& other);
+ virtual ~GTestSuite();
void addTest(GTest* test);
void removeTest(GTest* test);
- void run();
- QString getName() const;
- void receiveTestResults(GTestSuiteResults* testResults);
- GTest* getTestResults(QString testName);
-
+ virtual void receiveTestResults(GTestResults* testSuiteResults);
+
+ virtual void run();
};

Q_DECLARE_METATYPE(GTestSuite*);
@@ -63,6 +57,5 @@
this, SLOT(receiveRunRequest(QString)));
}

-inline QString GTestSuite::getName() const { return name; }

#endif /* GTESTFIXTURE_H_ */
=======================================
--- /trunk/include/GTestSuiteResults.h Thu Jul 29 17:53:34 2010
+++ /trunk/include/GTestSuiteResults.h Sat Aug 7 11:11:45 2010
@@ -20,27 +20,49 @@
#include <QHash>
#include <QString>

-#include "GTestCollectionResults.h"
#include "GTestResults.h"

-class GTestSuiteResults : public GTestCollectionResults {
-
-private:
+class GTestSuiteResults : public GTestResults {
+
+protected:
QHash<QString, GTestResults*> testResultsHash;
+ uint errorCount;
+ uint failureCount;
+ uint runCount;

public:
GTestSuiteResults(QString name);
+ virtual ~GTestSuiteResults();
+
void addTestResults(GTestResults* testResults);
- GTestResults* getTestResults(QString testName);
-
+ void setErrorCount(uint errorCount);
+ void setFailureCount(uint failureCount);
+ void setRunCount(uint runCount);
+
+ GTestResults* getTestResults(QString testName);
+ uint getErrorCount() const;
+ virtual uint getFailureCount() const;
+ uint getRunCount() const;
};

inline void GTestSuiteResults::addTestResults(GTestResults* testResults) {
testResultsHash.insert(testResults->getName(), testResults);
}
+
+inline void GTestSuiteResults::setErrorCount(uint errorCount) {
this->errorCount = errorCount; }
+
+inline void GTestSuiteResults::setFailureCount(uint failureCount) {
this->failureCount = failureCount; }
+
+inline void GTestSuiteResults::setRunCount(uint runCount) { this->runCount
= runCount; }

inline GTestResults* GTestSuiteResults::getTestResults(QString testName) {
return testResultsHash.value(testName);
}
+
+inline uint GTestSuiteResults::getErrorCount() const { return errorCount; }
+
+inline uint GTestSuiteResults::getFailureCount() const { return
failureCount; }
+
+inline uint GTestSuiteResults::getRunCount() const { return runCount; }

#endif /* GTESTSUITERESULTS_H_ */
=======================================
--- /trunk/src/GTest.cpp Thu Jul 29 17:53:34 2010
+++ /trunk/src/GTest.cpp Sat Aug 7 11:11:45 2010
@@ -16,9 +16,13 @@

#include "GTest.h"

-GTest::GTest(QString name)
-: name(name), testResults(0)
+GTest::GTest(QObject* parent, QString name)
+: QObject(parent), name(name)
{}
+
+GTest::~GTest() {
+
+}

void GTest::receiveTestResults(GTestResults* testResults) {
this->testResults = testResults;
=======================================
--- /trunk/src/GTestExecutable.cpp Thu Jul 29 17:53:34 2010
+++ /trunk/src/GTestExecutable.cpp Sat Aug 7 11:11:45 2010
@@ -22,16 +22,17 @@
#include <QMessageBox>

GTestExecutable::GTestExecutable(QObject* parent, QString filePath)
-: QObject(parent), filePath(filePath), state(VALID), processLock(),
- gtest(0), outputLock(), standardOutput(), standardError(),
runOnSignal(false)
+: GTestSuite(parent, filePath), state(VALID), processLock(),
+ outputLock(), gtest(0), standardOutput(), standardError(),
+ listing(), testsToRun(), runOnSignal(false)
{
getState();
}

GTestExecutable::GTestExecutable(const GTestExecutable& other)
-: QObject(other.parent()),filePath(other.filePath), state(other.state),
- processLock(), gtest(0), outputLock(), standardOutput(),
- standardError()
+: GTestSuite(other.parent(), other.name), state(other.state),
+ processLock(), outputLock(), gtest(0), standardOutput(),
+ standardError(), listing(), testsToRun(), runOnSignal(false)
{
getState();
}
@@ -52,7 +53,7 @@
this, SLOT(executableFinished(int, QProcess::ExitStatus)));
QObject::connect(gtest, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(parseListing(int, QProcess::ExitStatus)));
- gtest->start(filePath, QStringList() << "--gtest_list_tests");
+ gtest->start(name, QStringList() << "--gtest_list_tests");
//unlock the processLock in the parseListing slot
}

@@ -85,7 +86,7 @@
this, SLOT(standardOutputAvailable()));
QObject::connect(gtest, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(parseTestResults(int, QProcess::ExitStatus)));
- gtest->start(filePath, QStringList()
<< "--gtest_output=xml:./test_detail_1337.xml");
+ gtest->start(name, QStringList()
<< "--gtest_output=xml:./test_detail_1337.xml");
//unlock the processLock in the parseTestResults slot
}

@@ -97,17 +98,18 @@
return;
QFile xmlFile("./test_detail_1337.xml");
GTestParser parser(&xmlFile);
- testResults = parser.parse();
- QList<GTestSuite*>::iterator it = runList.begin();
- GTestSuiteResults* testSuiteResults;
- while(it != runList.end()) {
- testSuiteResults = testResults->getTestSuiteResults((*it)->getName());
+ GTestExecutableResults* testResults = parser.parse();
+ this->testResults = testResults;
+ QList<GTest*>::iterator it = this->runList.begin();
+ GTestResults* testSuiteResults;
+ while(it != this->runList.end()) {
+ testSuiteResults = testResults->getTestResults((*it)->getName());
(*it)->receiveTestResults(testSuiteResults);
++it;
}
runList.clear();
executableFinished(exitCode, exitStatus);
- emit testResultsReady(this);
+ emit testResultsReady();
}

void GTestExecutable::standardOutputAvailable() {
@@ -167,7 +169,7 @@

GTestExecutable::STATE GTestExecutable::getState() {
state = VALID;
- QFile file(filePath);
+ QFile file(name);
if(!file.exists()) {
state = FILE_NOT_FOUND;
}
@@ -177,8 +179,4 @@
return state;
}

-void GTestExecutable::receiveRunRequest(QString caseName, QString
testName) {
- runList.append((GTestSuite*)QObject::sender());
- testsToRun << caseName.append(".").append(testName);
-}
-
+
=======================================
--- /trunk/src/GTestExecutableResults.cpp Thu Jul 29 17:53:34 2010
+++ /trunk/src/GTestExecutableResults.cpp Sat Aug 7 11:11:45 2010
@@ -17,10 +17,12 @@
#include "GTestExecutableResults.h"

GTestExecutableResults::GTestExecutableResults(QString name)
-: GTestCollectionResults(name), suiteResultsHash()
+: GTestSuiteResults(name)
{}

-
+GTestExecutableResults::~GTestExecutableResults() {
+
+}

=======================================
--- /trunk/src/GTestParser.cpp Thu Jul 29 17:53:34 2010
+++ /trunk/src/GTestParser.cpp Sat Aug 7 11:11:45 2010
@@ -52,18 +52,18 @@
}
else if(xmlStream.name() == "testsuite") {
testSuiteResults = new
GTestSuiteResults(attributes.value("name").toString());
-
testSuiteResults->setTestRunCount(attributes.value("tests").toString().toUInt());
-
testSuiteResults->setTestFailureCount(attributes.value("failures").toString().toUInt());
-
testSuiteResults->setTestErrorCount(attributes.value("errors").toString().toUInt());
-
testSuiteResults->setTestTotalTime(attributes.value("time").toString().toUInt());
- testExeResults->addTestSuiteResults(testSuiteResults);
+
testSuiteResults->setRunCount(attributes.value("tests").toString().toUInt());
+
testSuiteResults->setFailureCount(attributes.value("failures").toString().toUInt());
+
testSuiteResults->setErrorCount(attributes.value("errors").toString().toUInt());
+
testSuiteResults->setRunningTime(attributes.value("time").toString().toUInt());
+ testExeResults->addTestResults(testSuiteResults);
}
else if(xmlStream.name() == "testsuites") {
testExeResults = new
GTestExecutableResults(attributes.value("name").toString());
-
testExeResults->setTestRunCount(attributes.value("tests").toString().toUInt());
-
testExeResults->setTestFailureCount(attributes.value("failures").toString().toUInt());
-
testExeResults->setTestErrorCount(attributes.value("errors").toString().toUInt());
-
testExeResults->setTestTotalTime(attributes.value("time").toString().toUInt());
+
testExeResults->setRunCount(attributes.value("tests").toString().toUInt());
+
testExeResults->setFailureCount(attributes.value("failures").toString().toUInt());
+
testExeResults->setErrorCount(attributes.value("errors").toString().toUInt());
+
testExeResults->setRunningTime(attributes.value("time").toString().toUInt());
}
if(xmlStream.hasError()) {
qDebug() << xmlStream.errorString();
=======================================
--- /trunk/src/GTestResults.cpp Thu Jul 29 17:53:34 2010
+++ /trunk/src/GTestResults.cpp Sat Aug 7 11:11:45 2010
@@ -19,3 +19,9 @@
GTestResults::GTestResults(QString name)
: name(name), time(-1), failureMessages(), status(UNDEFINED)
{}
+
+GTestResults::~GTestResults() {
+
+}
+
+
=======================================
--- /trunk/src/GTestRunner.cpp Thu Jul 29 17:53:34 2010
+++ /trunk/src/GTestRunner.cpp Sat Aug 7 11:11:45 2010
@@ -15,12 +15,14 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * */

#include "GTestRunner.h"
+#include "TestTreeWidgetItem.h"

#include <QAction>
#include <QDebug>
#include <QFileDialog>
#include <QGroupBox>
#include <QMessageBox>
+#include <QSignalMapper>
#include <QTreeWidgetItem>
#include <QTreeWidgetItemIterator>
#include <QVBoxLayout>
@@ -199,19 +201,24 @@
qDebug() << "Retrieved listing. Size ="<<testList.size();
QStringList::iterator it = testList.begin();

- QTreeWidgetItem* testContainer = new
QTreeWidgetItem(&testTree,QStringList() << exePath);
+
+ TestTreeWidgetItem* testContainer = new
TestTreeWidgetItem(&testTree,QStringList() << exePath);
testContainer->setFlags(Qt::ItemIsTristate | Qt::ItemIsSelectable |
Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
testContainer->setCheckState(0, Qt::Checked);
QVariant var;
var.setValue<GTestExecutable*>(gtest);
testContainer->setData(0,Qt::UserRole,var);
QObject::connect(this, SIGNAL(aboutToRunTests()),
- gtest, SLOT(setRunFlag(false)));
+ gtest, SLOT(resetRunState()));
QObject::connect(this, SIGNAL(runningTests()),
gtest, SLOT(runTest()));
-
- QTreeWidgetItem* topLevelItem = 0;
- QTreeWidgetItem* newItem = 0;
+ QSignalMapper* signalMap = new QSignalMapper(&testTree);
+ signalMap->setMapping(gtest, testContainer);
+ QObject::connect(gtest, SIGNAL(testResultsReady()),
+ signalMap, SLOT(map()));
+
+ TestTreeWidgetItem* topLevelItem = 0;
+ TestTreeWidgetItem* newItem = 0;
GTestSuite* suite = 0;
GTest* test = 0;
while(it != testList.end()) {
@@ -219,27 +226,37 @@
if(it->endsWith(".")) {
//drop the '.' and make it a data item
QString suiteName = it->left(it->size()-1);
- topLevelItem = new QTreeWidgetItem(testContainer,
QStringList()<<suiteName);
+ topLevelItem = new TestTreeWidgetItem(testContainer,
QStringList()<<suiteName);
topLevelItem->setFlags(Qt::ItemIsTristate | Qt::ItemIsSelectable |
Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
topLevelItem->setCheckState(0, Qt::Checked);
- suite = new GTestSuite(suiteName);
+ suite = new GTestSuite(gtest, suiteName);
var.setValue<GTestSuite*>(suite);
topLevelItem->setData(0,Qt::UserRole,var);
- gtest->addTestSuite(suite);
+ gtest->addTest(suite);
+
+ signalMap->setMapping(suite, topLevelItem);
+ QObject::connect(suite, SIGNAL(testResultsReady()),
+ signalMap, SLOT(map()));
}
else {
//drop the spaces and make it a data item
QString testName = it->right(it->size()-2);
- newItem = new QTreeWidgetItem(topLevelItem, QStringList()<<testName);
+ newItem = new TestTreeWidgetItem(topLevelItem, QStringList()<<testName);
newItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable |
Qt::ItemIsEnabled);
newItem->setCheckState(0,Qt::Checked);
- test = new GTest(testName);
+ test = new GTest(suite, testName);
var.setValue<GTest*>(test);
newItem->setData(0,Qt::UserRole,var);
suite->addTest(test);
+
+ signalMap->setMapping(test, newItem);
+ QObject::connect(test, SIGNAL(testResultsReady()),
+ signalMap, SLOT(map()));
}
++it;
}
+ QObject::connect(signalMap, SIGNAL(mapped(QObject*)),
+ &testTree, SLOT(populateTestResult(QObject*)));
}

void GTestRunner::updateAllListings() {
@@ -261,8 +278,8 @@
continue;
GTestExecutable* gtest =
topLevelItem->data(0,Qt::UserRole).value<GTestExecutable*>();
if(gtest != 0 && gtest->getState() == GTestExecutable::VALID) {
- QObject::connect(gtest, SIGNAL(testResultsReady(GTestExecutable*)),
- this, SLOT(fillTestResults(GTestExecutable*)));
+ //QObject::connect(gtest, SIGNAL(testResultsReady(GTest*)),
+ // this, SLOT(fillTestResults(GTestExecutable*)));
gtest->setRunFlag(true);
}
else
@@ -274,16 +291,7 @@

//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) {
-
+void GTestRunner::setTestResult(GTest* /*gtest*/) {
}

/*
@@ -294,7 +302,7 @@
* part checked, we know that we did not in fact click on the parent
* (and thus we can immediately return), so a part checked parent is fine.
*/
-void GTestRunner::treeItemClicked(QTreeWidgetItem* item, int column) {
+void GTestRunner::treeItemClicked(QTreeWidgetItem* item, int /*column*/) {
if(item->childCount() == 0 || item->parent() == 0)
return;
if(item->checkState(0) ==Qt::PartiallyChecked) {
=======================================
--- /trunk/src/GTestSuite.cpp Thu Jul 29 17:53:34 2010
+++ /trunk/src/GTestSuite.cpp Sat Aug 7 11:11:45 2010
@@ -17,17 +17,28 @@
#include "GTestSuite.h"
#include "GTestResults.h"

-GTestSuite::GTestSuite(QString name)
-: name(name), runList(), testSuiteResults(0)
+GTestSuite::GTestSuite(QObject* parent, QString name)
+: GTest(parent, name), runList()
{}

-void GTestSuite::receiveRunRequest(QString testName) {
- runList.append((GTest*)QObject::sender());
- emit requestingRun(name, testName);
+GTestSuite::GTestSuite(const GTestSuite& other)
+: GTest(other.parent(), other.name), runList()
+{}
+
+GTestSuite::~GTestSuite() {
+
}

-void GTestSuite::receiveTestResults(GTestSuiteResults* testSuiteResults) {
- this->testSuiteResults = testSuiteResults;
+void GTestSuite::receiveRunRequest(QString testName, QString testCase) {
+ GTest* test = static_cast<GTest*>(QObject::sender());
+ if(!runList.contains(test))
+ runList.append(test);
+ if(testCase.isEmpty())
+ emit requestingRun(name, testName);
+}
+
+void GTestSuite::receiveTestResults(GTestResults* testSuiteResults) {
+ this->testResults = testSuiteResults;
QList<GTest*>::iterator it = runList.begin();
GTestResults* testResults;
while(it != runList.end()) {
@@ -39,3 +50,7 @@
emit testResultsReady();
}

+void GTestSuite::run() {
+ //TODO::Run all tests in suite
+}
+
=======================================
--- /trunk/src/GTestSuiteResults.cpp Thu Jul 29 17:53:34 2010
+++ /trunk/src/GTestSuiteResults.cpp Sat Aug 7 11:11:45 2010
@@ -17,6 +17,12 @@
#include "GTestSuiteResults.h"

GTestSuiteResults::GTestSuiteResults(QString name)
-: GTestCollectionResults(name)
+: GTestResults(name)
{}

+GTestSuiteResults::~GTestSuiteResults() {
+
+}
+
+
+

Reply all
Reply to author
Forward
0 new messages