summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kabc/CMakeLists.txt1
-rw-r--r--kabc/distributionlisteditor.h2
-rw-r--r--kabc/plugins/sql/resourcesql.cpp5
-rw-r--r--kabc/plugins/sql/resourcesql.h15
-rw-r--r--kabc/tests/CMakeLists.txt116
-rw-r--r--kabc/tests/testaddressfmt.cpp8
-rw-r--r--kabc/tests/testdb.cpp4
7 files changed, 137 insertions, 14 deletions
diff --git a/kabc/CMakeLists.txt b/kabc/CMakeLists.txt
index 40d901b5c..7b8816986 100644
--- a/kabc/CMakeLists.txt
+++ b/kabc/CMakeLists.txt
@@ -13,6 +13,7 @@ add_subdirectory( vcard )
add_subdirectory( vcardparser )
add_subdirectory( formats )
add_subdirectory( plugins )
+add_subdirectory( tests )
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
diff --git a/kabc/distributionlisteditor.h b/kabc/distributionlisteditor.h
index faec280e6..0c76d76bf 100644
--- a/kabc/distributionlisteditor.h
+++ b/kabc/distributionlisteditor.h
@@ -51,7 +51,7 @@ class KABC_EXPORT EmailSelectDialog : public KDialogBase
/**
@obsolete
*/
-class DistributionListEditor : public TQWidget
+class KABC_EXPORT DistributionListEditor : public TQWidget
{
Q_OBJECT
public:
diff --git a/kabc/plugins/sql/resourcesql.cpp b/kabc/plugins/sql/resourcesql.cpp
index 55f02bae7..0260a7e05 100644
--- a/kabc/plugins/sql/resourcesql.cpp
+++ b/kabc/plugins/sql/resourcesql.cpp
@@ -78,6 +78,11 @@ Ticket *ResourceSql::requestSaveTicket()
return createTicket( this );
}
+void ResourceSql::releaseSaveTicket( Ticket *ticket )
+{
+ delete ticket;
+}
+
bool ResourceSql::open()
{
TQStringList drivers = TQSqlDatabase::drivers();
diff --git a/kabc/plugins/sql/resourcesql.h b/kabc/plugins/sql/resourcesql.h
index 80ebf9e7a..fd2bec526 100644
--- a/kabc/plugins/sql/resourcesql.h
+++ b/kabc/plugins/sql/resourcesql.h
@@ -30,22 +30,23 @@ class TQSqlDatabase;
namespace KABC {
-class ResourceSql : public Resource
+class KABC_EXPORT ResourceSql : public Resource
{
public:
ResourceSql( AddressBook *ab, const TQString &user, const TQString &password,
const TQString &db, const TQString &host );
ResourceSql( AddressBook *ab, const KConfig * );
- bool open();
- void close();
+ virtual bool open();
+ virtual void close();
- Ticket *requestSaveTicket();
+ virtual Ticket *requestSaveTicket();
+ virtual void releaseSaveTicket( Ticket* );
- bool load();
- bool save( Ticket * ticket );
+ virtual bool load();
+ virtual bool save( Ticket * ticket );
- TQString identifier() const;
+ virtual TQString identifier() const;
private:
void init(const TQString &user, const TQString &password,
diff --git a/kabc/tests/CMakeLists.txt b/kabc/tests/CMakeLists.txt
new file mode 100644
index 000000000..1b739c194
--- /dev/null
+++ b/kabc/tests/CMakeLists.txt
@@ -0,0 +1,116 @@
+#################################################
+#
+# (C) 2016 Slávek Banko
+# slavek.banko (AT) axis.cz
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}
+ ${CMAKE_SOURCE_DIR}/dcop
+ ${CMAKE_BINARY_DIR}/kdecore
+ ${CMAKE_SOURCE_DIR}/kdecore
+ ${CMAKE_SOURCE_DIR}/kdeui
+ ${CMAKE_SOURCE_DIR}/kio
+ ${CMAKE_SOURCE_DIR}/kio/kio
+ ${CMAKE_BINARY_DIR}/kabc
+ ${CMAKE_SOURCE_DIR}/kabc
+ ${CMAKE_SOURCE_DIR}/kab
+ ${CMAKE_SOURCE_DIR}/kabc/plugins/sql
+ ${CMAKE_SOURCE_DIR}/kabc/vcardparser
+ ${CMAKE_SOURCE_DIR}/kabc/vcard/include
+ ${CMAKE_SOURCE_DIR}/kabc/vcard/include/generated
+ ${CMAKE_SOURCE_DIR}/kabc/vcardparser
+)
+
+link_directories(
+ ${TDECORE_LIBRARY_DIRS}
+)
+
+set( TDEABC_TESTS_LINK
+ ${TQT_LIBRARIES}
+ DCOP-shared
+ kdecore-shared
+ kdeui-shared
+ kdefx-shared
+ kio-shared
+ ktexteditor-shared
+ kabc-shared
+)
+
+
+##### test programs ##############################
+
+tde_add_executable( testlock
+ SOURCES testlock.cpp AUTOMOC
+ LINK ${TDEABC_TESTS_LINK}
+)
+
+tde_add_executable( testldapclient
+ SOURCES testldapclient.cpp AUTOMOC
+ LINK ${TDEABC_TESTS_LINK}
+)
+
+tde_add_executable( testkabc
+ SOURCES testkabc.cpp AUTOMOC
+ LINK ${TDEABC_TESTS_LINK}
+)
+
+tde_add_executable( testaddressee
+ SOURCES testaddressee.cpp AUTOMOC
+ LINK ${TDEABC_TESTS_LINK}
+)
+
+tde_add_executable( testaddresseelist
+ SOURCES testaddresseelist.cpp AUTOMOC
+ LINK ${TDEABC_TESTS_LINK}
+)
+
+tde_add_executable( testaddressfmt
+ SOURCES testaddressfmt.cpp AUTOMOC
+ LINK ${TDEABC_TESTS_LINK}
+)
+
+tde_add_executable( testkabcdlg
+ SOURCES testkabcdlg.cpp AUTOMOC
+ LINK ${TDEABC_TESTS_LINK}
+)
+
+tde_add_executable( testdistlist
+ SOURCES testdistlist.cpp AUTOMOC
+ LINK ${TDEABC_TESTS_LINK}
+)
+
+tde_add_executable( testaddresslineedit
+ SOURCES testaddresslineedit.cpp AUTOMOC
+ LINK ${TDEABC_TESTS_LINK}
+)
+
+tde_add_executable( bigread
+ SOURCES bigread.cpp AUTOMOC
+ LINK ${TDEABC_TESTS_LINK} kabc_file-shared
+)
+
+tde_add_executable( bigwrite
+ SOURCES bigwrite.cpp AUTOMOC
+ LINK ${TDEABC_TESTS_LINK} kabc_file-shared
+)
+
+# Plugin ResourceSql is not built == can not be tested
+#
+# tde_add_executable( testdb
+# SOURCES testdb.cpp AUTOMOC
+# LINK ${TDEABC_TESTS_LINK} kabc_file-shared
+# )
+
+tde_add_executable( kabcargl
+ SOURCES kabcargl.cpp AUTOMOC
+ LINK ${TDEABC_TESTS_LINK} kabc_file-shared
+)
diff --git a/kabc/tests/testaddressfmt.cpp b/kabc/tests/testaddressfmt.cpp
index f422ab692..ad0aebc18 100644
--- a/kabc/tests/testaddressfmt.cpp
+++ b/kabc/tests/testaddressfmt.cpp
@@ -51,13 +51,13 @@ int main(int argc,char **argv)
d.setCountry ("");
qDebug( "-------------------------------------\nShould have german address formatting, local country formatting\n" );
- qDebug( a.formattedAddress("Jim Knopf").latin1() );
+ qDebug( "%s", a.formattedAddress("Jim Knopf").latin1() );
qDebug( "-------------------------------------\nShould have US address formatting, local country formatting\n" );
- qDebug( b.formattedAddress("Huck Finn").latin1() );
+ qDebug( "%s", b.formattedAddress("Huck Finn").latin1() );
qDebug( "-------------------------------------\nShould have german address formatting, local country formatting\n" );
- qDebug( c.formattedAddress("Jim Knopf").latin1() );
+ qDebug( "%s", c.formattedAddress("Jim Knopf").latin1() );
qDebug( "-------------------------------------\nShould have local address formatting, local country formatting\n" );
- qDebug( d.formattedAddress("Jim Knopf").latin1() );
+ qDebug( "%s", d.formattedAddress("Jim Knopf").latin1() );
}
diff --git a/kabc/tests/testdb.cpp b/kabc/tests/testdb.cpp
index f94397a62..e4b6aa482 100644
--- a/kabc/tests/testdb.cpp
+++ b/kabc/tests/testdb.cpp
@@ -20,12 +20,12 @@ int main(int argc,char **argv)
AddressBook ab;
- ResourceSql r( &ab, "root", "kde4ever", "localhost" );
+ ResourceSql r( &ab, "root", "kde4ever", "kabc", "localhost" );
if ( ! r.open() ) {
kdDebug() << "Failed to open resource." << endl;
}
- r.load( &ab );
+ r.load();
r.close();