diff options
Diffstat (limited to 'libkdepim/komposer/core/tests')
-rw-r--r-- | libkdepim/komposer/core/tests/Makefile.am | 20 | ||||
-rw-r--r-- | libkdepim/komposer/core/tests/main.cpp | 52 | ||||
-rw-r--r-- | libkdepim/komposer/core/tests/managertest.cpp | 43 | ||||
-rw-r--r-- | libkdepim/komposer/core/tests/managertest.h | 45 | ||||
-rw-r--r-- | libkdepim/komposer/core/tests/tester.cpp | 30 | ||||
-rw-r--r-- | libkdepim/komposer/core/tests/tester.h | 71 | ||||
-rw-r--r-- | libkdepim/komposer/core/tests/testfactory.h | 71 | ||||
-rw-r--r-- | libkdepim/komposer/core/tests/testkomposer.cpp | 18 | ||||
-rw-r--r-- | libkdepim/komposer/core/tests/testmanager.cpp | 53 | ||||
-rw-r--r-- | libkdepim/komposer/core/tests/testmanager.h | 26 |
10 files changed, 0 insertions, 429 deletions
diff --git a/libkdepim/komposer/core/tests/Makefile.am b/libkdepim/komposer/core/tests/Makefile.am deleted file mode 100644 index fbf12795..00000000 --- a/libkdepim/komposer/core/tests/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -INCLUDES = -I$(top_builddir)/libtdepim/komposer/core $(all_includes) - -check_PROGRAMS = testfactory testmanager testkomposer - -METASOURCES = AUTO - -testfactory_SOURCES = main.cpp managertest.cpp -testfactory_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor -testfactory_LDADD = ../libkomposer.la - -testmanager_SOURCES = testmanager.cpp -testmanager_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor -testmanager_LDADD = ../libkomposer.la - -testkomposer_SOURCES = testkomposer.cpp -testkomposer_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor -testkomposer_LDADD = ../libkomposer.la - -check: testfactory - @./testfactory 2>&1 | grep "tests:" diff --git a/libkdepim/komposer/core/tests/main.cpp b/libkdepim/komposer/core/tests/main.cpp deleted file mode 100644 index 4a33a2f1..00000000 --- a/libkdepim/komposer/core/tests/main.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/** - * main.cpp - * - * Copyright (C) 2004 Zack Rusin <zack@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ -#include "testfactory.h" -#include <kaboutdata.h> -#include <kapplication.h> -#include <kdebug.h> -#include <klocale.h> -#include <kcmdlineargs.h> - -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - - -static const KCmdLineOptions options[] = -{ - {"verbose", "Verbose output", 0}, - KCmdLineLastOption -}; -int main( int argc, char** argv ) -{ - KAboutData aboutData( "tests","Test","0.1" ); - KCmdLineArgs::init( argc, argv, &aboutData ); - KCmdLineArgs::addCmdLineOptions( options ); - - KApplication app; - - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - Q_UNUSED( args ); - - TestFactory t; - return t.runTests(); -} diff --git a/libkdepim/komposer/core/tests/managertest.cpp b/libkdepim/komposer/core/tests/managertest.cpp deleted file mode 100644 index 487a84c5..00000000 --- a/libkdepim/komposer/core/tests/managertest.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/** - * managertest.cpp - * - * Copyright (C) 2004 Zack Rusin <zack@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ -#include "managertest.h" - -#include "pluginmanager.h" -using namespace Komposer; - -ManagerTest::ManagerTest( TQObject* parent ) - : TQObject( parent ) -{ - m_manager = new PluginManager( this ); -} - - -void ManagerTest::allTests() -{ - CHECK( m_manager->availablePlugins().isEmpty(), true ); - CHECK( m_manager->loadedPlugins().empty(), true ); - CHECK( m_manager->plugin( "non-existing" ), ( Plugin* )0 ); - m_manager->loadAllPlugins(); - CHECK( m_manager->loadedPlugins().empty(), true ); - m_manager->shutdown(); -} - -#include "managertest.moc" diff --git a/libkdepim/komposer/core/tests/managertest.h b/libkdepim/komposer/core/tests/managertest.h deleted file mode 100644 index f02510e6..00000000 --- a/libkdepim/komposer/core/tests/managertest.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * managertest.h - * - * Copyright (C) 2004 Zack Rusin <zack@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ -#ifndef MANAGERTEST_H -#define MANAGERTEST_H - -#include <tqobject.h> -#include "tester.h" - -namespace Komposer { - class PluginManager; -} - -class ManagerTest : public TQObject, - public Tester -{ - Q_OBJECT - TQ_OBJECT -public: - ManagerTest( TQObject* parent = 0 ); - -public slots: - void allTests(); -private: - Komposer::PluginManager* m_manager; -}; - -#endif diff --git a/libkdepim/komposer/core/tests/tester.cpp b/libkdepim/komposer/core/tests/tester.cpp deleted file mode 100644 index b32c8964..00000000 --- a/libkdepim/komposer/core/tests/tester.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/** - * tester.cpp - * - * Copyright (C) 2004 Zack Rusin <zack@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ -#include "tester.h" - - -Tester::Tester( TQObject* parent ) - : TQObject( parent ) -{ -} - - -#include "tester.moc" diff --git a/libkdepim/komposer/core/tests/tester.h b/libkdepim/komposer/core/tests/tester.h deleted file mode 100644 index 5981d681..00000000 --- a/libkdepim/komposer/core/tests/tester.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * tester.h - * - * Copyright (C) 2004 Zack Rusin <zack@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ -#ifndef TESTER_H -#define TESTER_H - -#include <kdebug.h> -#include <tqstringlist.h> - -#define CHECK( x, y ) check( __FILE__, __LINE__, #x, x, y ) - -class Tester -{ -public: - Tester() : m_tests( 0 ) {} - virtual ~Tester() {} - -public: - virtual void allTests() = 0; - -public: - int testsFinished() const { - return m_tests; - } - int testsFailed() const { - return m_errorList.count(); - } - TQStringList errorList() const { - return m_errorList; - } - -protected: - template<typename T> - void check( const char* file, int line, const char* str, - const T& result, const T& expectedResult ) - { - if ( result != expectedResult ) { - TQString error; - TQTextStream ts( &error, IO_WriteOnly ); - ts << file << "["<< line <<"]:" - <<" failed on \""<< str <<"\"" - << "\ntests:\t\t result = " - << result - << ", expected = "<< expectedResult; - m_errorList.append( error ); - } - ++m_tests; - } -private: - TQStringList m_errorList; - int m_tests; -}; - -#endif diff --git a/libkdepim/komposer/core/tests/testfactory.h b/libkdepim/komposer/core/tests/testfactory.h deleted file mode 100644 index 9354e52a..00000000 --- a/libkdepim/komposer/core/tests/testfactory.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * testfactory.h - * - * Copyright (C) 2004 Zack Rusin <zack@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ -#ifndef TESTFACTORY_H -#define TESTFACTORY_H - -#include "managertest.h" - -#include <tqasciidict.h> - -#define ADD_TEST(x) addTest( #x, new x ) - -class TestFactory -{ -public: - TestFactory() - { - ADD_TEST( ManagerTest ); - m_tests.setAutoDelete( true ); - } - - int runTests() - { - int result = 0; - kdDebug()<<"Running tests..."<<endl; - TQAsciiDictIterator<Tester> it( m_tests ); - for( ; it.current(); ++it ) { - Tester* test = it.current(); - test->allTests(); - TQStringList errorList = test->errorList(); - if ( !errorList.empty() ) { - ++result; - kdDebug()<< it.currentKey() <<" errors:" << endl; - for ( TQStringList::Iterator itr = errorList.begin(); - itr != errorList.end(); ++itr ) { - kdDebug()<< "\t" << (*itr).latin1() <<endl;; - } - } else { - kdDebug()<< it.currentKey()<< " OK "<<endl; - } - } - kdDebug()<< "Done" <<endl; - return result; - } -public: - void addTest( const char* name, Tester* test ) - { - m_tests.insert( name, test ); - } -private: - TQAsciiDict<Tester> m_tests; -}; - -#endif diff --git a/libkdepim/komposer/core/tests/testkomposer.cpp b/libkdepim/komposer/core/tests/testkomposer.cpp deleted file mode 100644 index b7997e8c..00000000 --- a/libkdepim/komposer/core/tests/testkomposer.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "core.h" - -#include <kplugininfo.h> -#include <kcmdlineargs.h> -#include <kapplication.h> -#include <kdebug.h> - -int main( int argc, char **argv ) -{ - KCmdLineArgs::init( argc, argv, "test", "test", "test", "0.1" ); - KApplication app; - - Komposer::Core *core = new Komposer::Core(); - app.setMainWidget( core ); - core->show(); - - return app.exec(); -} diff --git a/libkdepim/komposer/core/tests/testmanager.cpp b/libkdepim/komposer/core/tests/testmanager.cpp deleted file mode 100644 index 0fcba16b..00000000 --- a/libkdepim/komposer/core/tests/testmanager.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "testmanager.h" -#include "testmanager.moc" - -#include "pluginmanager.h" -#include "plugin.h" - -#include <kplugininfo.h> -#include <kcmdlineargs.h> -#include <kapplication.h> -#include <kdebug.h> - -using namespace Komposer; - -TestManager::TestManager( TQObject *parent ) - : TQObject( parent ) -{ - m_manager = new PluginManager( this ); - connect( m_manager, TQT_SIGNAL(pluginLoaded(Plugin*)), - TQT_SLOT(slotPluginLoaded(Plugin*)) ); - connect( m_manager, TQT_SIGNAL(allPluginsLoaded()), - TQT_SLOT(slotAllPluginsLoaded()) ); - m_manager->loadAllPlugins(); - - TQValueList<KPluginInfo*> plugins = m_manager->availablePlugins(); - kdDebug()<<"Number of available plugins is "<< plugins.count() <<endl; - for ( TQValueList<KPluginInfo*>::iterator it = plugins.begin(); it != plugins.end(); ++it ) { - KPluginInfo *i = ( *it ); - kdDebug()<<"\tAvailable plugin "<< i->name() - <<", comment = "<< i->comment() <<endl; - } -} - -void TestManager::slotAllPluginsLoaded() -{ - kdDebug()<<"Done"<<endl; - m_manager->shutdown(); - tqApp->exit(); -} - -void TestManager::slotPluginLoaded( Plugin *plugin ) -{ - kdDebug()<<"A plugin "<< m_manager->pluginName( plugin ) << " has been loaded"<<endl; -} - -int main( int argc, char **argv ) -{ - KCmdLineArgs::init( argc, argv, "test", "test", "test", "0.1" ); - KApplication app; - - TestManager manager( &app ); - - return app.exec(); -} diff --git a/libkdepim/komposer/core/tests/testmanager.h b/libkdepim/komposer/core/tests/testmanager.h deleted file mode 100644 index 5dfaa15d..00000000 --- a/libkdepim/komposer/core/tests/testmanager.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef TESTMANAGER_H -#define TESTMANAGER_H - -#include <tqobject.h> - -namespace Komposer { - class Plugin; - class PluginManager; -} -using Komposer::Plugin; - -class TestManager : public TQObject -{ - Q_OBJECT - TQ_OBJECT -public: - TestManager( TQObject *parent ); - -public slots: - void slotPluginLoaded( Plugin *plugin ); - void slotAllPluginsLoaded(); -private: - Komposer::PluginManager *m_manager; -}; - -#endif |