summaryrefslogtreecommitdiffstats
path: root/libkdepim/tests
diff options
context:
space:
mode:
Diffstat (limited to 'libkdepim/tests')
-rw-r--r--libkdepim/tests/Makefile.am35
-rw-r--r--libkdepim/tests/myconfig.kcfgc11
-rw-r--r--libkdepim/tests/propagator_test.kcfg44
-rw-r--r--libkdepim/tests/test_kregexp.cpp16
-rw-r--r--libkdepim/tests/testaddresseelineedit.cpp44
-rw-r--r--libkdepim/tests/testaddresseeselector.cpp52
-rw-r--r--libkdepim/tests/testdateedit.cpp68
-rw-r--r--libkdepim/tests/testdateedit.h39
-rw-r--r--libkdepim/tests/testdistrlist.cpp332
-rw-r--r--libkdepim/tests/testdistrlist.h47
-rw-r--r--libkdepim/tests/testkincidencechooser.cpp45
-rw-r--r--libkdepim/tests/testlinklocator.cpp114
-rw-r--r--libkdepim/tests/testutf7decoder.cpp26
-rw-r--r--libkdepim/tests/testutf7encoder.cpp93
-rw-r--r--libkdepim/tests/testutf7encoder2.cpp45
-rw-r--r--libkdepim/tests/testwizard.cpp100
16 files changed, 0 insertions, 1111 deletions
diff --git a/libkdepim/tests/Makefile.am b/libkdepim/tests/Makefile.am
deleted file mode 100644
index 217676cae..000000000
--- a/libkdepim/tests/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-AM_CPPFLAGS = -I$(top_builddir)/libtdepim -I$(top_srcdir)/libtdepim -I$(top_srcdir)/libemailfunctions $(all_includes)
-AM_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor
-LDADD = ../libtdepim.la $(LIB_KDECORE)
-
-check_PROGRAMS = testwizard testaddresseelineedit \
- testaddresseeselector \
- testutf7decoder \
- testutf7encoder \
- test_kregexp \
- testdateedit \
- testlinklocator \
- testkincidencechooser
-
-# disabled because of X dependency
-# testdistrlist
-
-testwizard_SOURCES = testwizard.cpp myconfig.kcfgc
-testaddresseelineedit_SOURCES = testaddresseelineedit.cpp
-testaddresseeselector_SOURCES = testaddresseeselector.cpp
-testutf7encoder_SOURCES = testutf7encoder2.cpp
-testutf7decoder_SOURCES = testutf7decoder.cpp
-test_kregexp_SOURCES = test_kregexp.cpp
-testdateedit_SOURCES = testdateedit.cpp
-testlinklocator_SOURCES = testlinklocator.cpp
-#testdistrlist_SOURCES = testdistrlist.cpp
-testkincidencechooser_SOURCES = testkincidencechooser.cpp
-
-#TESTS = testdistrlist
-
-METASOURCES = AUTO
-
-#example_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor
-#example_LDADD = ../libtdepim.la $(LIB_KDECORE)
-#example_SOURCES = example.cpp exampleprefs_base.kcfgc
-
diff --git a/libkdepim/tests/myconfig.kcfgc b/libkdepim/tests/myconfig.kcfgc
deleted file mode 100644
index 35e26c996..000000000
--- a/libkdepim/tests/myconfig.kcfgc
+++ /dev/null
@@ -1,11 +0,0 @@
-# Code generation options for kconfig_compiler
-File=propagator_test.kcfg
-ClassName=MyConfig
-Singleton=true
-Mutators=true
-#Inherits=KPimPrefs
-#IncludeFiles=libtdepim/kpimprefs.h
-MemberVariables=public
-GlobalEnums=true
-ItemAccessors=true
-SetUserTexts=true
diff --git a/libkdepim/tests/propagator_test.kcfg b/libkdepim/tests/propagator_test.kcfg
deleted file mode 100644
index 8fc971771..000000000
--- a/libkdepim/tests/propagator_test.kcfg
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
- http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
- <kcfgfile name="testwizardrc"/>
-
- <group name="MySettings">
- <entry name="FixKMail" type="Bool">
- <label>Fix KMail</label>
- <default>true</default>
- </entry>
- <entry name="BreakKMail" type="Bool">
- <label>Fix KMail</label>
- <default>false</default>
- </entry>
- <entry name="DisableDefaultSigning" type="Int">
- <default>0</default>
- </entry>
- <entry name="EnableDefaultSigning" type="Int">
- <default>1</default>
- </entry>
- <entry name="ThisIsAString" type="String">
- <default>hallo</default>
- </entry>
- </group>
-
- <condition key="testwizardrc/MySettings/FixKMail" value="true">
- <propagation source="testwizardrc/MySettings/DisableDefaultSigning"
- target="kmailrc/CryptPlug #0/SignEmail" />
- </condition>
-
- <condition key="testwizardrc/MySettings/BreakKMail" value="true">
- <propagation source="testwizardrc/MySettings/EnableDefaultSigning"
- target="kmailrc/CryptPlug #0/SignEmail" />
- </condition>
-
- <propagation source="file1/group1/entry1" target="file2/group2/entry2" />
- <propagation source="file1/group1/entry3" target="file2/group2/entry4" />
- <condition key="myfile/mygroup/myentry" value="123">
- <propagation source="file1/group1/entry1" target="filex/groupx/entryx" />
- </condition>
-
-</kcfg>
diff --git a/libkdepim/tests/test_kregexp.cpp b/libkdepim/tests/test_kregexp.cpp
deleted file mode 100644
index 511687d07..000000000
--- a/libkdepim/tests/test_kregexp.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <kregexp3.h>
-#include <kdebug.h>
-#include <kinstance.h>
-
-int
-main()
-{
- KInstance app("# ");
-
- // test for http://bugs.kde.org/show_bug.cgi?id=54886
- KRegExp3 reg("^");
- TQString res = reg.replace(TQString::tqfromLatin1("Fun stuff"),
- TQString::tqfromLatin1("[fun] "));
- kdDebug() << res << endl;
-
-}
diff --git a/libkdepim/tests/testaddresseelineedit.cpp b/libkdepim/tests/testaddresseelineedit.cpp
deleted file mode 100644
index 12eb3c6b1..000000000
--- a/libkdepim/tests/testaddresseelineedit.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- This file is part of libtdepim.
-
- Copyright (c) 2004 Daniel Molkentin <danimo@klaralvdalens-datakonsult.se>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <kaboutdata.h>
-#include <kapplication.h>
-#include <kdebug.h>
-#include <klocale.h>
-#include <kcmdlineargs.h>
-
-#include "../addresseelineedit.h"
-
-int main(int argc, char* argv[])
-{
- KAboutData aboutData("testaddresseelineedit","Test AddresseeLineEdit","0.1");
- KCmdLineArgs::init(argc,argv,&aboutData);
-
- KApplication app;
-
- KPIM::AddresseeLineEdit *kale = new KPIM::AddresseeLineEdit(0);
- kale->resize( 400, 20 );
- kale->show();
-
- return app.exec();
-
-}
-
diff --git a/libkdepim/tests/testaddresseeselector.cpp b/libkdepim/tests/testaddresseeselector.cpp
deleted file mode 100644
index 6b910e4b9..000000000
--- a/libkdepim/tests/testaddresseeselector.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- This file is part of libtdepim.
-
- Copyright (c) 2004 Daniel Molkentin <danimo@klaralvdalens-datakonsult.se>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <kaboutdata.h>
-#include <kapplication.h>
-#include <kdebug.h>
-#include <klocale.h>
-#include <kcmdlineargs.h>
-
-#include "../addresseeselector.h"
-#include "../addresseeemailselection.h"
-
-int main( int argc, char **argv )
-{
- KAboutData aboutData( "testaddresseeseletor", "Test AddresseeSelector", "0.1" );
- KCmdLineArgs::init( argc, argv, &aboutData );
-
- KApplication app;
-
- KPIM::AddresseeEmailSelection selection;
-
- KPIM::AddresseeSelectorDialog dlg( &selection );
- dlg.exec();
-
- kdDebug() << "to: " << selection.to() << endl;
- kdDebug() << "cc: " << selection.cc() << endl;
- kdDebug() << "bcc: " << selection.bcc() << endl;
-
- kdDebug() << "toDistlists: " << selection.toDistributionLists() << endl;
- kdDebug() << "ccDistlists: " << selection.ccDistributionLists() << endl;
- kdDebug() << "bccDistlists: " << selection.bccDistributionLists() << endl;
-
- return 0;
-}
diff --git a/libkdepim/tests/testdateedit.cpp b/libkdepim/tests/testdateedit.cpp
deleted file mode 100644
index 46fabcfe1..000000000
--- a/libkdepim/tests/testdateedit.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- This file is part of libtdepim.
-
- Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <tqlayout.h>
-
-#include <kaboutdata.h>
-#include <kapplication.h>
-#include <kcmdlineargs.h>
-#include <kdebug.h>
-#include <klocale.h>
-
-#include "kdateedit.h"
-
-#include "testdateedit.h"
-
-DateEdit::DateEdit( TQWidget *parent, const char *name )
- : TQWidget( parent, name )
-{
- TQVBoxLayout *tqlayout = new TQVBoxLayout( this );
-
- KDateEdit *edit = new KDateEdit( this );
- tqlayout->addWidget( edit );
-
- connect( edit, TQT_SIGNAL( dateChanged( const TQDate& ) ),
- this, TQT_SLOT( dateChanged( const TQDate& ) ) );
-}
-
-void DateEdit::dateChanged( const TQDate &date )
-{
- if ( date.isValid() )
- qDebug( "%s", date.toString().latin1() );
- else
- qDebug( "invalid date entered" );
-}
-
-int main(int argc,char **argv)
-{
- KAboutData aboutData( "testdateedit", "Test KDateEdit", "0.1" );
- KCmdLineArgs::init( argc, argv, &aboutData );
-
- KApplication app;
-
- DateEdit dateEdit;
- app.setMainWidget( &dateEdit );
- dateEdit.show();
-
- app.exec();
-}
-
-#include "testdateedit.moc"
diff --git a/libkdepim/tests/testdateedit.h b/libkdepim/tests/testdateedit.h
deleted file mode 100644
index 8693ffa00..000000000
--- a/libkdepim/tests/testdateedit.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- This file is part of libtdepim.
-
- Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef TESTDATEEDIT_H
-#define TESTDATEEDIT_H
-
-#include <tqwidget.h>
-
-class DateEdit : public TQWidget
-{
- Q_OBJECT
- TQ_OBJECT
-
- public:
- DateEdit( TQWidget *parent = 0, const char *name = 0 );
-
- public slots:
- void dateChanged( const TQDate& );
-};
-
-#endif
diff --git a/libkdepim/tests/testdistrlist.cpp b/libkdepim/tests/testdistrlist.cpp
deleted file mode 100644
index f588f9a93..000000000
--- a/libkdepim/tests/testdistrlist.cpp
+++ /dev/null
@@ -1,332 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2004 David Faure <faure@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License version 2 as published by the Free Software Foundation.
-
- 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "testdistrlist.h"
-
-#include <distributionlist.h>
-using KPIM::DistributionList;
-
-#include <config.h>
-
-#include <kabc/stdaddressbook.h>
-#include <kurl.h>
-#include <kapplication.h>
-#include <kio/netaccess.h>
-#include <kio/job.h>
-#include <kdebug.h>
-#include <kcmdlineargs.h>
-
-#include <tqdir.h>
-#include <tqfileinfo.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <assert.h>
-
-int main(int argc, char *argv[])
-{
- // Use another directory than the real one, just to keep things clean
- // KDEHOME needs to be writable though, for a ksycoca database
- setenv( "KDEHOME", TQFile::encodeName( TQDir::homeDirPath() + "/.kde-testdistrlist" ), true );
- setenv( "KDE_FORK_SLAVES", "yes", true ); // simpler, for the final cleanup
-
- KApplication::disableAutoDcopRegistration();
- KCmdLineArgs::init(argc,argv,"testdistrlist", 0, 0, 0, 0);
- KApplication app( false, false );
-
- TestDistrList test;
- test.setup();
- test.runAll();
- test.cleanup();
- kdDebug() << "All tests OK." << endl;
- return 0;
-}
-
-void TestDistrList::setup()
-{
- // We need a std addressbook
- KABC::AddressBook *ab = KABC::StdAddressBook::self();
- KABC::StdAddressBook::setAutomaticSave( false );
-
- // and two contacts
- KABC::Addressee addr1;
- addr1.setName( "addr1" );
- addr1.setFormattedName( "addr1" );
- addr1.insertEmail( "addr1@kde.org", true );
- addr1.insertEmail( "addr1-alternate@kde.org" );
- ab->insertAddressee( addr1 );
- assert( addr1.emails().count() == 2 );
-
- KABC::Addressee addr2;
- addr2.setName( "addr2" );
- addr2.insertEmail( "addr2@kde.org", true );
- addr2.insertEmail( "addr2-alternate@kde.org" );
- ab->insertAddressee( addr2 );
- assert( addr2.emails().count() == 2 );
-
- assert( !ab->findByName( "addr1" ).isEmpty() );
- assert( !ab->findByName( "addr2" ).isEmpty() );
-}
-
-void TestDistrList::runAll()
-{
- testEmpty();
- testNewList();
- testInsertEntry();
- testRemoveEntry();
- testDuplicate();
- testDeleteList();
-}
-
-bool TestDistrList::check(const TQString& txt, TQString a, TQString b)
-{
- if (a.isEmpty())
- a = TQString();
- if (b.isEmpty())
- b = TQString();
- if (a == b) {
- kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl;
- }
- else {
- kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "KO !" << endl;
- cleanup();
- exit(1);
- }
- return true;
-}
-
-// taken from KMail
-#include <sys/types.h>
-#include <dirent.h>
-static bool removeDirAndContentsRecursively( const TQString & path )
-{
- kdDebug() << k_funcinfo << path << endl;
- bool success = true;
-
- TQDir d;
- d.setPath( path );
- d.setFilter( TQDir::Files | TQDir::Dirs | TQDir::Hidden );
-
- const TQFileInfoList *list = d.entryInfoList();
- TQFileInfoListIterator it( *list );
- TQFileInfo *fi;
-
- while ( (fi = it.current()) != 0 ) {
- if( fi->isDir() && !fi->isSymLink() ) {
- if ( fi->fileName() != "." && fi->fileName() != ".." )
- success = success && removeDirAndContentsRecursively( fi->absFilePath() );
- } else {
- success = success && d.remove( fi->absFilePath() );
- }
- ++it;
- }
-
- if ( success ) {
- success = success && d.rmdir( path ); // nuke ourselves, we should be empty now
- }
- return success;
-}
-
-void TestDistrList::cleanup()
-{
- kdDebug() << k_funcinfo << endl;
- KABC::AddressBook *ab = KABC::StdAddressBook::self();
- ab->clear();
- KABC::StdAddressBook::close();
-
- TQString kdehome = TQFile::decodeName( getenv("KDEHOME") );
- KURL urlkdehome; urlkdehome.setPath( kdehome );
- // don't use KIO::NetAccess here since it needs X
- // KIO::NetAccess::del( urlkdehome, 0 )i;
- assert( removeDirAndContentsRecursively( kdehome ) );
-}
-
-void TestDistrList::testEmpty()
-{
- kdDebug() << k_funcinfo << endl;
- DistributionList dl;
- assert( dl.isEmpty() );
-}
-
-void TestDistrList::testNewList()
-{
- kdDebug() << k_funcinfo << endl;
- DistributionList dl;
- dl.setName( "foo" );
- assert( !dl.isEmpty() );
- check( "name set", dl.formattedName(), "foo" );
- assert( DistributionList::isDistributionList( dl ) );
-
- KABC::AddressBook *ab = KABC::StdAddressBook::self();
- ab->insertAddressee( dl );
-#if 0 // can't do that until we have KABC::AddressBook::findByFormattedName, or we use setName()
- KABC::Addressee::List addrList = ab->findByName( "foo" );
- assert( addrList.count() == 1 );
- KABC::Addressee addr = addrList.first();
- assert( !addr.isEmpty() );
- check( "correct name", addr.name(), "foo" );
- assert( DistributionList::isDistributionList( addr ) );
-#else
- KABC::Addressee addr = dl;
-#endif
-
- DistributionList dl2 = DistributionList::findByName( ab, "foo" );
- assert( !dl2.isEmpty() );
- check( "correct name", dl2.formattedName(), "foo" );
- assert( DistributionList::isDistributionList( dl2 ) );
-
- // Test the ctor that takes an addressee
- DistributionList dl3( addr );
- assert( !dl3.isEmpty() );
- assert( DistributionList::isDistributionList( dl3 ) );
- check( "correct name", dl3.formattedName(), "foo" );
-}
-
-void TestDistrList::testInsertEntry()
-{
- kdDebug() << k_funcinfo << endl;
- KABC::AddressBook *ab = KABC::StdAddressBook::self();
- DistributionList dl = DistributionList::findByName( ab, "foo" );
- assert( !dl.isEmpty() );
-
-#if 0 // the usual method
- KABC::Addressee addr1 = ab->findByName( "addr1" ).first();
- assert( !addr1.isEmpty() );
- dl.insertEntry( addr1 );
-#else // the kolab-resource method
- dl.insertEntry( "addr1" );
-#endif
-
- KABC::Addressee addr2 = ab->findByName( "addr2" ).first();
- assert( !addr2.isEmpty() );
- dl.insertEntry( addr2, "addr2-alternate@kde.org" );
-
- // Try inserting it again, should do nothing
- dl.insertEntry( addr2, "addr2-alternate@kde.org" );
-
- // And insert it with another email address
- dl.insertEntry( addr2, "addr2@kde.org" );
-
- // Test entries()
- DistributionList::Entry::List entries = dl.entries( ab );
- check( "entries count", TQString::number( entries.count() ), "3" );
- check( "first entry", entries[0].addressee.name(), "addr1" );
- check( "first entry", entries[0].email, TQString() );
- check( "second entry", entries[1].addressee.name(), "addr2" );
- check( "second entry", entries[1].email, "addr2-alternate@kde.org" );
- check( "third entry", entries[2].addressee.name(), "addr2" );
- check( "third entry", entries[2].email, "addr2@kde.org" );
-
- // Test emails()
- TQStringList emails = dl.emails( ab );
- kdDebug() << emails << endl;
- assert( emails.count() == 3 );
- check( "first email", emails[0], "addr1 <addr1@kde.org>" );
- check( "second email", emails[1], "addr2 <addr2-alternate@kde.org>" );
- check( "third email", emails[2], "addr2 <addr2@kde.org>" );
-
- // Commit changes to the addressbook !!
- ab->insertAddressee( dl );
-}
-
-void TestDistrList::testRemoveEntry()
-{
- kdDebug() << k_funcinfo << endl;
- KABC::AddressBook *ab = KABC::StdAddressBook::self();
- DistributionList dl = DistributionList::findByName( ab, "foo" );
- assert( !dl.isEmpty() );
- DistributionList::Entry::List entries = dl.entries( ab );
- check( "entries count before removeEntry", TQString::number( entries.count() ), "3" );
-
- // Removing an empty entry shouldn't do anything
- dl.removeEntry( KABC::Addressee() );
- check( "entries count after removing empty entry", TQString::number( dl.entries(ab).count() ), "3" );
-
- KABC::Addressee addr1 = ab->findByName( "addr1" ).first();
- assert( !addr1.isEmpty() );
- // Removing an entry with the wrong email passed, shouldn't do anything
- dl.removeEntry( addr1, "foo@foobar.com" );
- check( "entries count after removing entry with invalid email", TQString::number( dl.entries(ab).count() ), "3" );
-
- // Now remove entry correctly
- dl.removeEntry( addr1 );
- check( "removeEntry(addr1) worked", TQString::number( dl.entries(ab).count() ), "2" );
- TQStringList emails = dl.emails( ab );
- assert( emails.count() == 2 );
- check( "first email", emails[0], "addr2 <addr2-alternate@kde.org>" );
-
- // Now move on to addr2. First remove with no or a wrong email (nothing should happen)
- KABC::Addressee addr2 = ab->findByName( "addr2" ).first();
- assert( !addr2.isEmpty() );
- dl.removeEntry( addr2 );
- check( "entries count after removing entry with no email", TQString::number( dl.entries(ab).count() ), "2" );
-
- // Now remove addr2 correctly
- dl.removeEntry( addr2, "addr2@kde.org" );
- check( "entries count after removing addr2", TQString::number( dl.entries(ab).count() ), "1" );
- dl.removeEntry( addr2, "addr2-alternate@kde.org" );
- check( "entries count after removing alternate addr2", TQString::number( dl.entries(ab).count() ), "0" );
- assert( dl.entries(ab).isEmpty() );
- assert( dl.emails(ab).isEmpty() );
- assert( DistributionList::isDistributionList( dl ) );
-
- ab->insertAddressee( dl );
-}
-
-void TestDistrList::testDuplicate()
-{
- kdDebug() << k_funcinfo << endl;
- // This is a special test for the case where we have a contact and a distr list with the same name
- KABC::AddressBook *ab = KABC::StdAddressBook::self();
- KABC::Addressee addr;
- addr.setName( "foo" );
- addr.insertEmail( "foo@kde.org", true );
- ab->insertAddressee( addr );
-
-#if 0 // we need a findByFormattedName
- KABC::Addressee::List addrList = ab->findByName( "foo" );
- assert( addrList.count() == 2 );
-
- bool a = DistributionList::isDistributionList( addrList.first() );
- bool b = DistributionList::isDistributionList( addrList.last() );
- // one is a distr list, but not both
- assert( a || b );
- //
- assert( ! ( a && b ) );
-#endif
-
- DistributionList dl = DistributionList::findByName( ab, "foo" );
- assert( !dl.isEmpty() );
- assert( DistributionList::isDistributionList( dl ) );
- assert( dl.formattedName() == "foo" );
-}
-
-void TestDistrList::testDeleteList()
-{
- kdDebug() << k_funcinfo << endl;
-
- KABC::AddressBook *ab = KABC::StdAddressBook::self();
- DistributionList dl = DistributionList::findByName( ab, "foo" );
- assert( !dl.isEmpty() );
- ab->removeAddressee( dl );
- dl = DistributionList::findByName( ab, "foo" );
- assert( dl.isEmpty() );
-}
-
-#include "testdistrlist.moc"
diff --git a/libkdepim/tests/testdistrlist.h b/libkdepim/tests/testdistrlist.h
deleted file mode 100644
index 3f64527e6..000000000
--- a/libkdepim/tests/testdistrlist.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2004 David Faure <faure@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License version 2 as published by the Free Software Foundation.
-
- 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef TESTDISTRLIST_H
-#define TESTDISTRLIST_H
-
-#include <tqobject.h>
-
-class TestDistrList : public TQObject
-{
- Q_OBJECT
- TQ_OBJECT
-
-public:
- TestDistrList() {}
- void setup();
- void runAll();
- void cleanup();
-
- // tests
- void testEmpty();
- void testNewList();
- void testInsertEntry();
- void testRemoveEntry();
- void testDuplicate();
- void testDeleteList();
-
-private:
- bool check(const TQString& txt, TQString a, TQString b);
-};
-
-#endif
diff --git a/libkdepim/tests/testkincidencechooser.cpp b/libkdepim/tests/testkincidencechooser.cpp
deleted file mode 100644
index 1204f8dc2..000000000
--- a/libkdepim/tests/testkincidencechooser.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- Copyright (C) 2009 Allen Winter <winter@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <kapplication.h>
-#include <kcmdlineargs.h>
-#include <klocale.h>
-
-#include <libkcal/event.h>
-using namespace KCal;
-
-#include "kincidencechooser.h"
-using namespace KPIM;
-
-int main( int argc, char **argv )
-{
- KCmdLineArgs::init( argc, argv, "testkincidencechooser", 0,
- "KIncidenceChooserTest", "1.0",
- "kincidencechooser test app" );
- KApplication app;
- KIncidenceChooser *chooser = new KIncidenceChooser();
-
- Event event;
- event.setSummary( i18n( "Meeting" ) );
- event.setDescription( i18n( "Discuss foo" ) );
- chooser->setIncidence( &event, &event );
- chooser->resize( 600, 600 );
- chooser->show();
- return app.exec();
-}
diff --git a/libkdepim/tests/testlinklocator.cpp b/libkdepim/tests/testlinklocator.cpp
deleted file mode 100644
index 548f61a9b..000000000
--- a/libkdepim/tests/testlinklocator.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2005 Ingo Kloecker <kloecker@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License version 2 as published by the Free Software Foundation.
-
- 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-// Test program for libtdepim/linklocator.*
-#include <linklocator.h>
-
-#include <kcmdlineargs.h>
-#include <kapplication.h>
-#include <kdebug.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-static bool check(const TQString& txt, const TQString& a, const TQString& b)
-{
- if (a == b) {
- kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl;
- }
- else {
- kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "KO !" << endl;
- exit(1);
- }
- return true;
-}
-
-static bool checkGetEmailAddress( const TQString & input,
- int atPos,
- const TQString & expRetVal,
- bool allowBadAtPos = false )
-{
- if ( !allowBadAtPos && ( input[atPos] != '@' ) ) {
- kdDebug() << "atPos (" << atPos << ") doesn't point to '@' in \""
- << input << "\". Fix the check!" << endl;
- exit(1);
- }
- LinkLocator ll( input, atPos );
- const TQString retVal = ll.getEmailAddress();
- check( "getEmailAddress() \"" + input + "\", " + TQString::number( atPos ),
- retVal, expRetVal );
- return true;
-}
-
-int main(int argc, char *argv[])
-{
- KApplication::disableAutoDcopRegistration();
- KCmdLineArgs::init( argc, argv, "testlinklocator", 0, 0, 0, 0 );
- KApplication app( false, false );
-
- // empty input
- checkGetEmailAddress( TQString(), 0, TQString(), true );
-
- // no '@' at scan position
- checkGetEmailAddress( "foo@bar.baz", 0, TQString(), true );
-
- // '@' in local part
- checkGetEmailAddress( "foo@bar@bar.baz", 7, TQString() );
-
- // empty local part
- checkGetEmailAddress( "@bar.baz", 0, TQString() );
- checkGetEmailAddress( ".@bar.baz", 1, TQString() );
- checkGetEmailAddress( " @bar.baz", 1, TQString() );
- checkGetEmailAddress( ".!#$%&'*+-/=?^_`{|}~@bar.baz", strlen(".!#$%&'*+-/=?^_`{|}~"), TQString() );
-
- // allowed special chars in local part of address
- checkGetEmailAddress( "a.!#$%&'*+-/=?^_`{|}~@bar.baz", strlen("a.!#$%&'*+-/=?^_`{|}~"), "a.!#$%&'*+-/=?^_`{|}~@bar.baz" );
-
- // '@' in domain part
- checkGetEmailAddress( "foo@bar@bar.baz", 3, TQString() );
-
- // domain part without dot
- checkGetEmailAddress( "foo@bar", 3, TQString() );
- checkGetEmailAddress( "foo@bar.", 3, TQString() );
- checkGetEmailAddress( ".foo@bar", 4, TQString() );
- checkGetEmailAddress( "foo@bar ", 3, TQString() );
- checkGetEmailAddress( " foo@bar", 4, TQString() );
- checkGetEmailAddress( "foo@bar-bar", 3, TQString() );
-
- // empty domain part
- checkGetEmailAddress( "foo@", 3, TQString() );
- checkGetEmailAddress( "foo@.", 3, TQString() );
- checkGetEmailAddress( "foo@-", 3, TQString() );
-
- // simple address
- checkGetEmailAddress( "foo@bar.baz", 3, "foo@bar.baz" );
- checkGetEmailAddress( "foo@bar.baz.", 3, "foo@bar.baz" );
- checkGetEmailAddress( ".foo@bar.baz", 4, "foo@bar.baz" );
- checkGetEmailAddress( "foo@bar.baz-", 3, "foo@bar.baz" );
- checkGetEmailAddress( "-foo@bar.baz", 4, "foo@bar.baz" );
- checkGetEmailAddress( "foo@bar.baz ", 3, "foo@bar.baz" );
- checkGetEmailAddress( " foo@bar.baz", 4, "foo@bar.baz" );
- checkGetEmailAddress( "foo@bar-bar.baz", 3, "foo@bar-bar.baz" );
-
- printf("\nTest OK !\n");
-
- return 0;
-}
-
diff --git a/libkdepim/tests/testutf7decoder.cpp b/libkdepim/tests/testutf7decoder.cpp
deleted file mode 100644
index b13fb30c3..000000000
--- a/libkdepim/tests/testutf7decoder.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "qutf7codec.h"
-#include "qutf7codec.cpp"
-#include <tqtextstream.h>
-#include <string.h>
-#include <assert.h>
-
-int main( int argc, char * argv[] ) {
- if ( argc == 1 ) {
- (void)new TQUtf7Codec;
-
- TQTextCodec * codec = TQTextCodec::codecForName("utf-7");
- assert(codec);
-
- TQTextIStream my_cin(stdin);
- my_cin.setCodec(codec);
-
- TQTextOStream my_cout(stdout);
-
- TQString buffer = my_cin.read();
-
- my_cout << buffer;
- } else {
- qWarning("usage: testutf7decoder string_to_decode\n");
- }
- TQTextCodec::deleteAllCodecs();
-}
diff --git a/libkdepim/tests/testutf7encoder.cpp b/libkdepim/tests/testutf7encoder.cpp
deleted file mode 100644
index 2938cd660..000000000
--- a/libkdepim/tests/testutf7encoder.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-#include "qutf7codec.h"
-#include "qutf7codec.cpp"
-#include <iostream.h>
-#include <string.h>
-
-void main( int argc, char * argv[] ) {
- if ( argc == 2 ) {
- TQUtf7Codec * codec = new TQUtf7Codec;
-
- TQTextEncoder * enc;
-
- TQString arg = TQString::tqfromLatin1( argv[1] );
- int len;
-
- cout << "Original string:\n"
- << "\"" << argv[1] << "\"\n" << endl;
-
- cout << "Encode optional direct set and whitespace:\n" << endl;
- codec->setEncodeWhitespace(TRUE);
- codec->setEncodeOptionalDirect(TRUE);
- enc = codec->makeEncoder();
-
- len = arg.length();
- cout << (enc->fromUnicode( arg, len )).data()
- << "\n" << endl;
-
- cout << "Same as above, but call fromUnicode() char-wise:\n" << endl;
-
- delete enc;
- enc = codec->makeEncoder();
-
- for ( int i = 0 ; i < arg.length() ; i++ ) {
- len = 1;
- cout << (enc->fromUnicode( TQString(arg[i]), len )).data();
- }
- cout << "\n" << endl;
-
-
-
- delete enc;
-
- cout << "Encode optional direct set and not whitespace:\n" << endl;
- codec->setEncodeWhitespace(FALSE);
- codec->setEncodeOptionalDirect(TRUE);
- enc = codec->makeEncoder();
-
- len = arg.length();
- cout << (enc->fromUnicode( arg, len )).data()
- << "\n" << endl;
-
- delete enc;
-
-
- cout << "Don't encode optional direct set, but whitespace:\n" << endl;
- codec->setEncodeWhitespace(TRUE);
- codec->setEncodeOptionalDirect(FALSE);
- enc = codec->makeEncoder();
-
- len = arg.length();
- cout << (enc->fromUnicode( arg, len )).data()
- << "\n" << endl;
-
- delete enc;
-
-
- cout << "Encode neither optional direct set, nor whitespace:\n" << endl;
- codec->setEncodeWhitespace(FALSE);
- codec->setEncodeOptionalDirect(FALSE);
- enc = codec->makeEncoder();
-
- len = arg.length();
- cout << (enc->fromUnicode( arg, len )).data()
- << "\n" << endl;
-
- cout << "Same as above, but call fromUnicode() char-wise:\n" << endl;
-
- delete enc;
- enc = codec->makeEncoder();
-
- for ( int i = 0 ; i < arg.length() ; i++ ) {
- len = 1;
- cout << (enc->fromUnicode( TQString(arg[i]), len )).data();
- }
- cout << "\n" << endl;
-
-
- delete enc;
-
- delete codec;
- } else {
- qWarning("usage: testutf7encoder string_to_encode\n");
- }
-}
diff --git a/libkdepim/tests/testutf7encoder2.cpp b/libkdepim/tests/testutf7encoder2.cpp
deleted file mode 100644
index 65cf8b461..000000000
--- a/libkdepim/tests/testutf7encoder2.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "qutf7codec.h"
-#include "qutf7codec.cpp"
-#include <tqtextstream.h>
-#include <string.h>
-#include <assert.h>
-#include <iostream>
-
-int main( int argc, char * argv[] ) {
- if ( argc == 1 ) {
- (void)new TQUtf7Codec;
-
- TQTextCodec * codec = TQTextCodec::codecForName("utf-7");
- assert(codec);
-
- TQTextIStream my_cin(stdin);
-
- TQTextOStream my_cout(stdout);
- my_cout.setCodec(codec);
-
- TQString buffer = my_cin.read();
-
- // qDebug("buffer == " + buffer);
-
-#ifdef USE_STREAM
- my_cout << buffer << endl;
-#else
- TQTextEncoder * enc = codec->makeEncoder();
-#ifdef CHAR_WISE
- int len;
- for ( int i = 0 ; i < buffer.length() ; i++ ) {
- len = 1;
- cout << (enc->fromUnicode(TQString(buffer[i]),len)).data();
- }
- std::cout << std::endl;
-#else
- int len = buffer.length();
- std::cout << (enc->fromUnicode(buffer,len)).data() << std::endl;;
-#endif // CHAR_WISE
- delete enc;
-#endif // else USE_STREAM
- } else {
- qWarning("usage: testutf7encoder2 < infile > outfile\n");
- }
- TQTextCodec::deleteAllCodecs();
-}
diff --git a/libkdepim/tests/testwizard.cpp b/libkdepim/tests/testwizard.cpp
deleted file mode 100644
index d9c9d806c..000000000
--- a/libkdepim/tests/testwizard.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- This file is part of libtdepim.
-
- Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "myconfig.h"
-
-#include <kconfigwizard.h>
-
-#include <kaboutdata.h>
-#include <kapplication.h>
-#include <kdebug.h>
-#include <klocale.h>
-#include <kcmdlineargs.h>
-
-#include <tqlayout.h>
-#include <tqcheckbox.h>
-
-class TestConfigWizard : public KConfigWizard
-{
- public:
- TestConfigWizard() :
- KConfigWizard( new KConfigPropagator( MyConfig::self(),
- "propagator_test.kcfg" ) )
- {
- TQFrame *page = createWizardPage( "My Wizard Page" );
- TQBoxLayout *topLayout = new TQVBoxLayout( page );
-
- mFixKMailCheckBox = new TQCheckBox( i18n("Fix KMail"), page );
- topLayout->addWidget( mFixKMailCheckBox );
-
- mFixKMailCheckBox->setChecked( MyConfig::fixKMail() );
-
- mBreakKMailCheckBox = new TQCheckBox( i18n("Break KMail"), page );
- topLayout->addWidget( mBreakKMailCheckBox );
-
- mBreakKMailCheckBox->setChecked( MyConfig::breakKMail() );
-
- setupRulesPage();
- setupChangesPage();
- }
-
- ~TestConfigWizard()
- {
- }
-
- void usrReadConfig()
- {
- }
-
- void usrWriteConfig()
- {
- MyConfig::self()->setFixKMail( mFixKMailCheckBox->isChecked() );
- MyConfig::self()->setBreakKMail( mBreakKMailCheckBox->isChecked() );
- }
-
- private:
- TQCheckBox *mFixKMailCheckBox;
- TQCheckBox *mBreakKMailCheckBox;
-};
-
-static const KCmdLineOptions options[] =
-{
- {"verbose", "Verbose output", 0},
- KCmdLineLastOption
-};
-
-int main(int argc,char **argv)
-{
- KAboutData aboutData("testwizard","Test KConfigWizard","0.1");
- KCmdLineArgs::init(argc,argv,&aboutData);
- KCmdLineArgs::addCmdLineOptions( options );
-
- KApplication app;
-
- KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
-
- bool verbose = false;
- if ( args->isSet( "verbose" ) ) verbose = true;
-
- TestConfigWizard wizard;
-
- wizard.exec();
-}