summaryrefslogtreecommitdiffstats
path: root/kunittest
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbd9e6617827818fd043452c08c606f07b78014a0 (patch)
tree425bb4c3168f9c02f10150f235d2cb998dcc6108 /kunittest
downloadtdesdk-bd9e6617827818fd043452c08c606f07b78014a0.tar.gz
tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kunittest')
-rw-r--r--kunittest/Makefile.am21
-rw-r--r--kunittest/dcopinterface.h38
-rw-r--r--kunittest/example/Makefile.am1
-rw-r--r--kunittest/example/module/Makefile.am20
-rw-r--r--kunittest/example/module/sampleextra.cpp37
-rw-r--r--kunittest/example/module/sampleextra.h36
-rw-r--r--kunittest/example/module/samplemodule.cpp37
-rw-r--r--kunittest/example/module/samplemodule.h43
-rw-r--r--kunittest/example/module/samplemodule2.cpp61
-rw-r--r--kunittest/example/module/samplemodule2.h43
-rw-r--r--kunittest/example/module/sampletests.cpp82
-rw-r--r--kunittest/example/module/sampletests.h53
-rw-r--r--kunittest/example/simple/Makefile.am22
-rw-r--r--kunittest/example/simple/main.cpp32
-rw-r--r--kunittest/example/simple/maingui.cpp60
-rw-r--r--kunittest/example/simple/sampletest.cpp55
-rw-r--r--kunittest/example/simple/sampletest.h42
-rw-r--r--kunittest/guimodrunner.cpp72
-rwxr-xr-xkunittest/kunittest19
-rwxr-xr-xkunittest/kunittest_debughelper107
-rwxr-xr-xkunittest/kunittestmod37
-rw-r--r--kunittest/runnergui.cpp433
-rw-r--r--kunittest/runnergui.h78
-rw-r--r--kunittest/testerwidget.ui197
-rw-r--r--kunittest/testerwidget.ui.h46
25 files changed, 1672 insertions, 0 deletions
diff --git a/kunittest/Makefile.am b/kunittest/Makefile.am
new file mode 100644
index 00000000..2e5d3d0b
--- /dev/null
+++ b/kunittest/Makefile.am
@@ -0,0 +1,21 @@
+SUBDIRS = example
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+
+lib_LTLIBRARIES = libkunittestgui.la
+libkunittestgui_la_SOURCES = testerwidget.ui runnergui.cpp dcopinterface.skel
+libkunittestgui_la_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+libkunittestgui_la_LIBADD = -lkunittest $(LIB_KDECORE)
+
+runnergui.lo : testerwidget.h
+
+bin_PROGRAMS = kunittestguimodrunner
+kunittestguimodrunner_SOURCES = guimodrunner.cpp
+kunittestguimodrunner_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+kunittestguimodrunner_LDADD = libkunittestgui.la $(LIB_KDECORE) $(LIB_KIO)
+
+noinst_HEADERS = dcopinterface.h
+libkunittestinclude_HEADERS = runnergui.h
+libkunittestincludedir = $(includedir)/kunittest
+
+bin_SCRIPTS = kunittest kunittestmod kunittest_debughelper
diff --git a/kunittest/dcopinterface.h b/kunittest/dcopinterface.h
new file mode 100644
index 00000000..046753d2
--- /dev/null
+++ b/kunittest/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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef KUNITTEST_DCOPINTERFACE_H
+#define KUNITTEST_DCOPINTERFACE_H
+
+#include <dcopobject.h>
+#include <qstring.h>
+
+namespace KUnitTest
+{
+ class DCOPInterface : public DCOPObject
+ {
+ K_DCOP
+
+ k_dcop:
+ virtual bool addDebugInfo(const QString &name, const QString &info) = 0;
+ virtual bool addSlotDebugInfo(const QString &name, const QString &slt, const QString &info) = 0;
+ };
+}
+
+#endif
diff --git a/kunittest/example/Makefile.am b/kunittest/example/Makefile.am
new file mode 100644
index 00000000..d008ca22
--- /dev/null
+++ b/kunittest/example/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = simple module
diff --git a/kunittest/example/module/Makefile.am b/kunittest/example/module/Makefile.am
new file mode 100644
index 00000000..17404d06
--- /dev/null
+++ b/kunittest/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 = kunittest_samplemodule.la kunittest_samplemodule2.la
+
+kunittest_samplemodule_la_SOURCES = samplemodule.cpp sampletests.cpp sampleextra.cpp
+kunittest_samplemodule_la_LIBADD = -lkunittest
+kunittest_samplemodule_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
+
+kunittest_samplemodule2_la_SOURCES = samplemodule2.cpp
+kunittest_samplemodule2_la_LIBADD = -lkunittest
+kunittest_samplemodule2_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
+
+check-local:
+ kunittestmodrunner
+
+guicheck:
+ $(srcdir)/../../kunittestmod $(PWD)
diff --git a/kunittest/example/module/sampleextra.cpp b/kunittest/example/module/sampleextra.cpp
new file mode 100644
index 00000000..38c49448
--- /dev/null
+++ b/kunittest/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 <kunittest/tester.h>
+
+#include "sampleextra.h"
+
+
+void SomeExtraTester::allTests()
+{
+ kdDebug() << "Debug output belonging to SomeExtraTester." << endl;
+
+ CHECK( QString("Extra") , QString("Extra") );
+}
diff --git a/kunittest/example/module/sampleextra.h b/kunittest/example/module/sampleextra.h
new file mode 100644
index 00000000..f27a6bd9
--- /dev/null
+++ b/kunittest/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 <kunittest/tester.h>
+
+class SomeExtraTester : public KUnitTest::Tester
+{
+ void allTests();
+};
+
+#endif
diff --git a/kunittest/example/module/samplemodule.cpp b/kunittest/example/module/samplemodule.cpp
new file mode 100644
index 00000000..3b6665fd
--- /dev/null
+++ b/kunittest/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 <kunittest/runner.h>
+#include <kunittest/module.h>
+
+#include "sampletests.h"
+#include "sampleextra.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE( kunittest_samplemodule, "Suite1" )
+KUNITTEST_MODULE_REGISTER_TESTER( SlotSampleTester )
+KUNITTEST_MODULE_REGISTER_TESTER( SomeSampleTester )
+KUNITTEST_MODULE_REGISTER_TESTER( SomeExtraTester )
diff --git a/kunittest/example/module/samplemodule.h b/kunittest/example/module/samplemodule.h
new file mode 100644
index 00000000..b09002c6
--- /dev/null
+++ b/kunittest/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 <kunittest/tester.h>
+
+class SimpleSampleTester : public KUnitTest::Tester
+{
+public:
+ void allTests();
+};
+
+class SomeSampleTester : public KUnitTest::Tester
+{
+public:
+ void allTests();
+};
+
+#endif
diff --git a/kunittest/example/module/samplemodule2.cpp b/kunittest/example/module/samplemodule2.cpp
new file mode 100644
index 00000000..87efde28
--- /dev/null
+++ b/kunittest/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 <qstringlist.h>
+
+#include <kdebug.h>
+#include <kunittest/runner.h>
+#include <kunittest/module.h>
+
+#include "samplemodule.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE( kunittest_samplemodule2, "Suite2::Sub" )
+KUNITTEST_MODULE_REGISTER_TESTER( SimpleSampleTester )
+KUNITTEST_MODULE_REGISTER_TESTER( SomeSampleTester )
+
+void SimpleSampleTester::allTests()
+{
+ kdDebug() << "Debug output belonging to SimpleSampleTester." << endl;
+ CHECK( QString("SimpleSample") , QString("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 );
+
+ QStringList testList;
+ testList << "one" << "two";
+ CHECK( testList.count() , (QStringList::size_type) 2 );
+}
diff --git a/kunittest/example/module/samplemodule2.h b/kunittest/example/module/samplemodule2.h
new file mode 100644
index 00000000..b09002c6
--- /dev/null
+++ b/kunittest/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 <kunittest/tester.h>
+
+class SimpleSampleTester : public KUnitTest::Tester
+{
+public:
+ void allTests();
+};
+
+class SomeSampleTester : public KUnitTest::Tester
+{
+public:
+ void allTests();
+};
+
+#endif
diff --git a/kunittest/example/module/sampletests.cpp b/kunittest/example/module/sampletests.cpp
new file mode 100644
index 00000000..3b253e55
--- /dev/null
+++ b/kunittest/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 <qstringlist.h>
+
+#include <kdebug.h>
+#include <kunittest/runner.h>
+#include <kunittest/module.h>
+
+#include "sampletests.h"
+#include "sampleextra.h"
+
+void SlotSampleTester::setUp()
+{
+ kdDebug() << "setUp" << endl;
+ m_str = new QString("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 , QString("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 );
+
+ QStringList testList;
+ testList << "one" << "two";
+ CHECK( testList.count() , (QStringList::size_type) 2 );
+ CHECK( testList.count()*2 , (QStringList::size_type) 4 );
+}
+
+#include "sampletests.moc"
+
diff --git a/kunittest/example/module/sampletests.h b/kunittest/example/module/sampletests.h
new file mode 100644
index 00000000..63ff6e44
--- /dev/null
+++ b/kunittest/example/module/sampletests.h
@@ -0,0 +1,53 @@
+/**
+ * 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 <kunittest/tester.h>
+
+class SlotSampleTester : public KUnitTest::SlotTester
+{
+ Q_OBJECT
+
+public slots:
+ void setUp();
+ void tearDown();
+ void testSlot();
+ void testSlot2();
+
+private:
+ bool test();
+
+ QString *m_str;
+};
+
+class SomeSampleTester : public KUnitTest::Tester
+{
+public:
+ void allTests();
+};
+
+#endif
diff --git a/kunittest/example/simple/Makefile.am b/kunittest/example/simple/Makefile.am
new file mode 100644
index 00000000..f35b8228
--- /dev/null
+++ b/kunittest/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 = $(KDE_RPATH) $(all_libraries)
+sampletests_LDADD = -lkunittest
+
+sampletestsgui_SOURCES = maingui.cpp sampletest.cpp
+sampletestsgui_LDFLAGS = $(KDE_RPATH) $(all_libraries)
+# Normally you would write -lkunittestgui 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 = ../../libkunittestgui.la
+
+noinst_HEADERS = sampletest.h
+
+TESTS = sampletests
+
+guicheck: sampletestsgui
+ kunittest ./sampletestsgui SampleTests
diff --git a/kunittest/example/simple/main.cpp b/kunittest/example/simple/main.cpp
new file mode 100644
index 00000000..a750587c
--- /dev/null
+++ b/kunittest/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 "kunittest/runner.h"
+
+int main( int /*argc*/, char** /*argv*/ )
+{
+ KUnitTest::Runner::self()->runTests();
+ return KUnitTest::Runner::self()->numberOfFailedTests();
+}
diff --git a/kunittest/example/simple/maingui.cpp b/kunittest/example/simple/maingui.cpp
new file mode 100644
index 00000000..63e8cfd9
--- /dev/null
+++ b/kunittest/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 "kunittest/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 )
+{
+ KAboutData about("SampleTests", I18N_NOOP("SampleTests"), version, description,
+ KAboutData::License_BSD, "(C) 2005 Jeroen Wijnhout", 0, 0,
+ "Jeroen.Wijnhout@kdemail.net");
+
+ KCmdLineArgs::init(argc, argv, &about);
+ KCmdLineArgs::addCmdLineOptions( options );
+
+ KApplication app;
+
+ KUnitTest::RunnerGUI runner(0);
+ runner.show();
+ app.setMainWidget(&runner);
+
+ return app.exec();
+}
diff --git a/kunittest/example/simple/sampletest.cpp b/kunittest/example/simple/sampletest.cpp
new file mode 100644
index 00000000..32d97703
--- /dev/null
+++ b/kunittest/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 <qstringlist.h>
+
+#include <kdebug.h>
+#include <kunittest/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( QString("SimpleSample") , QString("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 );
+
+ QStringList testList;
+ testList << "one" << "two";
+ CHECK( testList.count() , (QStringList::size_type) 2 );
+}
diff --git a/kunittest/example/simple/sampletest.h b/kunittest/example/simple/sampletest.h
new file mode 100644
index 00000000..a4d85266
--- /dev/null
+++ b/kunittest/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 <kunittest/tester.h>
+
+class SimpleSampleTester : public KUnitTest::Tester
+{
+public:
+ void allTests();
+};
+
+class SomeSampleTester : public KUnitTest::Tester
+{
+public:
+ void allTests();
+};
+#endif
diff --git a/kunittest/guimodrunner.cpp b/kunittest/guimodrunner.cpp
new file mode 100644
index 00000000..08f47734
--- /dev/null
+++ b/kunittest/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."), "^kunittest_.*\\.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 )
+{
+ KInstance instance("modrunner");
+
+ KAboutData about("KUnitTestModRunner", I18N_NOOP("KUnitTestModRunner"), version, description,
+ KAboutData::License_BSD, "(C) 2005 Jeroen Wijnhout", 0, 0,
+ "Jeroen.Wijnhout@kdemail.net");
+
+ KCmdLineArgs::init(argc, argv, &about);
+ KCmdLineArgs::addCmdLineOptions( options );
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ KUnitTest::Runner::loadModules(args->getOption("folder"), args->getOption("query"));
+ KUnitTest::Runner::setDebugCapturingEnabled(args->isSet("enable-dbgcap"));
+
+ KApplication app;
+
+ KUnitTest::RunnerGUI runner(0);
+ runner.show();
+ app.setMainWidget(&runner);
+
+ return app.exec();
+}
diff --git a/kunittest/kunittest b/kunittest/kunittest
new file mode 100755
index 00000000..fbb8424f
--- /dev/null
+++ b/kunittest/kunittest
@@ -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 kunittest_debughelper`
+if [ -z $DEBUGHELPER ]
+then
+ kdialog --error "Sorry, couldn't find the kunittest_debughelper script."
+ exit 3
+fi
+
+$APP 2>&1 | perl $DEBUGHELPER "$DCOPNAME-*"
diff --git a/kunittest/kunittest_debughelper b/kunittest/kunittest_debughelper
new file mode 100755
index 00000000..66dfacf2
--- /dev/null
+++ b/kunittest/kunittest_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/kunittest/kunittestmod b/kunittest/kunittestmod
new file mode 100755
index 00000000..ba039844
--- /dev/null
+++ b/kunittest/kunittestmod
@@ -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 kunittestguimodrunner`
+if [ ! -x $APP ]
+then
+ kdialog --error "Sorry, $APP is not a valid executable file."
+ exit 1;
+fi
+
+DEBUGHELPER=`which kunittest_debughelper`
+if [ -z $DEBUGHELPER ]
+then
+ kdialog --error "Sorry, couldn't find the kunittest_debughelper script."
+ exit 3
+fi
+
+DCOPNAME="KUnitTestModRunner"
+$APP --enable-dbgcap $FOLDER $QUERY 2>&1 | perl $DEBUGHELPER "$DCOPNAME-*"
diff --git a/kunittest/runnergui.cpp b/kunittest/runnergui.cpp
new file mode 100644
index 00000000..ef5afe98
--- /dev/null
+++ b/kunittest/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 <qmetaobject.h>
+#include <qregexp.h>
+#include <qpushbutton.h>
+#include <qtextedit.h>
+#include <qlabel.h>
+#include <qprogressbar.h>
+#include <qcombobox.h>
+
+#include <dcopclient.h>
+#include <dcopobject.h>
+#include <kiconloader.h>
+#include <kdebug.h>
+#include <kmessagebox.h>
+
+#include <kunittest/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 QString &name, const QString &info)
+ {
+ Tester *tester = Runner::self()->registry().find(name.local8Bit());
+ if ( tester == 0L ) return false;
+
+ tester->results()->addDebugInfo(info);
+
+ return true;
+ }
+
+ bool addSlotDebugInfo(const QString &name, const QString &slt, const QString &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(QWidget *parent) : QHBox(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());
+ QStringList suites;
+ for ( ; it.current(); ++it )
+ {
+ addTester(it.currentKey(), it.current());
+
+ QString 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(QListView::Extended);
+ m_testerWidget->resultList()->setRootIsDecorated(true);
+ m_testerWidget->resultList()->setColumnAlignment(g_finishedColumn, Qt::AlignHCenter);
+ m_testerWidget->resultList()->setColumnAlignment(g_skippedColumn, Qt::AlignHCenter);
+ m_testerWidget->resultList()->setColumnAlignment(g_failedColumn, Qt::AlignHCenter);
+ m_testerWidget->resultList()->setColumnAlignment(g_xfailedColumn, Qt::AlignHCenter);
+ m_testerWidget->resultList()->setColumnAlignment(g_passedColumn, Qt::AlignHCenter);
+ m_testerWidget->resultList()->setColumnAlignment(g_xpassedColumn, Qt::AlignHCenter);
+
+ // set the text in the results label
+ fillResultsLabel();
+
+ // init the progress bar
+ configureProgressBar(Runner::self()->numberOfTestCases(), 0);
+
+ connect(Runner::self(), SIGNAL(finished(const char *, Tester *)), this, SLOT(addTestResult(const char *, Tester *)));
+ connect(m_testerWidget->resultList(), SIGNAL(clicked(QListViewItem *)), this, SLOT(showDetails(QListViewItem *)));
+ connect(m_testerWidget, SIGNAL(run()), this, SLOT(runSuite()));
+ connect(m_testerWidget->details(), SIGNAL(doubleClicked(int, int)), this, 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(
+ QString("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(QString("Test cases: %1").arg(Runner::self()->numberOfTestCases()));
+ }
+
+ void RunnerGUI::addTestResult(const char *name, Tester *test)
+ {
+ QStringList scopes = QStringList::split("::", name);
+ QString suite = scopes[0];
+
+ // find the suite item
+ QListViewItem *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());
+ QListViewItem *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)
+ {
+ QStringList scopes = QStringList::split("::", name);
+ QString suite = scopes[0];
+
+ // find the suite item
+ QListViewItem *item = 0L;
+ for ( uint i = 0; i < scopes.count(); ++i )
+ item = getItem(scopes[i], item);
+
+ if ( test->inherits("KUnitTest::SlotTester") )
+ {
+ QStrList allSlots = test->metaObject()->slotNames();
+ for ( char *sl = allSlots.first(); sl; sl = allSlots.next() )
+ {
+ if ( QString(sl).startsWith("test") )
+ getItem(sl, item);
+ }
+ }
+ }
+
+ QListViewItem *RunnerGUI::getItem(const QString &name, QListViewItem *item /*= 0L*/)
+ {
+ QListViewItem *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 QListViewItem(m_testerWidget->resultList());
+ else
+ item = new QListViewItem(parent);
+
+ item->setText(g_nameColumn, name);
+ }
+
+ return item;
+ }
+
+ void RunnerGUI::reset()
+ {
+ QListViewItemIterator it( m_testerWidget->resultList() );
+ while ( it.current() )
+ {
+ QListViewItem *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, QPixmap());
+ ++it;
+ }
+ }
+
+ void RunnerGUI::setSummary(QListViewItem *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, QString::number(val + res->testsFinished()));
+
+ val = item->text(g_skippedColumn).toInt(&ok); if (!ok) val = 0;
+ item->setText(g_skippedColumn, QString::number(val + res->skipped()));
+
+ val = item->text(g_passedColumn).toInt(&ok); if (!ok) val = 0;
+ item->setText(g_passedColumn, QString::number(val + res->passed()));
+
+ val = item->text(g_failedColumn).toInt(&ok); if (!ok) val = 0;
+ item->setText(g_failedColumn, QString::number(val + res->errors()));
+
+ val = item->text(g_xfailedColumn).toInt(&ok); if (!ok) val = 0;
+ item->setText(g_xfailedColumn, QString::number(val + res->xfails()));
+
+ val = item->text(g_xpassedColumn).toInt(&ok); if (!ok) val = 0;
+ item->setText(g_xpassedColumn, QString::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);
+ }
+
+ QString RunnerGUI::fullName(QListViewItem *item)
+ {
+ QString 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 )
+ {
+ QListViewItemIterator it( m_testerWidget->resultList() );
+ QStringList prefixes;
+ while ( it.current() )
+ {
+ QListViewItem *item = it.current();
+ if ( item->isSelected() )
+ {
+ QString 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
+ {
+ QString suite = m_testerWidget->selectCombo()->currentText();
+ QStringList tests;
+ RegistryIteratorType it(Runner::self()->registry());
+ for ( ; it.current(); ++it )
+ if ( QString(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(QListViewItem *item)
+ {
+ if ( item == 0L ) return;
+
+ QString 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
+ {
+ QTextEdit *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(QTextEdit *te, const QStringList &list)
+ {
+ for ( uint i = 0; i < list.count(); ++i )
+ te->append(list[i]);
+ }
+
+ void RunnerGUI::doubleClickedOnDetails(int para, int /*pos*/)
+ {
+ static QRegExp reFileAndLine("^(.*)\\[([0-9]+)\\]:");
+
+ QString 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();
+ QByteArray data;
+ QDataStream arg(data, IO_WriteOnly);
+ bool ok;
+ arg << QString(reFileAndLine.cap(1)) << (reFileAndLine.cap(2).toInt(&ok) - 1);
+ client.send("kdevelop-*", "KDevPartController", "editDocument(QString,int)", data);
+ client.send("kdevelop-*", "MainWindow", "raise()", "");
+
+ client.detach();
+ }
+ }
+}
+
+#include "runnergui.moc"
diff --git a/kunittest/runnergui.h b/kunittest/runnergui.h
new file mode 100644
index 00000000..dbd03666
--- /dev/null
+++ b/kunittest/runnergui.h
@@ -0,0 +1,78 @@
+/**
+ * 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 <qlistview.h>
+#include <qhbox.h>
+
+#include <kunittest/runner.h>
+#include <kunittest/tester.h>
+
+#include <kdemacros.h>
+
+class TesterWidget;
+class QTextEdit;
+
+namespace KUnitTest
+{
+ class RunnerGUIDCOPImpl;
+
+ class KDE_EXPORT RunnerGUI : public QHBox
+ {
+ Q_OBJECT
+
+ public:
+ RunnerGUI(QWidget *parent);
+ ~RunnerGUI();
+
+ private slots:
+ void addTestResult(const char *name, Tester *test);
+ void addTester(const char *name, Tester *test);
+ void showDetails(QListViewItem *item);
+ void runSuite();
+ void doubleClickedOnDetails(int para, int pos);
+
+ private:
+ void reset();
+ void configureProgressBar(int steps, int progress);
+ void fillResultsLabel();
+ void appendList(QTextEdit *te, const QStringList &list);
+
+ QListViewItem *getItem(const QString &name, QListViewItem *item = 0L);
+ void setItem(QListViewItem *item, const TestResults *res);
+ QString fullName(QListViewItem *item);
+
+ void setSummary(QListViewItem *item, TestResults *res);
+
+ TesterWidget *m_testerWidget;
+
+ friend class RunnerGUIDCOPImpl;
+ RunnerGUIDCOPImpl *m_dcop;
+ };
+}
+
+#endif
diff --git a/kunittest/testerwidget.ui b/kunittest/testerwidget.ui
new file mode 100644
index 00000000..61f74337
--- /dev/null
+++ b/kunittest/testerwidget.ui
@@ -0,0 +1,197 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>TesterWidget</class>
+<widget class="QWidget">
+ <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="QPushButton" row="0" column="2">
+ <property name="name">
+ <cstring>m_pshRun</cstring>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <widget class="QProgressBar" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>m_pbProgress</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" 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="QLabel" 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="QLabel" 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="QListView" 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="QTextEdit" 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>
+<signals>
+ <signal>run()</signal>
+</signals>
+<functions>
+ <function access="private" specifier="non virtual">init()</function>
+ <function returnType="QListView *">resultList()</function>
+ <function returnType="QTextEdit *">details()</function>
+ <function returnType="QProgressBar *">progressBar()</function>
+ <function returnType="QLabel *">resultsLabel()</function>
+ <function returnType="QComboBox *">selectCombo()</function>
+</functions>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kunittest/testerwidget.ui.h b/kunittest/testerwidget.ui.h
new file mode 100644
index 00000000..b895a357
--- /dev/null
+++ b/kunittest/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
+** Qt 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, SIGNAL(clicked()), this, SIGNAL(run()));
+}
+
+QListView * TesterWidget::resultList()
+{
+ return m_lvResults;
+}
+
+
+QTextEdit * TesterWidget::details()
+{
+ return m_teDetails;
+}
+
+
+QProgressBar * TesterWidget::progressBar()
+{
+ return m_pbProgress;
+}
+
+
+QLabel * TesterWidget::resultsLabel()
+{
+ return m_lbResults;
+}
+
+
+QComboBox * TesterWidget::selectCombo()
+{
+ return m_cbSelect;
+}