diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2016-05-29 02:24:21 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2016-05-29 02:24:21 +0200 |
commit | 51efac909d7b116c8b0ca58fcd4e74ff58f31091 (patch) | |
tree | d817aab5133718fff032df3f1e517713a6fcfe4a /tdeabc | |
parent | 5fac044f8da14563a3afca64bd05facd6811df91 (diff) | |
download | tdelibs-51efac909d7b116c8b0ca58fcd4e74ff58f31091.tar.gz tdelibs-51efac909d7b116c8b0ca58fcd4e74ff58f31091.zip |
cmake: Add tdeabc tests
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'tdeabc')
-rw-r--r-- | tdeabc/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tdeabc/distributionlisteditor.h | 2 | ||||
-rw-r--r-- | tdeabc/plugins/sql/resourcesql.cpp | 5 | ||||
-rw-r--r-- | tdeabc/plugins/sql/resourcesql.h | 15 | ||||
-rw-r--r-- | tdeabc/tests/CMakeLists.txt | 116 | ||||
-rw-r--r-- | tdeabc/tests/Makefile.am | 4 | ||||
-rw-r--r-- | tdeabc/tests/testaddressfmt.cpp | 8 | ||||
-rw-r--r-- | tdeabc/tests/testdb.cpp | 4 |
8 files changed, 139 insertions, 16 deletions
diff --git a/tdeabc/CMakeLists.txt b/tdeabc/CMakeLists.txt index 1d2ae37a7..88bb97e60 100644 --- a/tdeabc/CMakeLists.txt +++ b/tdeabc/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/tdeabc/distributionlisteditor.h b/tdeabc/distributionlisteditor.h index 815499fac..5c0b4c03a 100644 --- a/tdeabc/distributionlisteditor.h +++ b/tdeabc/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/tdeabc/plugins/sql/resourcesql.cpp b/tdeabc/plugins/sql/resourcesql.cpp index 9635dd77b..b72afea15 100644 --- a/tdeabc/plugins/sql/resourcesql.cpp +++ b/tdeabc/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/tdeabc/plugins/sql/resourcesql.h b/tdeabc/plugins/sql/resourcesql.h index 7ce26956c..a1c085c83 100644 --- a/tdeabc/plugins/sql/resourcesql.h +++ b/tdeabc/plugins/sql/resourcesql.h @@ -30,22 +30,23 @@ class TQSqlDatabase; namespace TDEABC { -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 TDEConfig * ); - 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/tdeabc/tests/CMakeLists.txt b/tdeabc/tests/CMakeLists.txt new file mode 100644 index 000000000..bedc4b115 --- /dev/null +++ b/tdeabc/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}/tdecore + ${CMAKE_SOURCE_DIR}/tdecore + ${CMAKE_SOURCE_DIR}/tdeui + ${CMAKE_SOURCE_DIR}/tdeio + ${CMAKE_SOURCE_DIR}/tdeio/tdeio + ${CMAKE_BINARY_DIR}/tdeabc + ${CMAKE_SOURCE_DIR}/tdeabc + ${CMAKE_SOURCE_DIR}/kab + ${CMAKE_SOURCE_DIR}/tdeabc/plugins/sql + ${CMAKE_SOURCE_DIR}/tdeabc/vcardparser + ${CMAKE_SOURCE_DIR}/tdeabc/vcard/include + ${CMAKE_SOURCE_DIR}/tdeabc/vcard/include/generated + ${CMAKE_SOURCE_DIR}/tdeabc/vcardparser +) + +link_directories( + ${TDECORE_LIBRARY_DIRS} +) + +set( TDEABC_TESTS_LINK + ${TQT_LIBRARIES} + DCOP-shared + tdecore-shared + tdeui-shared + tdefx-shared + tdeio-shared + tdetexteditor-shared + tdeabc-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} tdeabc_file-shared +) + +tde_add_executable( bigwrite + SOURCES bigwrite.cpp AUTOMOC + LINK ${TDEABC_TESTS_LINK} tdeabc_file-shared +) + +# Plugin ResourceSql is not built == can not be tested +# +# tde_add_executable( testdb +# SOURCES testdb.cpp AUTOMOC +# LINK ${TDEABC_TESTS_LINK} tdeabc_file-shared +# ) + +tde_add_executable( kabcargl + SOURCES kabcargl.cpp AUTOMOC + LINK ${TDEABC_TESTS_LINK} tdeabc_file-shared +) diff --git a/tdeabc/tests/Makefile.am b/tdeabc/tests/Makefile.am index c881f30bf..b43162fd7 100644 --- a/tdeabc/tests/Makefile.am +++ b/tdeabc/tests/Makefile.am @@ -50,6 +50,6 @@ bigwrite_SOURCES = bigwrite.cpp testdb_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor testdb_SOURCES = testdb.cpp -tdeabcargl_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor -tdeabcargl_SOURCES = tdeabcargl.cpp +kabcargl_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor +kabcargl_SOURCES = kabcargl.cpp diff --git a/tdeabc/tests/testaddressfmt.cpp b/tdeabc/tests/testaddressfmt.cpp index 79545f6f9..bf5347f4e 100644 --- a/tdeabc/tests/testaddressfmt.cpp +++ b/tdeabc/tests/testaddressfmt.cpp @@ -51,13 +51,13 @@ int main(int argc,char **argv) d.setCountry (""); tqDebug( "-------------------------------------\nShould have german address formatting, local country formatting\n" ); - tqDebug( a.formattedAddress("Jim Knopf").latin1() ); + tqDebug( "%s", a.formattedAddress("Jim Knopf").latin1() ); tqDebug( "-------------------------------------\nShould have US address formatting, local country formatting\n" ); - tqDebug( b.formattedAddress("Huck Finn").latin1() ); + tqDebug( "%s", b.formattedAddress("Huck Finn").latin1() ); tqDebug( "-------------------------------------\nShould have german address formatting, local country formatting\n" ); - tqDebug( c.formattedAddress("Jim Knopf").latin1() ); + tqDebug( "%s", c.formattedAddress("Jim Knopf").latin1() ); tqDebug( "-------------------------------------\nShould have local address formatting, local country formatting\n" ); - tqDebug( d.formattedAddress("Jim Knopf").latin1() ); + tqDebug( "%s", d.formattedAddress("Jim Knopf").latin1() ); } diff --git a/tdeabc/tests/testdb.cpp b/tdeabc/tests/testdb.cpp index c6b02c14a..edc4570ac 100644 --- a/tdeabc/tests/testdb.cpp +++ b/tdeabc/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", "tdeabc", "localhost" ); if ( ! r.open() ) { kdDebug() << "Failed to open resource." << endl; } - r.load( &ab ); + r.load(); r.close(); |