summaryrefslogtreecommitdiffstats
path: root/tdeunittest
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-26 13:17:59 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-26 13:17:59 -0600
commit1515a4f2eb9cf023ed7f9c2e10106b5e93164a08 (patch)
treed5617734090b254659ff331ce7d1e574c4807caf /tdeunittest
parentf8069e2ea048f2657cc417d83820576ec55c181b (diff)
downloadtdesdk-1515a4f2eb9cf023ed7f9c2e10106b5e93164a08.tar.gz
tdesdk-1515a4f2eb9cf023ed7f9c2e10106b5e93164a08.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdeunittest')
-rw-r--r--tdeunittest/CMakeLists.txt50
-rw-r--r--tdeunittest/Makefile.am21
-rw-r--r--tdeunittest/dcopinterface.h38
-rw-r--r--tdeunittest/example/Makefile.am1
-rw-r--r--tdeunittest/example/module/Makefile.am20
-rw-r--r--tdeunittest/example/module/sampleextra.cpp37
-rw-r--r--tdeunittest/example/module/sampleextra.h36
-rw-r--r--tdeunittest/example/module/samplemodule.cpp37
-rw-r--r--tdeunittest/example/module/samplemodule.h43
-rw-r--r--tdeunittest/example/module/samplemodule2.cpp61
-rw-r--r--tdeunittest/example/module/samplemodule2.h43
-rw-r--r--tdeunittest/example/module/sampletests.cpp82
-rw-r--r--tdeunittest/example/module/sampletests.h54
-rw-r--r--tdeunittest/example/simple/Makefile.am22
-rw-r--r--tdeunittest/example/simple/main.cpp32
-rw-r--r--tdeunittest/example/simple/maingui.cpp60
-rw-r--r--tdeunittest/example/simple/sampletest.cpp55
-rw-r--r--tdeunittest/example/simple/sampletest.h42
-rw-r--r--tdeunittest/guimodrunner.cpp72
-rw-r--r--tdeunittest/runnergui.cpp433
-rw-r--r--tdeunittest/runnergui.h79
-rwxr-xr-xtdeunittest/tdeunittest19
-rwxr-xr-xtdeunittest/tdeunittest_debughelper107
-rwxr-xr-xtdeunittest/tdeunittestmod37
-rw-r--r--tdeunittest/testerwidget.ui197
-rw-r--r--tdeunittest/testerwidget.ui.h46
26 files changed, 1724 insertions, 0 deletions
diff --git a/tdeunittest/CMakeLists.txt b/tdeunittest/CMakeLists.txt
new file mode 100644
index 00000000..2a4e1f5a
--- /dev/null
+++ b/tdeunittest/CMakeLists.txt
@@ -0,0 +1,50 @@
+#################################################
+#
+# (C) 2012 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### headers ###################################
+
+install( FILES
+ runnergui.h
+ DESTINATION ${INCLUDE_INSTALL_DIR}/tdeunittest )
+
+install( PROGRAMS
+ tdeunittest tdeunittestmod tdeunittest_debughelper
+ DESTINATION ${BIN_INSTALL_DIR} )
+
+
+##### tdeunittestgui (shared) #####################
+
+tde_add_library( tdeunittestgui SHARED AUTOMOC
+ SOURCES testerwidget.ui runnergui.cpp dcopinterface.skel
+ VERSION 0.0.0
+ LINK tdeunittest-shared
+ DESTINATION ${LIB_INSTALL_DIR}
+)
+
+
+##### tdeunittestguimodrunner (executable) ########
+
+tde_add_executable( tdeunittestguimodrunner
+ SOURCES guimodrunner.cpp
+ LINK tdeunittestgui-shared
+ DESTINATION ${BIN_INSTALL_DIR}
+)
diff --git a/tdeunittest/Makefile.am b/tdeunittest/Makefile.am
new file mode 100644
index 00000000..5393f517
--- /dev/null
+++ b/tdeunittest/Makefile.am
@@ -0,0 +1,21 @@
+SUBDIRS = example
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+
+lib_LTLIBRARIES = libtdeunittestgui.la
+libtdeunittestgui_la_SOURCES = testerwidget.ui runnergui.cpp dcopinterface.skel
+libtdeunittestgui_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -ltdeunittest
+libtdeunittestgui_la_LIBADD = -ltdeunittest $(LIB_TDECORE)
+
+runnergui.lo : testerwidget.h
+
+bin_PROGRAMS = tdeunittestguimodrunner
+tdeunittestguimodrunner_SOURCES = guimodrunner.cpp
+tdeunittestguimodrunner_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -ltdeunittest
+tdeunittestguimodrunner_LDADD = libtdeunittestgui.la $(LIB_TDECORE) $(LIB_KIO)
+
+noinst_HEADERS = dcopinterface.h
+libtdeunittestinclude_HEADERS = runnergui.h
+libtdeunittestincludedir = $(includedir)/tdeunittest
+
+bin_SCRIPTS = tdeunittest tdeunittestmod tdeunittest_debughelper
diff --git a/tdeunittest/dcopinterface.h b/tdeunittest/dcopinterface.h
new file mode 100644
index 00000000..50f15d3d
--- /dev/null
+++ b/tdeunittest/dcopinterface.h
@@ -0,0 +1,38 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jeroen Wijnhout *
+ * Jeroen.Wijnhout@kdemail.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#ifndef KUNITTEST_DCOPINTERFACE_H
+#define KUNITTEST_DCOPINTERFACE_H
+
+#include <dcopobject.h>
+#include <tqstring.h>
+
+namespace KUnitTest
+{
+ class DCOPInterface : public DCOPObject
+ {
+ K_DCOP
+
+ k_dcop:
+ virtual bool addDebugInfo(const TQString &name, const TQString &info) = 0;
+ virtual bool addSlotDebugInfo(const TQString &name, const TQString &slt, const TQString &info) = 0;
+ };
+}
+
+#endif
diff --git a/tdeunittest/example/Makefile.am b/tdeunittest/example/Makefile.am
new file mode 100644
index 00000000..d008ca22
--- /dev/null
+++ b/tdeunittest/example/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = simple module
diff --git a/tdeunittest/example/module/Makefile.am b/tdeunittest/example/module/Makefile.am
new file mode 100644
index 00000000..6d1b7961
--- /dev/null
+++ b/tdeunittest/example/module/Makefile.am
@@ -0,0 +1,20 @@
+INCLUDES = -I$(top_srcdir)/include $(all_includes)
+METASOURCES = AUTO
+
+noinst_HEADERS = samplemodule.h sampleextra.h sampletests.h
+
+check_LTLIBRARIES = tdeunittest_samplemodule.la tdeunittest_samplemodule2.la
+
+tdeunittest_samplemodule_la_SOURCES = samplemodule.cpp sampletests.cpp sampleextra.cpp
+tdeunittest_samplemodule_la_LIBADD = -ltdeunittest
+tdeunittest_samplemodule_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
+
+tdeunittest_samplemodule2_la_SOURCES = samplemodule2.cpp
+tdeunittest_samplemodule2_la_LIBADD = -ltdeunittest
+tdeunittest_samplemodule2_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
+
+check-local:
+ tdeunittestmodrunner
+
+guicheck:
+ $(srcdir)/../../tdeunittestmod $(PWD)
diff --git a/tdeunittest/example/module/sampleextra.cpp b/tdeunittest/example/module/sampleextra.cpp
new file mode 100644
index 00000000..e4574c09
--- /dev/null
+++ b/tdeunittest/example/module/sampleextra.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <kdebug.h>
+#include <tdeunittest/tester.h>
+
+#include "sampleextra.h"
+
+
+void SomeExtraTester::allTests()
+{
+ kdDebug() << "Debug output belonging to SomeExtraTester." << endl;
+
+ CHECK( TQString("Extra") , TQString("Extra") );
+}
diff --git a/tdeunittest/example/module/sampleextra.h b/tdeunittest/example/module/sampleextra.h
new file mode 100644
index 00000000..dbd19dc8
--- /dev/null
+++ b/tdeunittest/example/module/sampleextra.h
@@ -0,0 +1,36 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SAMPLEEXTRA_H_
+#define _SAMPLEEXTRA_H_
+
+#include <tdeunittest/tester.h>
+
+class SomeExtraTester : public KUnitTest::Tester
+{
+ void allTests();
+};
+
+#endif
diff --git a/tdeunittest/example/module/samplemodule.cpp b/tdeunittest/example/module/samplemodule.cpp
new file mode 100644
index 00000000..4ffadb6c
--- /dev/null
+++ b/tdeunittest/example/module/samplemodule.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <tdeunittest/runner.h>
+#include <tdeunittest/module.h>
+
+#include "sampletests.h"
+#include "sampleextra.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE( tdeunittest_samplemodule, "Suite1" )
+KUNITTEST_MODULE_REGISTER_TESTER( SlotSampleTester )
+KUNITTEST_MODULE_REGISTER_TESTER( SomeSampleTester )
+KUNITTEST_MODULE_REGISTER_TESTER( SomeExtraTester )
diff --git a/tdeunittest/example/module/samplemodule.h b/tdeunittest/example/module/samplemodule.h
new file mode 100644
index 00000000..953c0816
--- /dev/null
+++ b/tdeunittest/example/module/samplemodule.h
@@ -0,0 +1,43 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SAMPLETESTMODULE_H
+#define SAMPLETESTMODULE_H
+
+#include <tdeunittest/tester.h>
+
+class SimpleSampleTester : public KUnitTest::Tester
+{
+public:
+ void allTests();
+};
+
+class SomeSampleTester : public KUnitTest::Tester
+{
+public:
+ void allTests();
+};
+
+#endif
diff --git a/tdeunittest/example/module/samplemodule2.cpp b/tdeunittest/example/module/samplemodule2.cpp
new file mode 100644
index 00000000..1e08f102
--- /dev/null
+++ b/tdeunittest/example/module/samplemodule2.cpp
@@ -0,0 +1,61 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <tqstringlist.h>
+
+#include <kdebug.h>
+#include <tdeunittest/runner.h>
+#include <tdeunittest/module.h>
+
+#include "samplemodule.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE( tdeunittest_samplemodule2, "Suite2::Sub" )
+KUNITTEST_MODULE_REGISTER_TESTER( SimpleSampleTester )
+KUNITTEST_MODULE_REGISTER_TESTER( SomeSampleTester )
+
+void SimpleSampleTester::allTests()
+{
+ kdDebug() << "Debug output belonging to SimpleSampleTester." << endl;
+ CHECK( TQString("SimpleSample") , TQString("SimpleSample") );
+
+ // operator == is used, so this can't work...
+ //XFAIL( "SimpleSample" , "SampleSimple" );
+
+ kdDebug() << "Do some math." << endl;
+ //XFAIL( 2*2 , 4 ); // to test unexpected passes
+ SKIP("Just curious how this 'skipping' works.");
+}
+
+void SomeSampleTester::allTests()
+{
+ kdDebug() << "Checking operator precedences." << endl;
+ CHECK( 2.0 * 3.0 / 2.0 * 4.0 / 2.0 , 6.0 );
+
+ TQStringList testList;
+ testList << "one" << "two";
+ CHECK( testList.count() , (TQStringList::size_type) 2 );
+}
diff --git a/tdeunittest/example/module/samplemodule2.h b/tdeunittest/example/module/samplemodule2.h
new file mode 100644
index 00000000..953c0816
--- /dev/null
+++ b/tdeunittest/example/module/samplemodule2.h
@@ -0,0 +1,43 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SAMPLETESTMODULE_H
+#define SAMPLETESTMODULE_H
+
+#include <tdeunittest/tester.h>
+
+class SimpleSampleTester : public KUnitTest::Tester
+{
+public:
+ void allTests();
+};
+
+class SomeSampleTester : public KUnitTest::Tester
+{
+public:
+ void allTests();
+};
+
+#endif
diff --git a/tdeunittest/example/module/sampletests.cpp b/tdeunittest/example/module/sampletests.cpp
new file mode 100644
index 00000000..4a38642d
--- /dev/null
+++ b/tdeunittest/example/module/sampletests.cpp
@@ -0,0 +1,82 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <tqstringlist.h>
+
+#include <kdebug.h>
+#include <tdeunittest/runner.h>
+#include <tdeunittest/module.h>
+
+#include "sampletests.h"
+#include "sampleextra.h"
+
+void SlotSampleTester::setUp()
+{
+ kdDebug() << "setUp" << endl;
+ m_str = new TQString("setUp str");
+}
+
+void SlotSampleTester::tearDown()
+{
+ kdDebug() << "tearDown" << endl;
+ delete m_str;
+}
+
+bool SlotSampleTester::test()
+{
+ kdDebug() << "SlotSampleTester::test()" << endl;
+ return true;
+}
+
+void SlotSampleTester::testSlot()
+{
+ kdDebug() << "Debug output belonging to SlotSampleTester slot 1." << endl;
+ CHECK( test() , true);
+ CHECK( "test" , "test");
+ kdDebug() << "Checking if m_str is initialized correctly." << endl;
+ CHECK( *m_str , TQString("setUp str") );
+}
+
+void SlotSampleTester::testSlot2()
+{
+ kdDebug() << "Debug output belonging to SlotSampleTester slot 2." << endl;
+ CHECK("testSlot2","testSlot2");
+ CHECK(1,1);
+ CHECK(2,2);
+}
+
+void SomeSampleTester::allTests()
+{
+ kdDebug() << "Checking operator precedences." << endl;
+ CHECK( 2.0 * 3.0 / 2.0 * 4.0 / 2.0 , 6.0 );
+
+ TQStringList testList;
+ testList << "one" << "two";
+ CHECK( testList.count() , (TQStringList::size_type) 2 );
+ CHECK( testList.count()*2 , (TQStringList::size_type) 4 );
+}
+
+#include "sampletests.moc"
+
diff --git a/tdeunittest/example/module/sampletests.h b/tdeunittest/example/module/sampletests.h
new file mode 100644
index 00000000..1f032f92
--- /dev/null
+++ b/tdeunittest/example/module/sampletests.h
@@ -0,0 +1,54 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SAMPLETESTMODULE_H
+#define SAMPLETESTMODULE_H
+
+#include <tdeunittest/tester.h>
+
+class SlotSampleTester : public KUnitTest::SlotTester
+{
+ Q_OBJECT
+
+
+public slots:
+ void setUp();
+ void tearDown();
+ void testSlot();
+ void testSlot2();
+
+private:
+ bool test();
+
+ TQString *m_str;
+};
+
+class SomeSampleTester : public KUnitTest::Tester
+{
+public:
+ void allTests();
+};
+
+#endif
diff --git a/tdeunittest/example/simple/Makefile.am b/tdeunittest/example/simple/Makefile.am
new file mode 100644
index 00000000..0ee63452
--- /dev/null
+++ b/tdeunittest/example/simple/Makefile.am
@@ -0,0 +1,22 @@
+INCLUDES = -I$(top_srcdir) $(all_includes)
+METASOURCES = AUTO
+
+check_PROGRAMS = sampletests sampletestsgui
+
+sampletests_SOURCES = main.cpp sampletest.cpp
+sampletests_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor
+sampletests_LDADD = -ltdeunittest
+
+sampletestsgui_SOURCES = maingui.cpp sampletest.cpp
+sampletestsgui_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor
+# Normally you would write -ltdeunittestgui here, but since the examples
+# are bundled with the library source code itself we don't want to
+# have you install the libraries before you can compile the examples.
+sampletestsgui_LDADD = ../../libtdeunittestgui.la
+
+noinst_HEADERS = sampletest.h
+
+TESTS = sampletests
+
+guicheck: sampletestsgui
+ tdeunittest ./sampletestsgui SampleTests
diff --git a/tdeunittest/example/simple/main.cpp b/tdeunittest/example/simple/main.cpp
new file mode 100644
index 00000000..7f6edb1e
--- /dev/null
+++ b/tdeunittest/example/simple/main.cpp
@@ -0,0 +1,32 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tdeunittest/runner.h"
+
+int main( int /*argc*/, char** /*argv*/ )
+{
+ KUnitTest::Runner::self()->runTests();
+ return KUnitTest::Runner::self()->numberOfFailedTests();
+}
diff --git a/tdeunittest/example/simple/maingui.cpp b/tdeunittest/example/simple/maingui.cpp
new file mode 100644
index 00000000..419aacd9
--- /dev/null
+++ b/tdeunittest/example/simple/maingui.cpp
@@ -0,0 +1,60 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+
+#include "tdeunittest/runnergui.h"
+
+static const char description[] =
+ I18N_NOOP("A simple sample.");
+
+static const char version[] = "0.1";
+
+static KCmdLineOptions options[] =
+{
+// { "+[URL]", I18N_NOOP( "Document to open" ), 0 },
+ KCmdLineLastOption
+};
+
+int main( int argc, char** argv )
+{
+ TDEAboutData about("SampleTests", I18N_NOOP("SampleTests"), version, description,
+ TDEAboutData::License_BSD, "(C) 2005 Jeroen Wijnhout", 0, 0,
+ "Jeroen.Wijnhout@kdemail.net");
+
+ TDECmdLineArgs::init(argc, argv, &about);
+ TDECmdLineArgs::addCmdLineOptions( options );
+
+ TDEApplication app;
+
+ KUnitTest::RunnerGUI runner(0);
+ runner.show();
+ app.setMainWidget(&runner);
+
+ return app.exec();
+}
diff --git a/tdeunittest/example/simple/sampletest.cpp b/tdeunittest/example/simple/sampletest.cpp
new file mode 100644
index 00000000..04be74de
--- /dev/null
+++ b/tdeunittest/example/simple/sampletest.cpp
@@ -0,0 +1,55 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <tqstringlist.h>
+
+#include <kdebug.h>
+#include <tdeunittest/runner.h>
+
+#include "sampletest.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_SUITE("SampleSuite");
+KUNITTEST_REGISTER_TESTER(SimpleSampleTester);
+KUNITTEST_REGISTER_TESTER(SomeSampleTester);
+
+void SimpleSampleTester::allTests()
+{
+ kdDebug() << "Debug output belonging to SimpleSampleTester." << endl;
+ CHECK( TQString("SimpleSample") , TQString("SimpleSample") );
+
+ SKIP("Just curious how this 'skipping' works.");
+}
+
+void SomeSampleTester::allTests()
+{
+ kdDebug() << "Checking operator precedences." << endl;
+ CHECK( 2.0 * 3.0 / 2.0 * 4.0 / 2.0 , 6.0 );
+
+ TQStringList testList;
+ testList << "one" << "two";
+ CHECK( testList.count() , (TQStringList::size_type) 2 );
+}
diff --git a/tdeunittest/example/simple/sampletest.h b/tdeunittest/example/simple/sampletest.h
new file mode 100644
index 00000000..b5c50b43
--- /dev/null
+++ b/tdeunittest/example/simple/sampletest.h
@@ -0,0 +1,42 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SAMPLETEST_H
+#define SAMPLETEST_H
+
+#include <tdeunittest/tester.h>
+
+class SimpleSampleTester : public KUnitTest::Tester
+{
+public:
+ void allTests();
+};
+
+class SomeSampleTester : public KUnitTest::Tester
+{
+public:
+ void allTests();
+};
+#endif
diff --git a/tdeunittest/guimodrunner.cpp b/tdeunittest/guimodrunner.cpp
new file mode 100644
index 00000000..91757a5e
--- /dev/null
+++ b/tdeunittest/guimodrunner.cpp
@@ -0,0 +1,72 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <kdebug.h>
+#include <kapplication.h>
+#include <kglobal.h>
+#include <kinstance.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+
+#include "runnergui.h"
+
+static const char description[] =
+ I18N_NOOP("A command-line application that can be used to run KUnitTest modules.");
+
+static const char version[] = "0.1";
+
+static KCmdLineOptions options[] =
+{
+ {"query [regexp]", I18N_NOOP("Only run modules which filename match the regexp."), "^tdeunittest_.*\\.la$"},
+ {"folder [folder]", I18N_NOOP("Only run tests modules which are found in the folder. Use the query option to select modules."), "."},
+ { "enable-dbgcap", I18N_NOOP("Enables debug capturing. You typically use this option when you use the GUI."), 0},
+ KCmdLineLastOption
+};
+
+
+int main( int argc, char **argv )
+{
+ TDEInstance instance("modrunner");
+
+ TDEAboutData about("KUnitTestModRunner", I18N_NOOP("KUnitTestModRunner"), version, description,
+ TDEAboutData::License_BSD, "(C) 2005 Jeroen Wijnhout", 0, 0,
+ "Jeroen.Wijnhout@kdemail.net");
+
+ TDECmdLineArgs::init(argc, argv, &about);
+ TDECmdLineArgs::addCmdLineOptions( options );
+ TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
+
+ KUnitTest::Runner::loadModules(args->getOption("folder"), args->getOption("query"));
+ KUnitTest::Runner::setDebugCapturingEnabled(args->isSet("enable-dbgcap"));
+
+ TDEApplication app;
+
+ KUnitTest::RunnerGUI runner(0);
+ runner.show();
+ app.setMainWidget(&runner);
+
+ return app.exec();
+}
diff --git a/tdeunittest/runnergui.cpp b/tdeunittest/runnergui.cpp
new file mode 100644
index 00000000..8e31dac2
--- /dev/null
+++ b/tdeunittest/runnergui.cpp
@@ -0,0 +1,433 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <tqmetaobject.h>
+#include <tqregexp.h>
+#include <tqpushbutton.h>
+#include <tqtextedit.h>
+#include <tqlabel.h>
+#include <tqprogressbar.h>
+#include <tqcombobox.h>
+
+#include <dcopclient.h>
+#include <dcopobject.h>
+#include <kiconloader.h>
+#include <kdebug.h>
+#include <kmessagebox.h>
+
+#include <tdeunittest/tester.h>
+
+#include "dcopinterface.h"
+#include "runnergui.h"
+#include "testerwidget.h"
+
+namespace KUnitTest
+{
+ const int g_nameColumn = 0;
+ const int g_finishedColumn = 1;
+ const int g_skippedColumn = 2;
+ const int g_failedColumn = 3;
+ const int g_xfailedColumn = 4;
+ const int g_passedColumn = 5;
+ const int g_xpassedColumn = 6;
+
+ /*! The DCOP implementation for the RunnerGUI.
+ */
+ class RunnerGUIDCOPImpl : virtual public DCOPInterface
+ {
+ public:
+ RunnerGUIDCOPImpl(RunnerGUI *rg) : m_rg(rg)
+ {
+ // set the DCOP object id
+ setObjId("Runner");
+ }
+
+ /*! This DCOP method adds debug info to a given test case.
+ * @param name The name of the test.
+ * @param info The debug info.
+ */
+ bool addDebugInfo(const TQString &name, const TQString &info)
+ {
+ Tester *tester = Runner::self()->registry().find(name.local8Bit());
+ if ( tester == 0L ) return false;
+
+ tester->results()->addDebugInfo(info);
+
+ return true;
+ }
+
+ bool addSlotDebugInfo(const TQString &name, const TQString &slt, const TQString &info)
+ {
+ Tester *tester = Runner::self()->registry().find(name.local8Bit());
+
+ if ( tester == 0L ) return false;
+ if ( ! tester->inherits("KUnitTest::SlotTester") ) return false;
+
+ SlotTester *sltester = static_cast<SlotTester*>(tester);
+ sltester->results(slt.local8Bit())->addDebugInfo(info);
+
+ return true;
+ }
+
+ private:
+ RunnerGUI *m_rg;
+ };
+
+ RunnerGUI::RunnerGUI(TQWidget *parent) : TQHBox(parent)
+ {
+ m_dcop = new RunnerGUIDCOPImpl(this);
+
+ m_testerWidget = new TesterWidget(this);
+ setGeometry(0, 0, 700, 500);
+
+ // file the combo box
+ m_testerWidget->selectCombo()->insertItem("All suites/modules . . .");
+ m_testerWidget->selectCombo()->insertItem("Selected tests . . .");
+
+ RegistryIteratorType it(Runner::self()->registry());
+ TQStringList suites;
+ for ( ; it.current(); ++it )
+ {
+ addTester(it.currentKey(), it.current());
+
+ TQString test = it.currentKey();
+ int index = test.find("::");
+ if ( index != -1 ) test = test.left(index);
+
+ if ( suites.contains(test) == 0 )
+ suites.append(test);
+ }
+
+ for ( uint i = 0; i < suites.count(); ++i )
+ m_testerWidget->selectCombo()->insertItem(suites[i]);
+
+ // configure the resultslist
+ m_testerWidget->resultList()->setAllColumnsShowFocus(true);
+ m_testerWidget->resultList()->setSelectionMode(TQListView::Extended);
+ m_testerWidget->resultList()->setRootIsDecorated(true);
+ m_testerWidget->resultList()->setColumnAlignment(g_finishedColumn, TQt::AlignHCenter);
+ m_testerWidget->resultList()->setColumnAlignment(g_skippedColumn, TQt::AlignHCenter);
+ m_testerWidget->resultList()->setColumnAlignment(g_failedColumn, TQt::AlignHCenter);
+ m_testerWidget->resultList()->setColumnAlignment(g_xfailedColumn, TQt::AlignHCenter);
+ m_testerWidget->resultList()->setColumnAlignment(g_passedColumn, TQt::AlignHCenter);
+ m_testerWidget->resultList()->setColumnAlignment(g_xpassedColumn, TQt::AlignHCenter);
+
+ // set the text in the results label
+ fillResultsLabel();
+
+ // init the progress bar
+ configureProgressBar(Runner::self()->numberOfTestCases(), 0);
+
+ connect(Runner::self(), TQT_SIGNAL(finished(const char *, Tester *)), this, TQT_SLOT(addTestResult(const char *, Tester *)));
+ connect(m_testerWidget->resultList(), TQT_SIGNAL(clicked(TQListViewItem *)), this, TQT_SLOT(showDetails(TQListViewItem *)));
+ connect(m_testerWidget, TQT_SIGNAL(run()), this, TQT_SLOT(runSuite()));
+ connect(m_testerWidget->details(), TQT_SIGNAL(doubleClicked(int, int)), this, TQT_SLOT(doubleClickedOnDetails(int, int)));
+ }
+
+ RunnerGUI::~RunnerGUI()
+ {
+ delete m_dcop;
+ }
+
+ void RunnerGUI::configureProgressBar(int steps, int progress)
+ {
+ m_testerWidget->progressBar()->setTotalSteps(steps);
+ m_testerWidget->progressBar()->setProgress(progress);
+ }
+
+ void RunnerGUI::fillResultsLabel()
+ {
+ if ( Runner::self()->numberOfTests() > 0 )
+ m_testerWidget->resultsLabel()->setText(
+ TQString("Test cases: %1 | Tests performed: %5, Skipped: <font color=\"#f7a300\">%4</font> | Passed: <font color=\"#009900\">%2</font>, Failed: <font color=\"#990000\">%3</font>")
+ .arg(Runner::self()->numberOfTestCases())
+ .arg(Runner::self()->numberOfPassedTests())
+ .arg(Runner::self()->numberOfFailedTests())
+ .arg(Runner::self()->numberOfSkippedTests())
+ .arg(Runner::self()->numberOfTests()) );
+ else
+ m_testerWidget->resultsLabel()->setText(TQString("Test cases: %1").arg(Runner::self()->numberOfTestCases()));
+ }
+
+ void RunnerGUI::addTestResult(const char *name, Tester *test)
+ {
+ TQStringList scopes = TQStringList::split("::", name);
+ TQString suite = scopes[0];
+
+ // find the suite item
+ TQListViewItem *item = 0L;
+ for ( uint i = 0; i < scopes.count(); ++i )
+ item = getItem(scopes[i], item);
+
+ if ( test->inherits("KUnitTest::SlotTester") )
+ {
+ SlotTester *sltest = static_cast<SlotTester*>(test);
+ TestResultsListIteratorType it(sltest->resultsList());
+ TQListViewItem *slotItem = 0L;
+ for ( ; it.current(); ++it)
+ {
+ slotItem = getItem(it.currentKey(), item);
+ setSummary(slotItem, it.current());
+ }
+ }
+ else
+ setSummary(item, test->results());
+
+ fillResultsLabel();
+ m_testerWidget->progressBar()->setProgress(m_testerWidget->progressBar()->progress() + 1);
+ }
+
+ void RunnerGUI::addTester(const char *name, Tester *test)
+ {
+ TQStringList scopes = TQStringList::split("::", name);
+ TQString suite = scopes[0];
+
+ // find the suite item
+ TQListViewItem *item = 0L;
+ for ( uint i = 0; i < scopes.count(); ++i )
+ item = getItem(scopes[i], item);
+
+ if ( test->inherits("KUnitTest::SlotTester") )
+ {
+ TQStrList allSlots = test->metaObject()->slotNames();
+ for ( char *sl = allSlots.first(); sl; sl = allSlots.next() )
+ {
+ if ( TQString(sl).startsWith("test") )
+ getItem(sl, item);
+ }
+ }
+ }
+
+ TQListViewItem *RunnerGUI::getItem(const TQString &name, TQListViewItem *item /*= 0L*/)
+ {
+ TQListViewItem *parent = item;
+
+ if ( item == 0L ) item = m_testerWidget->resultList()->firstChild();
+ else item = item->firstChild();
+
+ while ( item && (item->text(g_nameColumn) != name) )
+ item = item->nextSibling();
+
+ // item not found, create it
+ if ( item == 0L )
+ {
+ if ( parent == 0L )
+ item = new TQListViewItem(m_testerWidget->resultList());
+ else
+ item = new TQListViewItem(parent);
+
+ item->setText(g_nameColumn, name);
+ }
+
+ return item;
+ }
+
+ void RunnerGUI::reset()
+ {
+ TQListViewItemIterator it( m_testerWidget->resultList() );
+ while ( it.current() )
+ {
+ TQListViewItem *item = it.current();
+ item->setText(g_finishedColumn, "0");
+ item->setText(g_skippedColumn, "0");
+ item->setText(g_failedColumn, "0");
+ item->setText(g_xfailedColumn, "0");
+ item->setText(g_passedColumn, "0");
+ item->setText(g_xpassedColumn, "0");
+ item->setPixmap(g_nameColumn, TQPixmap());
+ ++it;
+ }
+ }
+
+ void RunnerGUI::setSummary(TQListViewItem *item, TestResults *res)
+ {
+ if ( item == 0L ) return;
+
+ bool ok;
+
+ int val = item->text(g_finishedColumn).toInt(&ok); if (!ok) val = 0;
+ item->setText(g_finishedColumn, TQString::number(val + res->testsFinished()));
+
+ val = item->text(g_skippedColumn).toInt(&ok); if (!ok) val = 0;
+ item->setText(g_skippedColumn, TQString::number(val + res->skipped()));
+
+ val = item->text(g_passedColumn).toInt(&ok); if (!ok) val = 0;
+ item->setText(g_passedColumn, TQString::number(val + res->passed()));
+
+ val = item->text(g_failedColumn).toInt(&ok); if (!ok) val = 0;
+ item->setText(g_failedColumn, TQString::number(val + res->errors()));
+
+ val = item->text(g_xfailedColumn).toInt(&ok); if (!ok) val = 0;
+ item->setText(g_xfailedColumn, TQString::number(val + res->xfails()));
+
+ val = item->text(g_xpassedColumn).toInt(&ok); if (!ok) val = 0;
+ item->setText(g_xpassedColumn, TQString::number(val + res->xpasses()));
+
+ bool passed = (item->text(g_failedColumn).toInt(&ok) + item->text(g_xfailedColumn).toInt(&ok)) == 0;
+ item->setPixmap(g_nameColumn, passed ? SmallIcon("button_ok") : SmallIcon("button_cancel") );
+
+ setSummary(item->parent(), res);
+ }
+
+ TQString RunnerGUI::fullName(TQListViewItem *item)
+ {
+ TQString name = item->text(g_nameColumn);
+ while ( (item = item->parent()) != 0L )
+ name = item->text(g_nameColumn) + "::" + name;
+
+ return name;
+ }
+
+ void RunnerGUI::runSuite()
+ {
+ Runner::self()->reset();
+ reset();
+
+ if ( m_testerWidget->selectCombo()->currentItem() == 0 )
+ {
+ configureProgressBar(Runner::self()->numberOfTestCases(), 0);
+ Runner::self()->runTests();
+ }
+ else if ( m_testerWidget->selectCombo()->currentItem() == 1 )
+ {
+ TQListViewItemIterator it( m_testerWidget->resultList() );
+ TQStringList prefixes;
+ while ( it.current() )
+ {
+ TQListViewItem *item = it.current();
+ if ( item->isSelected() )
+ {
+ TQString prefix = fullName(item);
+ if ( prefix.endsWith("()") )
+ {
+ int index = prefix.findRev("::");
+ prefix = prefix.left(index);
+ }
+ prefixes << prefix;
+ }
+
+ ++it;
+ }
+
+ configureProgressBar(prefixes.count(), 0);
+ for ( uint i = 0; i < prefixes.count(); ++i )
+ Runner::self()->runMatchingTests(prefixes[i]);
+ }
+ else
+ {
+ TQString suite = m_testerWidget->selectCombo()->currentText();
+ TQStringList tests;
+ RegistryIteratorType it(Runner::self()->registry());
+ for ( ; it.current(); ++it )
+ if ( TQString(it.currentKey()).startsWith(suite) )
+ tests.append(it.currentKey());
+
+ configureProgressBar(tests.count(), 0);
+
+ for ( uint i = 0; i < tests.count(); ++i )
+ Runner::self()->runTest(tests[i].local8Bit());
+ }
+
+ showDetails(m_testerWidget->resultList()->currentItem());
+ }
+
+ void RunnerGUI::showDetails(TQListViewItem *item)
+ {
+ if ( item == 0L ) return;
+
+ TQString name = fullName(item);
+ if ( name.endsWith("()") ) name = fullName(item->parent());
+
+ Tester *tester = Runner::self()->registry().find(name.local8Bit());
+
+ if ( tester == 0L ) return;
+
+ TestResults *res = 0L;
+ if ( tester->inherits("KUnitTest::SlotTester") )
+ res = static_cast<SlotTester*>(tester)->results(item->text(g_nameColumn).local8Bit());
+ else
+ res = tester->results();
+
+ if ( tester == 0L )
+ m_testerWidget->details()->setText("No test found with name: " + fullName(item));
+ else
+ {
+ TQTextEdit *te = m_testerWidget->details();
+
+ te->clear();
+
+ te->append("<qt><a name=\"errors\"><font color=\"#990000\">Errors</font></a>:<br></qt>");
+ appendList(te, res->errorList());
+
+ te->append("<qt><br><hr><font color=\"#c2c939\">Expected to fail</font>:<br></qt>");
+ appendList(te, res->xfailList());
+
+ te->append("<qt><br><hr><font color=\"#BF00B5\">Unexpected Success</font>:<br></qt>");
+ appendList(te, res->xpassList());
+
+ te->append("<qt><br><hr><font color=\"#009900\">Success</font>:<br></qt>");
+ appendList(te, res->successList());
+
+ te->append("<qt><br><hr><font color=\"#F7A300\">Skipped</font>:<br></qt>");
+ appendList(te, res->skipList());
+
+ te->append("<qt><br><hr><font color=\"#000099\">Debug</font>:<br></qt>");
+
+ te->append(res->debugInfo());
+
+ te->scrollToAnchor("errors");
+ }
+ }
+
+ void RunnerGUI::appendList(TQTextEdit *te, const TQStringList &list)
+ {
+ for ( uint i = 0; i < list.count(); ++i )
+ te->append(list[i]);
+ }
+
+ void RunnerGUI::doubleClickedOnDetails(int para, int /*pos*/)
+ {
+ static TQRegExp reFileAndLine("^(.*)\\[([0-9]+)\\]:");
+
+ TQString line = m_testerWidget->details()->text(para);
+ m_testerWidget->details()->setSelection(para, 0, para, line.length()-1);
+
+ if ( reFileAndLine.search(line) != -1 )
+ {
+ DCOPClient client;
+ client.attach();
+ TQByteArray data;
+ TQDataStream arg(data, IO_WriteOnly);
+ bool ok;
+ arg << TQString(reFileAndLine.cap(1)) << (reFileAndLine.cap(2).toInt(&ok) - 1);
+ client.send("tdevelop-*", "KDevPartController", "editDocument(TQString,int)", data);
+ client.send("tdevelop-*", "MainWindow", "raise()", TQString(""));
+
+ client.detach();
+ }
+ }
+}
+
+#include "runnergui.moc"
diff --git a/tdeunittest/runnergui.h b/tdeunittest/runnergui.h
new file mode 100644
index 00000000..73d8863c
--- /dev/null
+++ b/tdeunittest/runnergui.h
@@ -0,0 +1,79 @@
+/**
+ * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _KUNITTEST_TESTER_H_
+#define _KUNITTEST_TESTER_H_
+
+#include <tqlistview.h>
+#include <tqhbox.h>
+
+#include <tdeunittest/runner.h>
+#include <tdeunittest/tester.h>
+
+#include <kdemacros.h>
+
+class TesterWidget;
+class TQTextEdit;
+
+namespace KUnitTest
+{
+ class RunnerGUIDCOPImpl;
+
+ class KDE_EXPORT RunnerGUI : public TQHBox
+ {
+ Q_OBJECT
+
+
+ public:
+ RunnerGUI(TQWidget *parent);
+ ~RunnerGUI();
+
+ private slots:
+ void addTestResult(const char *name, Tester *test);
+ void addTester(const char *name, Tester *test);
+ void showDetails(TQListViewItem *item);
+ void runSuite();
+ void doubleClickedOnDetails(int para, int pos);
+
+ private:
+ void reset();
+ void configureProgressBar(int steps, int progress);
+ void fillResultsLabel();
+ void appendList(TQTextEdit *te, const TQStringList &list);
+
+ TQListViewItem *getItem(const TQString &name, TQListViewItem *item = 0L);
+ void setItem(TQListViewItem *item, const TestResults *res);
+ TQString fullName(TQListViewItem *item);
+
+ void setSummary(TQListViewItem *item, TestResults *res);
+
+ TesterWidget *m_testerWidget;
+
+ friend class RunnerGUIDCOPImpl;
+ RunnerGUIDCOPImpl *m_dcop;
+ };
+}
+
+#endif
diff --git a/tdeunittest/tdeunittest b/tdeunittest/tdeunittest
new file mode 100755
index 00000000..c56f6c3a
--- /dev/null
+++ b/tdeunittest/tdeunittest
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+export APP=$1
+export DCOPNAME=$2
+
+if [ ! -x $APP ]
+then
+ kdialog --error "Sorry, $APP is not a valid executable file."
+ exit 1;
+fi
+
+DEBUGHELPER=`which tdeunittest_debughelper`
+if [ -z $DEBUGHELPER ]
+then
+ kdialog --error "Sorry, couldn't find the tdeunittest_debughelper script."
+ exit 3
+fi
+
+$APP 2>&1 | perl $DEBUGHELPER "$DCOPNAME-*"
diff --git a/tdeunittest/tdeunittest_debughelper b/tdeunittest/tdeunittest_debughelper
new file mode 100755
index 00000000..66dfacf2
--- /dev/null
+++ b/tdeunittest/tdeunittest_debughelper
@@ -0,0 +1,107 @@
+#!/usr/bin/perl
+# Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+use DCOP;
+
+my $app = $ARGV[0]; shift @ARGV;
+my $dcopid = "";
+my $testername = "";
+my $reading_debug = 0;
+my $debug="";
+my $runnergui;
+
+my $client = new DCOP;
+$client->attach();
+
+while (<>)
+{
+ $runnergui = getDCOPObject();
+ my $line = $_;
+
+ print $_;
+
+ if ( $line =~ /KUnitTest_Debug_End\[.*\]/ )
+ {
+ $ret = $runnergui->addDebugInfo($testername, $debug);
+
+ $debug = "";
+
+ # stop reading
+ $reading_debug = 0;
+ }
+ elsif ( $line =~ /KUnitTest_Debug_EndSlot\[.*\]/ )
+ {
+ $ret = $runnergui->addSlotDebugInfo($testername, $slotname, $debug);
+
+ $line = "";
+ $debug = "";
+ $slotname = "";
+ }
+ elsif ( $line =~ /KUnitTest_Debug_BeginSlot\[(.*)\]/ )
+ {
+ $slotname = $1;
+ $line = "";
+ }
+
+ if ( $reading_debug )
+ {
+ if ( $line =~ /^check:(.*\[[0-9]+\])/ )
+ {
+ $line = $1.":\n";
+ }
+
+ $debug = $debug.$line;
+ }
+
+ if ( $line =~ /KUnitTest_Debug_Start\[(.*)\]/ )
+ {
+ $testername = $1;
+ $reading_debug = 1;
+ $debug="";
+ }
+}
+
+sub getDCOPObject
+{
+ if ( $dcopid eq "" )
+ {
+ $allapps = $client->registeredApplications();
+ my $i = 0;
+ while ( ! ($allapps->[$i] eq "") )
+ {
+ if ( $allapps->[$i] =~ /$app/ )
+ {
+ print "found: ".$allapps->[$i]."\n";
+ $dcopid = $allapps->[$i];
+ break;
+ }
+
+ $i = $i + 1;
+ }
+
+ $object = $client->createObject($dcopid, "Runner");
+ }
+
+ return $object;
+} \ No newline at end of file
diff --git a/tdeunittest/tdeunittestmod b/tdeunittest/tdeunittestmod
new file mode 100755
index 00000000..f5872692
--- /dev/null
+++ b/tdeunittest/tdeunittestmod
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+FOLDER="--folder $PWD"
+QUERY=""
+
+while [ "$#" -gt 0 ]
+do
+ case $1 in
+ -f|--folder)
+ FOLDER="--folder $2"
+ shift
+ ;;
+ -q|--query)
+ QUERY="--query $2"
+ shift
+ ;;
+ esac
+ # to process the next parameter
+ shift
+done
+
+APP=`which tdeunittestguimodrunner`
+if [ ! -x $APP ]
+then
+ kdialog --error "Sorry, $APP is not a valid executable file."
+ exit 1;
+fi
+
+DEBUGHELPER=`which tdeunittest_debughelper`
+if [ -z $DEBUGHELPER ]
+then
+ kdialog --error "Sorry, couldn't find the tdeunittest_debughelper script."
+ exit 3
+fi
+
+DCOPNAME="KUnitTestModRunner"
+$APP --enable-dbgcap $FOLDER $QUERY 2>&1 | perl $DEBUGHELPER "$DCOPNAME-*"
diff --git a/tdeunittest/testerwidget.ui b/tdeunittest/testerwidget.ui
new file mode 100644
index 00000000..e6e92e1c
--- /dev/null
+++ b/tdeunittest/testerwidget.ui
@@ -0,0 +1,197 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>TesterWidget</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>TesterWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>622</width>
+ <height>773</height>
+ </rect>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>500</width>
+ <height>500</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>KUnitTester</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQPushButton" row="0" column="2">
+ <property name="name">
+ <cstring>m_pshRun</cstring>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <widget class="TQProgressBar" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>m_pbProgress</cstring>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>m_cbSelect</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>m_lbSelect</cstring>
+ </property>
+ <property name="text">
+ <string>Select a suite or module:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>m_lbResults</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="TQListView" row="3" column="0" rowspan="1" colspan="3">
+ <column>
+ <property name="text">
+ <string>Test</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Finished</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Skipped</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Failed</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>xFailed</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Passed</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>xPassed</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>m_lvResults</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>200</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="TQTextEdit" row="4" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>m_teDetails</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>600</width>
+ <height>200</height>
+ </size>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<includes>
+ <include location="local" impldecl="in implementation">testerwidget.ui.h</include>
+</includes>
+<Q_SIGNALS>
+ <signal>run()</signal>
+</Q_SIGNALS>
+<functions>
+ <function access="private" specifier="non virtual">init()</function>
+ <function returnType="TQListView *">resultList()</function>
+ <function returnType="TQTextEdit *">details()</function>
+ <function returnType="TQProgressBar *">progressBar()</function>
+ <function returnType="TQLabel *">resultsLabel()</function>
+ <function returnType="TQComboBox *">selectCombo()</function>
+</functions>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/tdeunittest/testerwidget.ui.h b/tdeunittest/testerwidget.ui.h
new file mode 100644
index 00000000..f80a248d
--- /dev/null
+++ b/tdeunittest/testerwidget.ui.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you want to add, delete, or rename functions or slots, use
+** TQt Designer to update this file, preserving your code.
+**
+** You should not define a constructor or destructor in this file.
+** Instead, write your code in functions called init() and destroy().
+** These will automatically be called by the form's constructor and
+** destructor.
+*****************************************************************************/
+
+
+void TesterWidget::init()
+{
+ connect(m_pshRun, TQT_SIGNAL(clicked()), this, TQT_SIGNAL(run()));
+}
+
+TQListView * TesterWidget::resultList()
+{
+ return m_lvResults;
+}
+
+
+TQTextEdit * TesterWidget::details()
+{
+ return m_teDetails;
+}
+
+
+TQProgressBar * TesterWidget::progressBar()
+{
+ return m_pbProgress;
+}
+
+
+TQLabel * TesterWidget::resultsLabel()
+{
+ return m_lbResults;
+}
+
+
+TQComboBox * TesterWidget::selectCombo()
+{
+ return m_cbSelect;
+}