diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-26 13:17:59 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-26 13:17:59 -0600 |
commit | 1515a4f2eb9cf023ed7f9c2e10106b5e93164a08 (patch) | |
tree | d5617734090b254659ff331ce7d1e574c4807caf /kunittest | |
parent | f8069e2ea048f2657cc417d83820576ec55c181b (diff) | |
download | tdesdk-1515a4f2eb9cf023ed7f9c2e10106b5e93164a08.tar.gz tdesdk-1515a4f2eb9cf023ed7f9c2e10106b5e93164a08.zip |
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'kunittest')
26 files changed, 0 insertions, 1724 deletions
diff --git a/kunittest/CMakeLists.txt b/kunittest/CMakeLists.txt deleted file mode 100644 index 8eb4cae0..00000000 --- a/kunittest/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -################################################# -# -# (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}/kunittest ) - -install( PROGRAMS - kunittest kunittestmod kunittest_debughelper - DESTINATION ${BIN_INSTALL_DIR} ) - - -##### kunittestgui (shared) ##################### - -tde_add_library( kunittestgui SHARED AUTOMOC - SOURCES testerwidget.ui runnergui.cpp dcopinterface.skel - VERSION 0.0.0 - LINK kunittest-shared - DESTINATION ${LIB_INSTALL_DIR} -) - - -##### kunittestguimodrunner (executable) ######## - -tde_add_executable( kunittestguimodrunner - SOURCES guimodrunner.cpp - LINK kunittestgui-shared - DESTINATION ${BIN_INSTALL_DIR} -) diff --git a/kunittest/Makefile.am b/kunittest/Makefile.am deleted file mode 100644 index 5af6f67a..00000000 --- a/kunittest/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -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) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor -lkunittest -libkunittestgui_la_LIBADD = -lkunittest $(LIB_TDECORE) - -runnergui.lo : testerwidget.h - -bin_PROGRAMS = kunittestguimodrunner -kunittestguimodrunner_SOURCES = guimodrunner.cpp -kunittestguimodrunner_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor -lkunittest -kunittestguimodrunner_LDADD = libkunittestgui.la $(LIB_TDECORE) $(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 deleted file mode 100644 index 50f15d3d..00000000 --- a/kunittest/dcopinterface.h +++ /dev/null @@ -1,38 +0,0 @@ -/*************************************************************************** - * 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/kunittest/example/Makefile.am b/kunittest/example/Makefile.am deleted file mode 100644 index d008ca22..00000000 --- a/kunittest/example/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = simple module diff --git a/kunittest/example/module/Makefile.am b/kunittest/example/module/Makefile.am deleted file mode 100644 index 17404d06..00000000 --- a/kunittest/example/module/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100644 index fa17aa6c..00000000 --- a/kunittest/example/module/sampleextra.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 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( TQString("Extra") , TQString("Extra") ); -} diff --git a/kunittest/example/module/sampleextra.h b/kunittest/example/module/sampleextra.h deleted file mode 100644 index f27a6bd9..00000000 --- a/kunittest/example/module/sampleextra.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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 deleted file mode 100644 index 3b6665fd..00000000 --- a/kunittest/example/module/samplemodule.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 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 deleted file mode 100644 index b09002c6..00000000 --- a/kunittest/example/module/samplemodule.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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 deleted file mode 100644 index 672ec08a..00000000 --- a/kunittest/example/module/samplemodule2.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/** - * 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 <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( 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/kunittest/example/module/samplemodule2.h b/kunittest/example/module/samplemodule2.h deleted file mode 100644 index b09002c6..00000000 --- a/kunittest/example/module/samplemodule2.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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 deleted file mode 100644 index 89e7516a..00000000 --- a/kunittest/example/module/sampletests.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/** - * 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 <kunittest/runner.h> -#include <kunittest/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/kunittest/example/module/sampletests.h b/kunittest/example/module/sampletests.h deleted file mode 100644 index 08cc1ec0..00000000 --- a/kunittest/example/module/sampletests.h +++ /dev/null @@ -1,54 +0,0 @@ -/** - * 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(); - - TQString *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 deleted file mode 100644 index 5d7e3d57..00000000 --- a/kunittest/example/simple/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -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) -lktexteditor -sampletests_LDADD = -lkunittest - -sampletestsgui_SOURCES = maingui.cpp sampletest.cpp -sampletestsgui_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor -# 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 deleted file mode 100644 index a750587c..00000000 --- a/kunittest/example/simple/main.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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 deleted file mode 100644 index b292d780..00000000 --- a/kunittest/example/simple/maingui.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/** - * 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 ) -{ - 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/kunittest/example/simple/sampletest.cpp b/kunittest/example/simple/sampletest.cpp deleted file mode 100644 index 846d514f..00000000 --- a/kunittest/example/simple/sampletest.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/** - * 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 <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( 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/kunittest/example/simple/sampletest.h b/kunittest/example/simple/sampletest.h deleted file mode 100644 index a4d85266..00000000 --- a/kunittest/example/simple/sampletest.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * 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 deleted file mode 100644 index 11a3532b..00000000 --- a/kunittest/guimodrunner.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/** - * 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 ) -{ - 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/kunittest/kunittest b/kunittest/kunittest deleted file mode 100755 index fbb8424f..00000000 --- a/kunittest/kunittest +++ /dev/null @@ -1,19 +0,0 @@ -#!/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 deleted file mode 100755 index 66dfacf2..00000000 --- a/kunittest/kunittest_debughelper +++ /dev/null @@ -1,107 +0,0 @@ -#!/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 deleted file mode 100755 index ba039844..00000000 --- a/kunittest/kunittestmod +++ /dev/null @@ -1,37 +0,0 @@ -#!/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 deleted file mode 100644 index 7dc67e09..00000000 --- a/kunittest/runnergui.cpp +++ /dev/null @@ -1,433 +0,0 @@ -/** - * 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 <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 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/kunittest/runnergui.h b/kunittest/runnergui.h deleted file mode 100644 index dc1e5f2a..00000000 --- a/kunittest/runnergui.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * 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 <kunittest/runner.h> -#include <kunittest/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/kunittest/testerwidget.ui b/kunittest/testerwidget.ui deleted file mode 100644 index e6e92e1c..00000000 --- a/kunittest/testerwidget.ui +++ /dev/null @@ -1,197 +0,0 @@ -<!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/kunittest/testerwidget.ui.h b/kunittest/testerwidget.ui.h deleted file mode 100644 index f80a248d..00000000 --- a/kunittest/testerwidget.ui.h +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** 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; -} |