diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e7ee46a5..8680893ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,178 +1,179 @@ cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) project(kopete) set(KOPETE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(KOPETE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(KF5_VERSION "5.25.0") set(REQUIRED_QT_VERSION "5.6.0") #ECM modules configurations find_package(ECM ${KF5_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_MODULE_DIR} ${ECM_KDE_MODULE_DIR} ${KOPETE_SOURCE_DIR}/cmake/modules) find_package(Phonon4Qt5 REQUIRED NO_MODULE) find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED Core) find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Widgets Xml Sql Test) find_package(KF5 ${KF5_VERSION} REQUIRED COMPONENTS Config CoreAddons Crash DBusAddons DocTools Emoticons I18n KCMUtils KHtml NotifyConfig Parts TextEditor Wallet KDELibs4Support ) find_package(KF5Contacts ${KCONTACTS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5IdentityManagement ${KCONTACTS_LIB_VERSION} CONFIG REQUIRED) include(KDEInstallDirs) include(KDECompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) include(FeatureSummary) include(ECMAddTests) include(ECMAddAppIcon) include(ECMInstallIcons) include(ECMQtDeclareLoggingCategory) include_directories(${PHONON_INCLUDES}) if(WIN32) set(CMAKE_REQUIRED_LIBRARIES ${KDEWIN32_LIBRARIES}) set(CMAKE_REQUIRED_INCLUDES ${KDEWIN32_INCLUDES}) endif() add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) if(WIN32) set(DISABLE_VIDEOSUPPORT ON) else() option(DISABLE_VIDEOSUPPORT "Build Kopete without video-support" OFF) endif() if(DISABLE_VIDEOSUPPORT) add_definitions(-DVIDEOSUPPORT_DISABLED) endif() set(LIBKLEO_LIB_VERSION_LIB "5.4.0") find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION_LIB} CONFIG REQUIRED) ### Alphabetical list of optional packages ### find_package(Alsa QUIET) set_package_properties(Alsa PROPERTIES DESCRIPTION "Alsa is advanced linux sound Architecture" URL "http://www.alsa-project.org" TYPE OPTIONAL PURPOSE "Required for the Jabber protocol with libjingle support") find_package(Boost QUIET) set_package_properties(Boost PROPERTIES DESCRIPTION "C++ Boost libraries" URL "http://www.boost.org/" TYPE OPTIONAL PURPOSE "Required for the WLM protocol") find_package(Expat QUIET) set_package_properties(Expat PROPERTIES DESCRIPTION "Expat is a stream oriented XML parser" URL "http://expat.sourceforge.net/" TYPE OPTIONAL PURPOSE "Required for the Jabber protocol with libjingle support") find_package(GIF QUIET) set_package_properties(GIF PROPERTIES DESCRIPTION "GIF - Package of portable tools and library routines for working with GIF images" URL "http://giflib.sourceforge.net/" TYPE OPTIONAL PURPOSE "Required for the WLM protocol with handwriting messages support") find_package(GLIB2 QUIET) set_package_properties(GLIB2 PROPERTIES DESCRIPTION "GLib library" URL "http://www.gtk.org" TYPE OPTIONAL PURPOSE "Required for the Nowlistening plugin with XMMS player support") find_package(IDN QUIET) set_package_properties(IDN PROPERTIES DESCRIPTION "GNU Libidn International Domain Name(IDN) implementation" URL "http://www.gnu.org/software/libidn/" TYPE OPTIONAL PURPOSE "Required for the Jabber protocol") find_package(Jasper QUIET) set_package_properties(Jasper PROPERTIES DESCRIPTION "Jasper library implements the codec specified in the JPEG-200 Part-1 standard" URL "http://www.ece.uvic.ca/~mdadams/jasper/" TYPE OPTIONAL PURPOSE "Required for the Yahoo protocol") find_package(JsonCpp QUIET) set_package_properties(JsonCpp PROPERTIES DESCRIPTION "JsonCpp is an implementation of a JSON reader and writer in C++" URL "http://jsoncpp.sourceforge.net/" TYPE OPTIONAL PURPOSE "Required for the jabber protocol") find_package(Kleopatra QUIET) set_package_properties(Kleopatra PROPERTIES DESCRIPTION "The Kleopatra libraries (from kdepim)" URL "http://kde.org/" TYPE OPTIONAL PURPOSE "Required for the Cryptography plugin") find_package(Libgadu QUIET) set_package_properties(Libgadu PROPERTIES DESCRIPTION "A library providing support for the Gadu-Gadu protocol" URL "http://www.toxygen.net/libgadu" TYPE OPTIONAL PURPOSE "Required for the Gadu-Gadu protocol") find_package(LibMeanwhile QUIET) set_package_properties(LibMeanwhile PROPERTIES DESCRIPTION "A library for protocol support for connection to sametime servers" URL "http://meanwhile.sourceforge.net/" TYPE OPTIONAL PURPOSE "Required for the meanwhile protocol") find_package(Libmsn QUIET) set_package_properties(Libmsn PROPERTIES DESCRIPTION "A library providing support for the msn protocol" URL "http://libmsn.sourceforge.net/" TYPE OPTIONAL PURPOSE "Required for the WLM protocol") find_package(LiboRTP QUIET) set_package_properties(LiboRTP PROPERTIES DESCRIPTION "oRTP provides an API to send rtp packets" URL "http://www.linphone.org/index.php/eng/code_review/ortp/" TYPE OPTIONAL PURPOSE "Required for the Jabber protocol with libjingle support and for the WLM protocol with voice clips support") find_package(LibOTR QUIET) set_package_properties(LibOTR PROPERTIES DESCRIPTION "Library to encrypt messages with off-the-record encryption" URL "http://www.cypherpunks.ca/otr/" TYPE OPTIONAL PURPOSE "Required for the OTR plugin") find_package(LibV4L2 QUIET) set_package_properties(LibV4L2 PROPERTIES DESCRIPTION "Collection of video4linux support libraries" URL "http://hansdegoede.livejournal.com http://linuxtv.org/hq/~hgoede/libv4l/" TYPE OPTIONAL PURPOSE "Required for better webcam support on Linux") find_package(LibXml2 QUIET) set_package_properties(LibXml2 PROPERTIES DESCRIPTION "Libraries used to develop XML applications" URL "http://www.xmlsoft.org/" TYPE OPTIONAL PURPOSE "Required for Webpresence plugin") find_package(LibXslt QUIET) set_package_properties(LibXslt PROPERTIES DESCRIPTION "A library to transform XML files into other XML files" URL "http://www.xmlsoft.org/XSLT/" TYPE OPTIONAL PURPOSE "Required for the Webpresence plugin") find_package(Mediastreamer QUIET) set_package_properties(Mediastreamer PROPERTIES DESCRIPTION "A streaming enginer specialized for voice/video telephony applications" URL "http://www.linphone.org/index.php/eng/code_review/mediastreamer2/" TYPE OPTIONAL PURPOSE "Required for the Jabber protocol with libjingle support and for the WLM protocol with voice clips support") find_package(OpenSSL QUIET) set_package_properties(OpenSSL PROPERTIES DESCRIPTION "OpenSSL implementation of SSL" URL "https://www.openssl.org/" TYPE OPTIONAL PURPOSE "Required for the Jabber protocol with libjingle support") find_package(Qca-qt5 2.1.0) set_package_properties(Qca-qt5 PROPERTIES DESCRIPTION "Support for encryption" URL "http://download.kde.org/stable/qca-qt5/" TYPE RECOMMENDED) set(GPGMEPP_LIB_VERSION "1.8.0") find_package(Gpgmepp ${GPGMEPP_LIB_VERSION} CONFIG REQUIRED) find_package(Sqlite QUIET) set_package_properties(Sqlite PROPERTIES DESCRIPTION "SQLite is a Binary-Database" URL "http://www.sqlite.org" TYPE OPTIONAL PURPOSE "Required for the Statistic plugin") find_package(Speex QUIET) set_package_properties(Speex PROPERTIES DESCRIPTION "Speex is an encoder/decoder for the speex audio format" URL "http://www.speex.org/" TYPE OPTIONAL PURPOSE "Required for the Jabber protocol with Jingle support") find_package(SRTP QUIET) set_package_properties(SRTP PROPERTIES DESCRIPTION "SRTP provides an implementation of the Secure Real-time Transport protocol(SRTP)" URL "http://srtp.sourceforge.net/srtp.html" TYPE OPTIONAL PURPOSE "Required for the Jabber protocol with libjingle support") find_package(Xmms QUIET) set_package_properties(Xmms PROPERTIES DESCRIPTION "X Multimedia System development libraries" URL "http://www.xmms.org/" TYPE OPTIONAL PURPOSE "Required for the Nowlistening plugin with XMMS player support") find_package(ZLIB QUIET) set_package_properties(ZLIB PROPERTIES DESCRIPTION "Zlib is a library implementing the deflate compression method" URL "http://zlib.net/" TYPE OPTIONAL PURPOSE "Required for the GroupWise and Jabber protocols") if(Q_WS_X11) macro_log_feature(X11_Xss_FOUND "libXss" "libXss provides access to screen server X11 extension" "" FALSE "" "Required for idle timer on X11") endif() set(KOPETE_INCLUDES ${KDEPIMLIBS_INCLUDE_DIRS} ${KOPETE_SOURCE_DIR}/libkopete/ ${KOPETE_BINARY_DIR}/libkopete/ ${KOPETE_SOURCE_DIR}/libkopete/ui/ ${KOPETE_SOURCE_DIR}/libkopete/private/ ${KOPETE_SOURCE_DIR}/libkopete/contactlist/ ${KOPETE_SOURCE_DIR}/libkopete/tasks/ ) add_subdirectory(libkopete) add_subdirectory(kopete) add_subdirectory(protocols) add_subdirectory(plugins) add_subdirectory(icons) add_subdirectory(sounds) add_subdirectory(styles) add_subdirectory(doc) +add_subdirectory(tests) install( FILES kopete.categories DESTINATION ${KDE_INSTALL_CONFDIR} ) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/libkopete/CMakeLists.txt b/libkopete/CMakeLists.txt index 989d004be..ebe6ea9e8 100644 --- a/libkopete/CMakeLists.txt +++ b/libkopete/CMakeLists.txt @@ -1,280 +1,279 @@ include(CheckIncludeFile) check_include_file(valgrind/valgrind.h HAVE_VALGRIND_H) if(HAVE_VALGRIND_H) add_definitions(-DHAVE_VALGRIND_H) endif(HAVE_VALGRIND_H) add_subdirectory( private ) if(NOT DISABLE_VIDEOSUPPORT) add_subdirectory( avdevice ) endif(NOT DISABLE_VIDEOSUPPORT) -#add_subdirectory( tests ) include_directories( ${KOPETE_INCLUDES} ) ########### next target ############### set(kopete_private_SRCS private/kopeteemoticons.cpp private/kopeteutils_private.cpp private/kopeteviewmanager.cpp private/kopeteactivenotification.cpp ) set(kopete_private_SRCS ${kopete_private_SRCS} private/kopeteidleplatform_dummy.cpp ) if (Q_WS_X11) if (X11_Xss_FOUND) set(kopete_private_SRCS ${kopete_private_SRCS} private/kopeteidleplatform_x11.cpp ) else (X11_Xss_FOUND) set(kopete_private_SRCS ${kopete_private_SRCS} private/kopeteidleplatform_dummy.cpp ) endif (X11_Xss_FOUND) endif (Q_WS_X11) if (Q_WS_MAC) set(kopete_private_SRCS ${kopete_private_SRCS} private/kopeteidleplatform_mac.cpp ) endif (Q_WS_MAC) if (Q_WS_WIN) set(kopete_private_SRCS ${kopete_private_SRCS} private/kopeteidleplatform_win.cpp ) endif (Q_WS_WIN) set(kopete_ui_SRCS ui/accountselector.cpp ui/addcontactpage.cpp ui/addressbooklinkwidget.cpp ui/addressbookselectordialog.cpp ui/addressbookselectorwidget.cpp ui/addresseeitem.cpp ui/avatardialog.cpp ui/avatarwebcamdialog.cpp ui/avatarselectorwidget.cpp ui/contactaddednotifydialog.cpp ui/collapsiblewidget.cpp ui/editaccountwidget.cpp ui/kopetecontactaction.cpp ui/kopeteinfodialog.cpp ui/kopetelistview.cpp ui/kopetelistviewitem.cpp ui/kopetelistviewsearchline.cpp ui/kopetepasswordwidget.cpp ui/kopetestdaction.cpp ui/kopeteview.cpp ui/kopeteviewplugin.cpp ui/metacontactselectorwidget.cpp ui/webcamwidget.cpp ) set(kopete_contactlist_SRCS contactlist/kopetecontactliststorage.cpp contactlist/xmlcontactstorage.cpp ) set(kopete_tasks_SRCS tasks/kopetetask.cpp tasks/kopetecontacttaskbase.cpp tasks/kopetedeletecontacttask.cpp ) set(kopete_LIB_SRCS ${kopete_private_SRCS} ${kopete_ui_SRCS} ${kopete_contactlist_SRCS} ${kopete_tasks_SRCS} kabcpersistence.cpp kopeteaccount.cpp kopeteaccountmanager.cpp kopeteavatarmanager.cpp kopeteblacklister.cpp kopetechatsession.cpp kopetechatsessionmanager.cpp kopetecommand.cpp kopetecommandhandler.cpp kopetecontact.cpp kopetecontactlist.cpp kopetecontactlistelement.cpp kopeteproperty.cpp kopeteglobal.cpp kopetegroup.cpp kopeteidentity.cpp kopeteidentitymanager.cpp kopetemessage.cpp kopetemessageevent.cpp kopetemessagehandlerchain.cpp kopetemessagehandler.cpp kopetemetacontact.cpp #kopetefileengine.cpp kopetemimetypehandler.cpp kopeteonlinestatus.cpp kopeteonlinestatusmanager.cpp kopetepassword.cpp kopetepasswordedaccount.cpp kopetepicture.cpp kopeteplugin.cpp kopetepluginmanager.cpp kopeteproperties.cpp kopetepropertycontainer.cpp kopeteprotocol.cpp kopetesimplemessagehandler.cpp kopetestatusmessage.cpp kopetetransfermanager.cpp kopeteuiglobal.cpp kopeteutils.cpp kopetewalletmanager.cpp networkstatuscommon.h chatsessionmemberslistmodel.cpp kopetestatusmanager.cpp kopetestatusitems.cpp kopeteidletimer.cpp kopeteinfoeventmanager.cpp kopeteinfoevent.cpp kopeteaddedinfoevent.cpp kopetesockettimeoutwatcher.cpp # REMOVED FOR NOW # connectionmanager.cpp # managedconnectionaccount.cpp ) ki18n_wrap_ui(kopete_LIB_SRCS ui/addressbooklinkwidget_base.ui ui/addressbookselectorwidget_base.ui ui/avatarselectorwidget.ui ui/contactaddednotifywidget.ui ui/kopeteawaydialogbase.ui ui/kopetepasswordwidgetbase.ui ui/metacontactselectorwidget_base.ui ) kconfig_add_kcfg_files(kopete_LIB_SRCS GENERATE_MOC kopeteappearancesettings.kcfgc kopetebehaviorsettings.kcfgc kopetestatussettings.kcfgc ) qt5_add_resources(kopete_LIB_SRCS libkopete.qrc) ecm_qt_declare_logging_category(kopete_LIB_SRCS HEADER libkopete_debug.h IDENTIFIER LIBKOPETE_LOG CATEGORY_NAME org.kde.kopete.libkopete) find_package(KF5Contacts ${KCONTACTS_LIB_VERSION} CONFIG REQUIRED) add_library(kopete SHARED ${kopete_LIB_SRCS}) generate_export_header(kopete BASE_NAME libkopete) target_link_libraries(kopete KF5::Contacts KF5::Emoticons KF5::KCMUtils KF5::I18n KF5::KIOCore KF5::KIOWidgets KF5::Archive KF5::ConfigCore KF5::ConfigGui KF5::Parts KF5::Wallet KF5::KDELibs4Support ) if(NOT DISABLE_VIDEOSUPPORT) target_link_libraries(kopete kopete_videodevice) endif(NOT DISABLE_VIDEOSUPPORT) if(Q_WS_X11 AND X11_Xss_FOUND) target_link_libraries(kopete ${X11_X11_LIB} ${X11_Xss_LIB}) endif(Q_WS_X11 AND X11_Xss_FOUND) set_target_properties(kopete PROPERTIES VERSION 1.0.0 SOVERSION 1 ) if(MSVC) set_target_properties(kopete PROPERTIES OUTPUT_NAME libkopete ) endif(MSVC) install(TARGETS kopete ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) ########### install files ############### install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ui_kopeteawaydialogbase.h ${CMAKE_CURRENT_BINARY_DIR}/ui_kopetepasswordwidgetbase.h ui/accountselector.h ui/addcontactpage.h ui/addressbookselectordialog.h ui/addressbookselectorwidget.h ui/avatardialog.h ui/avatarselectorwidget.h ui/contactaddednotifydialog.h ui/editaccountwidget.h ui/kopetecontactaction.h ui/kopeteinfodialog.h ui/kopetelistview.h ui/kopetelistviewitem.h ui/kopetelistviewsearchline.h ui/kopetepasswordwidget.h ui/kopetestdaction.h ui/kopeteview.h ui/kopeteviewplugin.h DESTINATION ${KDE_INSTALL_INCLUDEDIR}/kopete/ui COMPONENT Devel ) install( FILES kopeteappearancesettings.kcfg kopetebehaviorsettings.kcfg kopetestatussettings.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR}) install( FILES kopeteplugin.desktop kopeteprotocol.desktop kopeteui.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR}) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/kopeteappearancesettings.h ${CMAKE_CURRENT_BINARY_DIR}/kopetebehaviorsettings.h ${CMAKE_CURRENT_BINARY_DIR}/kopetestatussettings.h kabcpersistence.h kopeteaccount.h kopeteaccountmanager.h kopeteaddedinfoevent.h kopeteavatarmanager.h kopeteblacklister.h kopetechatsession.h kopetechatsessionmanager.h kopetecommand.h kopetecommandhandler.h kopetecontact.h kopetecontactlistelement.h kopetecontactlist.h kopeteproperty.h ${CMAKE_CURRENT_BINARY_DIR}/libkopete_export.h kopeteglobal.h kopetegroup.h kopeteidentity.h kopeteidentitymanager.h kopeteinfoevent.h kopetemessageevent.h kopetemessage.h kopetemessagehandlerchain.h kopetemessagehandler.h kopetemetacontact.h kopetemimetypehandler.h kopeteonlinestatus.h kopeteonlinestatusmanager.h kopetepasswordedaccount.h kopetepassword.h kopetepicture.h kopeteplugin.h kopetepluginmanager.h kopeteprotocol.h kopetepropertycontainer.h kopetesimplemessagehandler.h kopetestatusmessage.h kopetetransfermanager.h kopeteuiglobal.h kopeteutils.h kopeteversion.h kopetestatusmanager.h tasks/kopetetask.h tasks/kopetecontacttaskbase.h tasks/kopetedeletecontacttask.h private/kopeteemoticons.h DESTINATION ${KDE_INSTALL_INCLUDEDIR}/kopete COMPONENT Devel) install( FILES org.kde.kopete.Client.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR} ) diff --git a/libkopete/tests/CMakeLists.txt b/libkopete/tests/CMakeLists.txt deleted file mode 100644 index 456212b45..000000000 --- a/libkopete/tests/CMakeLists.txt +++ /dev/null @@ -1,79 +0,0 @@ -set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) - -set(kopete_test_mock_SRCS -mock/kopeteaccount_mock.cpp -mock/kopetecontact_mock.cpp -mock/kopetemessage_mock.cpp -mock/kopetemetacontact_mock.cpp -mock/kopeteprotocol_mock.cpp -) - -#add_subdirectory( mock ) - -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/mock/ ${KOPETE_INCLUDES} ) - -add_definitions( -DSRCDIR="\\"${CMAKE_CURRENT_SOURCE_DIR}/\\"" ) - -set( KOPETE_TEST_LIBRARIES Qt5::Test KF5::KIOCore kopete ) - -########### Automated tests ############### - -# this test uses an ugly hack which does not work on win32 -if(NOT WIN32) - set(kopetemessage_test_SRCS kopetemessage_test.cpp ${kopete_test_mock_SRCS}) - - - add_executable(kopetemessage_test ${kopetemessage_test_SRCS}) -add_test(kopetemessage_test kopetemessage_test) -ecm_mark_as_test(kopetemessage_test) - - target_link_libraries(kopetemessage_test ${KOPETE_TEST_LIBRARIES} ) - -endif(NOT WIN32) -#### - -set(kopetetask_test_SRCS kopetetask_test.cpp ) - -add_executable(kopetetask_test ${kopetetask_test_SRCS}) -add_test(kopetetask_test kopetetask_test) -ecm_mark_as_test(kopetetask_test) - -target_link_libraries(kopetetask_test ${KOPETE_TEST_LIBRARIES} ) - -#### - -set(statusmessage_test_SRCS statusmessage_test.cpp ) - - -add_executable(statusmessage_test ${statusmessage_test_SRCS}) -add_test(statusmessage_test statusmessage_test) -ecm_mark_as_test(statusmessage_test) - -target_link_libraries(statusmessage_test ${KOPETE_TEST_LIBRARIES} ) - -#### - -set(xmlcontactstorage_test_SRCS xmlcontactstorage_test.cpp) - - -add_executable(xmlcontactstorage_test ${xmlcontactstorage_test_SRCS}) -add_test(xmlcontactstorage_test xmlcontactstorage_test) -ecm_mark_as_test(xmlcontactstorage_test) - -target_link_libraries(xmlcontactstorage_test ${KOPETE_TEST_LIBRARIES}) - -########### Tests Program ############### - -set(avatarselector_test_SRCS avatarselectortest_program.cpp) - -add_executable(avatarselectortest_program ${avatarselector_test_SRCS}) -ecm_mark_as_test(avatarselectortest_program) - -target_link_libraries(avatarselectortest_program ${KOPETE_TEST_LIBRARIES}) - -########### install files ############### - - - - - diff --git a/libkopete/tests/README b/libkopete/tests/README deleted file mode 100644 index ead9fbdc3..000000000 --- a/libkopete/tests/README +++ /dev/null @@ -1,47 +0,0 @@ -LibKopete Unit Tests -==================== - -KopeteSuite: --------------- -Emoticon Test -Link Test -Property Test - -Test Programs: --------------- -Password Test Program -Wallet Test Program - - -HOWTO Run -========= - -You can use the console or the GUI version: - - $ make guicheck - $ make check - -The 'silent' switch in make is useful to reduce output: - - $ make check -s - - -Tricks -====== - -Accessing private data?, you should not. We will kill you. -If it is really required, do something like: - - #define private public - #include "kopetemessage.h" - #undef private - -Add a new test quickly: - - $ ./create_test.rb Kopete::ContactList - Creating test for class Kopete::ContactList - kopetecontactlist_test.h and kopetecontactlist_test.cpp writen. - Please add the following to Makefile.am: - kunittest_kopetecontactlist_test_la_SOURCES = kopetecontactlist_test.cpp - kunittest_kopetecontactlist_test_la_LIBADD = -lkunittest ../mock/libkopete_mock.la - kunittest_kopetecontactlist_test_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries) diff --git a/libkopete/tests/avatarselectortest_program.cpp b/libkopete/tests/avatarselectortest_program.cpp deleted file mode 100644 index 4d2567ba4..000000000 --- a/libkopete/tests/avatarselectortest_program.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - Avatar Selector Widget test - - Copyright (c) 2007 by Michaël Larouche - - Kopete (c) 2002-2007 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ -#include -#include -#include -#include "avatarselectorwidget.h" - -int main(int argc, char **argv) -{ - KAboutData aboutData("avatarselectortest", 0, ki18n("Kopete Avatar Selector Widget Test"), - "0.1.0", ki18n("Kopete Avatar Selector Widget Test"), KAboutData::License_GPL, - ki18n("Michaël Larouche"), ki18n("larouche@kde.org"), "http://kopete.kde.org"); - - KCmdLineArgs::init(argc, argv, &aboutData); - - KApplication app; - - Kopete::UI::AvatarSelectorWidget testWidget; - testWidget.show(); - - return app.exec(); -} diff --git a/libkopete/tests/create_test.rb b/libkopete/tests/create_test.rb deleted file mode 100755 index 7951bf357..000000000 --- a/libkopete/tests/create_test.rb +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/ruby -# -# Copyright (c) 2005 by Duncan Mac-Vicar -# -# Kopete (c) 2002-2005 by the Kopete developers -# -# ************************************************************************* -# * * -# * 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. * -# * * -# ************************************************************************* - -className = ARGV[0] - -if className.nil? - puts "Need a class name" - exit -end - -puts "Creating test for class #{className}" - -hBase = "template_test.h" -cppBase = "template_test.cpp" - -fileH = File.new(hBase).read -fileCpp = File.new(cppBase).read - -fileH.gsub!(/TEMPLATE/, className.upcase.gsub(/::/,"")) -fileH.gsub!(/Template/, className.gsub(/::/,"")) -fileH.gsub!(/some requirement/, className + " class.") - -fileCpp.gsub!(/TEMPLATE/, className.upcase.gsub(/::/,"")) -fileCpp.gsub!(/template/, className.downcase.gsub(/::/,"")) -fileCpp.gsub!(/Template/, className.gsub(/::/,"")) -fileCpp.gsub!(/some requirement/, className + " class.") - -makefileAm = "kunittest_template_test_la_SOURCES = template_test.cpp\nkunittest_template_test_la_LIBADD = -lkunittest ../mock/libkopete_mock.la\nkunittest_template_test_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)\n" -makefileAm.gsub!(/template/, className.downcase.gsub(/::/,"")) - -hNew = hBase.gsub(/template/, className.downcase.gsub(/::/,"")) -cppNew = cppBase.gsub(/template/, className.downcase.gsub(/::/,"")) - -hOut = File.new(hNew, "w") -cppOut = File.new(cppNew, "w") - -hOut.write(fileH) -cppOut.write(fileCpp) - -puts "#{hNew} and #{cppNew} writen." - -puts "Please add the following to Makefile.am:" -puts makefileAm - diff --git a/libkopete/tests/kopetecontactlist_test.cpp b/libkopete/tests/kopetecontactlist_test.cpp deleted file mode 100644 index 7e935c5e7..000000000 --- a/libkopete/tests/kopetecontactlist_test.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - Tests for Kopete::ContactList class. - - Copyright (c) 2005 by Duncan Mac-Vicar - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#include "kopetecontactlist_test.h" -#include -#include - -#include -#include - -using namespace KUnitTest; - -KUNITTEST_MODULE(kunittest_kopetecontactlist_test, "KopeteSuite"); -KUNITTEST_MODULE_REGISTER_TESTER(KopeteContactList_Test); - -void KopeteContactList_Test::allTests() -{ - testSomething(); -} - -void KopeteContactList_Test::testSomething() -{ - // change user data dir to avoid messing with user's .kde dir - setenv("KDEHOME", QFile::encodeName(QDir::homePath() + "/.kopete-unittest"), true); - - QString filename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + QString::fromLatin1("contactlist.xml"); - if (!filename.isEmpty()) { - // previous test run, delete the previous contact list - bool removed = QFile::remove(filename); - // if we cant remove the file, abort test - if (!removed) { - return; - } - } - - int result = 1; - int expected = 1; - // result should be the expected one - CHECK(result, expected); -} diff --git a/libkopete/tests/kopetecontactlist_test.h b/libkopete/tests/kopetecontactlist_test.h deleted file mode 100644 index f495e767f..000000000 --- a/libkopete/tests/kopetecontactlist_test.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Tests for Kopete::ContactList class. - - Copyright (c) 2005 by Duncan Mac-Vicar - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#ifndef KOPETECONTACTLIST_TEST_H -#define KOPETECONTACTLIST_TEST_H - -#include - -// change to SlotTester when it works -class KopeteContactList_Test : public KUnitTest::Tester -{ -public: - void allTests(); -public Q_SLOTS: - void testSomething(); -private: -}; - -#endif diff --git a/libkopete/tests/kopetemessage.xsd b/libkopete/tests/kopetemessage.xsd deleted file mode 100644 index f51e74b92..000000000 --- a/libkopete/tests/kopetemessage.xsd +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - ... it will instruct the Kopete XSL engine that you want the entire contents - of the chat window to be re-drawn each time a new message is appended. This - is not the normal procedure, and is only required for special situations - (see the Adium style for an example). - - TransformAllMessages is the only flag currently defined. - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libkopete/tests/kopetemessage_test.cpp b/libkopete/tests/kopetemessage_test.cpp deleted file mode 100644 index a590e9c56..000000000 --- a/libkopete/tests/kopetemessage_test.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/* - Tests for Kopete::Message - - Copyright (c) 2005 by Tommi Rantala - Copyright (c) 2005 by Duncan Mac-Vicar Prett - Copyright (c) 2004 by Richard Smith - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#include "kopetemessage_test.h" - -// QTestLib for KDE -#include -#include - -#include -#include -#include -#include - -#include -#include -#include "libkopete_debug.h" - -#include "kopeteaccount_mock.h" -#include "kopeteprotocol_mock.h" -#include "kopetecontact_mock.h" -#include "kopetemetacontact_mock.h" - -QTEST_KDEMAIN(KopeteMessage_Test, NoGUI) - -/* - There are four sets of tests: for each of plain text and html, we have those - known to work in the current codebase, and those known to fail right now. - - the name convention is working|broken-plaintext|html-number.input|output -*/ - -KopeteMessage_Test::KopeteMessage_Test() -{ - // change user data dir to avoid messing with user's .kde dir - setenv("KDEHOME", QFile::encodeName(QDir::homePath() + "/.kopete-unittest"), true); - - // create fake objects needed to build a reasonable testeable message - m_protocol = new Kopete::Test::Mock::Protocol(KComponentData(QByteArray("test-kopete-message")), 0L); - m_account = new Kopete::Test::Mock::Account(m_protocol, "testaccount"); - m_metaContactMyself = new Kopete::Test::Mock::MetaContact(); - m_metaContactOther = new Kopete::Test::Mock::MetaContact(); - m_contactFrom = new Kopete::Test::Mock::Contact(m_account, QString::fromLatin1("test-myself"), m_metaContactMyself, QString()); - m_contactTo = new Kopete::Test::Mock::Contact(m_account, QString::fromLatin1("test-dest"), m_metaContactOther, QString()); -} - -void KopeteMessage_Test::testPrimitives() -{ - /********************************************** - * from(), to() - *********************************************/ - - { - Kopete::Message msg(m_contactFrom, m_contactTo); - Q_ASSERT(msg.from()); - Q_ASSERT(!msg.to().isEmpty()); - } - - /********************************************** - * Direction - *********************************************/ - - { - Kopete::Message msg; - msg.setDirection(Kopete::Message::Inbound); - QCOMPARE(msg.direction(), Kopete::Message::Inbound); - } - { - Kopete::Message msg; - msg.setDirection(Kopete::Message::Outbound); - QCOMPARE(msg.direction(), Kopete::Message::Outbound); - } - { - Kopete::Message msg; - msg.setDirection(Kopete::Message::Internal); - QCOMPARE(msg.direction(), Kopete::Message::Internal); - } - - /********************************************** - * Message Format - *********************************************/ - - { - Kopete::Message msg; - msg.setPlainBody(QLatin1String("foobar")); - QCOMPARE(msg.format(), Qt::PlainText); - } - { - Kopete::Message msg; - msg.setHtmlBody(QLatin1String("foobar")); - QCOMPARE(msg.format(), Qt::RichText); - } - { - QString m = "foobar"; - Kopete::Message msg; - - msg.setPlainBody(m); - QCOMPARE(msg.format(), Qt::PlainText); - - msg.setHtmlBody(m); - QCOMPARE(msg.format(), Qt::RichText); - } - - /********************************************** - * setBody() - *********************************************/ - - { - QString m = "foobar"; - Kopete::Message msg; - msg.setHtmlBody(m); - - msg.setPlainBody("NEW"); - QCOMPARE(QString("NEW"), msg.plainBody()); - - msg.setPlainBody("NEW_NEW"); - QCOMPARE(msg.plainBody(), QString("NEW_NEW")); - } - { - QString m = "foobar"; - Kopete::Message msg; - msg.setPlainBody(m); - - msg.setPlainBody("NEW"); - QCOMPARE(msg.plainBody(), QString("NEW")); - - msg.setHtmlBody("NEW_NEW"); - QCOMPARE(msg.plainBody(), QString("NEW_NEW")); - } - { - QString m = " HELLO WORLD "; - Kopete::Message msg; - msg.setPlainBody(m); - QCOMPARE(msg.plainBody(), m); - - msg.setPlainBody(" SIMPLE"); - QCOMPARE(msg.plainBody(), QString(" SIMPLE")); - - msg.setHtmlBody("SIMPLE"); - QCOMPARE(msg.plainBody(), QString("SIMPLE")); - - QCOMPARE(Kopete::Message::unescape(QString("SIMPLE")), QString("SIMPLE")); - QCOMPARE(Kopete::Message::unescape(QString("Foo ")), QString("Foo ")); - QCOMPARE(Kopete::Message::unescape(QString("Foo ")), QString("Foo Bar")); - - msg.setHtmlBody(m); - -// QCOMPARE(msg.escapedBody(), QString("   HELLO WORLD   ")); -// QCOMPARE(msg.plainBody(), QString(" HELLO WORLD ")); - QCOMPARE(msg.plainBody().trimmed(), QString("HELLO WORLD")); -// QCOMPARE(msg.escapedBody().trimmed(), QString("  HELLO WORLD  ")); - } - - /********************************************** - * Copy constructor - *********************************************/ - - { - Kopete::Message msg1; - msg1.setHtmlBody(QLatin1String("foo")); - Kopete::Message msg2(msg1); - - QCOMPARE(msg1.plainBody(), msg2.plainBody()); - QCOMPARE(msg1.escapedBody(), msg2.escapedBody()); - - msg1.setPlainBody("NEW"); - QCOMPARE(msg1.plainBody(), QString("NEW")); - QCOMPARE(msg2.plainBody(), QString("foo")); - } - - /********************************************** - * operator= - *********************************************/ - - { - Kopete::Message msg1; - msg1.setHtmlBody(QLatin1String("foo")); - { - Kopete::Message msg2; - -// QCOMPARE(msg2.plainBody(), QString()); - - msg2 = msg1; - - QCOMPARE(msg1.plainBody(), msg2.plainBody()); - QCOMPARE(msg1.escapedBody(), msg2.escapedBody()); - - msg1.setPlainBody("NEW"); - QCOMPARE(msg1.plainBody(), QString("NEW")); - QCOMPARE(msg2.plainBody(), QString("foo")); - } - QCOMPARE(msg1.plainBody(), QString("NEW")); - - msg1 = msg1; - QCOMPARE(msg1.plainBody(), QString("NEW")); - } -} - -void KopeteMessage_Test::testLinkParser() -{ - QString basePath = QString::fromLatin1(SRCDIR) + QString::fromLatin1("/link-parser-testcases"); - QDir testCasesDir(basePath); - - QStringList inputFileNames = testCasesDir.entryList(QStringList(QLatin1String("*.input"))); - for (QStringList::ConstIterator it = inputFileNames.constBegin(); it != inputFileNames.constEnd(); ++it) { - QString fileName = *it; - QString outputFileName = fileName; - outputFileName.replace("input", "output"); - // open the input file - QFile inputFile(basePath + QString::fromLatin1("/") + fileName); - QFile expectedFile(basePath + QString::fromLatin1("/") + outputFileName); - // check if the expected output file exists - // if it doesn't, skip the testcase - if (!expectedFile.exists()) { - QSKIP("Warning! expected output for testcase not found. Skiping testcase", SkipSingle); - continue; - } - if (inputFile.open(QIODevice::ReadOnly) && expectedFile.open(QIODevice::ReadOnly)) { - QTextStream inputStream(&inputFile); - QTextStream expectedStream(&expectedFile); - QString inputData; - QString expectedData; - inputData = inputStream.readAll(); - expectedData = expectedStream.readAll(); - - inputFile.close(); - expectedFile.close(); - - // use a concrete url - inputData.replace("$URL", "http://www.kde.org"); - expectedData.replace("$URL", "http://www.kde.org"); - - // set message format for parsing according to textcase filename convention - Qt::TextFormat format; - if (fileName.section('-', 1, 1) == QString::fromLatin1("plaintext")) { - format = Qt::PlainText; - } else { - format = Qt::RichText; - } - - QString result = Kopete::Message::parseLinks(inputData, format); - - // HACK to know the test case we applied, concatenate testcase name to both - // input and expected string. WIll remove when I can add some sort of metadata - // to a QCOMPARE so debug its origin testcase - result = fileName + QString::fromLatin1(": ") + result; - expectedData = fileName + QString::fromLatin1(": ") + expectedData; - // if the test case begins with broken, we expect it to fail, then use XFAIL - // otherwise use QCOMPARE - if (fileName.section('-', 0, 0) == QString::fromLatin1("broken")) { - //qCDebug(LIBKOPETE_LOG) << "checking known-broken testcase: " << fileName; - QEXPECT_FAIL("", "Checking know-broken testcase", Continue); - QCOMPARE(result, expectedData); - } else { - //qCDebug(LIBKOPETE_LOG) << "checking known-working testcase: " << fileName; - QCOMPARE(result, expectedData); - } - } else { - QSKIP("Warning! can't open testcase files for. Skiping testcase", SkipSingle); - continue; - } - } -} - -// vim: set noet ts=4 sts=4 sw=4: diff --git a/libkopete/tests/kopetemessage_test.h b/libkopete/tests/kopetemessage_test.h deleted file mode 100644 index 118495720..000000000 --- a/libkopete/tests/kopetemessage_test.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - Tests for Kopete::Message - - Copyright (c) 2005 by Duncan Mac-Vicar - Copyright (c) 2005 by Tommi Rantala - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#ifndef KOPETEMESSAGE_TEST_H -#define KOPETEMESSAGE_TEST_H - -#include - -#define private public -#include "kopetemessage.h" -#undef private - -namespace Kopete { -class Protocol; -class Account; -class MetaContact; -class Contact; -} - -// change to SlotTester when it works -class KopeteMessage_Test : public QObject -{ - Q_OBJECT -public: - KopeteMessage_Test(); - -private Q_SLOTS: - void testPrimitives(); - void testLinkParser(); - -private: - Kopete::Protocol *m_protocol; - Kopete::Account *m_account; - Kopete::MetaContact *m_metaContactMyself; - Kopete::MetaContact *m_metaContactOther; - Kopete::Contact *m_contactFrom; - Kopete::Contact *m_contactTo; -}; - -#endif diff --git a/libkopete/tests/kopetepasswordtest_program.cpp b/libkopete/tests/kopetepasswordtest_program.cpp deleted file mode 100644 index 8485aeda9..000000000 --- a/libkopete/tests/kopetepasswordtest_program.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - Tests for the Kopete::Password class - - Copyright (c) 2003 by Richard Smith - Kopete (c) 2002-2003 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#include "kopetepasswordtest_program.h" -#include "kopetepassword.h" - -#include -#include -#include - -#include -#include -#include "libkopete_debug.h" -#include - -#include - -static QTextStream _out(stdout, QIODevice::WriteOnly); - -using namespace Kopete; - -QString retrieve(Password &pwd, const QPixmap &image, const QString &prompt) -{ - PasswordRetriever r; - pwd.request(&r, SLOT(gotPassword(QString)), image, prompt); - QTimer tmr; - r.connect(&tmr, SIGNAL(timeout()), SLOT(timer())); - tmr.start(1000); - qApp->exec(); - return r.password; -} - -void PasswordRetriever::gotPassword(const QString &pass) -{ - password = pass; - qApp->quit(); -} - -void PasswordRetriever::timer() -{ - _out << "." << flush; -} - -int main(int argc, char *argv[]) -{ - KAboutData aboutData("kopetepasswordtest", 0, ki18n("kopetepasswordtest"), "version"); - KCmdLineArgs::init(argc, argv, &aboutData); - - KCmdLineOptions opts; - opts.add("id ", ki18n("Config group to store password in"), "TestAccount"); - opts.add("set ", ki18n("Set password to new")); - opts.add("error", ki18n("Claim password was erroneous")); - opts.add("prompt ", ki18n("Password prompt"), "Enter a password"); - opts.add("image ", ki18n("Image to display in password dialog")); - KCmdLineArgs::addCmdLineOptions(opts); - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - - KApplication app("kopetepasswordtest"); - - bool setPassword = args->isSet("set"); - QString newPwd = args->getOption("set"); - QString passwordId = args->getOption("id"); - bool error = args->isSet("error"); - QString prompt = args->getOption("prompt"); - QPixmap image = QString(args->getOption("image")); - - _out << (image.isNull() ? "image is null" : "image is valid") << endl; - - Password pwd(passwordId, 0, false); - pwd.setWrong(error); - - _out << "Cached value is null: " << pwd.cachedValue().isNull() << endl; - - QString pass = retrieve(pwd, image, prompt); - - if (!pass.isNull()) { - _out << "Read password: " << pass << endl; - } else { - _out << "Could not read a password" << endl; - } - - _out << "Cached value: " << (pwd.cachedValue().isNull() ? "null" : pwd.cachedValue()) << endl; - - if (setPassword) { - if (newPwd.isEmpty()) { - _out << "Clearing password" << endl; - newPwd.clear(); - } else { - _out << "Setting password to " << newPwd << endl; - } - pwd.set(newPwd); - } - - // without this, setting passwords will fail since they're - // set asynchronously. - QTimer::singleShot(0, &app, SLOT(deref())); - app.exec(); - - if (setPassword) { - pass = retrieve(pwd, image, i18n("Hopefully this popped up because you set the password to the empty string.")); - if (pass == newPwd) { - _out << "Password successfully set." << endl; - } else { - _out << "Failed: password ended up as " << pass << endl; - } - } - - return 0; -} - -// vim: set noet ts=4 sts=4 sw=4: diff --git a/libkopete/tests/kopetepasswordtest_program.h b/libkopete/tests/kopetepasswordtest_program.h deleted file mode 100644 index 81cbc9bc0..000000000 --- a/libkopete/tests/kopetepasswordtest_program.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef KOPETEPASSWORDTEST_H -#define KOPETEPASSWORDTEST_H - -#include - -class PasswordRetriever : public QObject -{ - Q_OBJECT -public: - QString password; -public Q_SLOTS: - void timer(); - void gotPassword(const QString &); -}; - -#endif diff --git a/libkopete/tests/kopetepropertiestest.cpp b/libkopete/tests/kopetepropertiestest.cpp deleted file mode 100644 index 327dc89f9..000000000 --- a/libkopete/tests/kopetepropertiestest.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - Tests for Kopete Properties - - Copyright (c) 2004 by Richard Smith - Copyright (c) 2005 by Duncan Mac-Vicar - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#include "kopetepropertiestest.h" - -#include - -#include "kopeteproperties.h" - -#include -#include - -#include -#include - -using namespace KUnitTest; - -KUNITTEST_MODULE(kunittest_kopetepropertiestest, "KopeteSuite"); -KUNITTEST_MODULE_REGISTER_TESTER(KopetePropertiesTest); - -using namespace Kopete::Properties; - -static QTextStream _out(stdout, QIODevice::WriteOnly); - -class PropertyHost : public WithProperties -{ -}; - -class FooProperty : public SimpleDataProperty -{ -public: - const char *name() const - { - return "foo"; - } -} fooProperty; - -void KopetePropertiesTest::allTests() -{ - PropertyHost myPropertyHost; - CHECK(myPropertyHost.property(fooProperty).isNull(), true); - myPropertyHost.setProperty(fooProperty, QString::fromLatin1("Foo!")); - CHECK(myPropertyHost.property(fooProperty), QString::fromLatin1("Foo!")); -} diff --git a/libkopete/tests/kopetepropertiestest.h b/libkopete/tests/kopetepropertiestest.h deleted file mode 100644 index 3c7860608..000000000 --- a/libkopete/tests/kopetepropertiestest.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Tests for Kopete Properties - - Copyright (c) 2004 by Richard Smith - Copyright (c) 2005 by Duncan Mac-Vicar - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#ifndef KOPETE_PROPERTIES_TEST_H -#define KOPETE_PROPERTIES_TEST_H - -#include - -// change to SlotTester when it works -class KopetePropertiesTest : public KUnitTest::Tester -{ -public: - void allTests(); -public Q_SLOTS: -private: -}; - -#endif diff --git a/libkopete/tests/kopetetask_test.cpp b/libkopete/tests/kopetetask_test.cpp deleted file mode 100644 index 844dd6a75..000000000 --- a/libkopete/tests/kopetetask_test.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - Tests for Kopete::Task - - Copyright (c) 2006 by Michaël Larouche - - Kopete (c) 2002-2006 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ -#include "kopetetask_test.h" -#include - -#include -#include - -#include -#include "libkopete_debug.h" - -#include -#include - -QTEST_KDEMAIN(KopeteTaskTest, GUI) - -const QString sampleString = QString("Sample string :) :D ;)"); - -ParseEmoticonTask::ParseEmoticonTask(const QString &sourceString) - : Kopete::Task() - , m_source(sourceString) -{ - QTimer::singleShot(0, this, SLOT(start())); -} - -void ParseEmoticonTask::start() -{ - parseEmoticon(m_source); -} - -void ParseEmoticonTask::parseEmoticon(const QString &value) -{ - m_parsed = Kopete::Emoticons::parseEmoticons(value, KEmoticonsTheme::RelaxedParse | KEmoticonsTheme::SkipHTML); - - if (m_parsed.isEmpty()) { - setError(100); - } - - emitResult(); -} - -void KopeteTaskTest::testEmoticonTask() -{ - ParseEmoticonTask *task = new ParseEmoticonTask(sampleString); - QSignalSpy spy(task, SIGNAL(result(KJob *))); - - // For the task to execute, we must manually call the event loop. - qApp->processEvents(); - - QCOMPARE(spy.count(), 1); - QCOMPARE(task->error(), 0); -} diff --git a/libkopete/tests/kopetetask_test.h b/libkopete/tests/kopetetask_test.h deleted file mode 100644 index 35187614e..000000000 --- a/libkopete/tests/kopetetask_test.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Tests for Kopete::Task - - Copyright (c) 2006 by Michaël Larouche - - Kopete (c) 2002-2006 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ -#ifndef KOPETETASK_TEST_H -#define KOPETETASK_TEST_H - -#include - -#include - -class ParseEmoticonTask : public Kopete::Task -{ - Q_OBJECT -public: - ParseEmoticonTask(const QString &sourceString); - - QString parseResult() const - { - return m_parsed; - } - -private Q_SLOTS: - void start(); - -private: - void parseEmoticon(const QString &value); - - QString m_source; - QString m_parsed; -}; - -class KopeteTaskTest : public QObject -{ - Q_OBJECT -private Q_SLOTS: - void testEmoticonTask(); -}; - -#endif diff --git a/libkopete/tests/kopetewallettest_program.cpp b/libkopete/tests/kopetewallettest_program.cpp deleted file mode 100644 index 8bc1b65b0..000000000 --- a/libkopete/tests/kopetewallettest_program.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - Tests for the wallet manager - - Copyright (c) 2003 by Richard Smith - Kopete (c) 2002-2003 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#include "kopetewallettest_program.h" - -#include -#include - -#include -#include -#include "libkopete_debug.h" -#include - -#include -#include - -#include "kopetewalletmanager.h" - -static QTextStream _out(stdout, QIODevice::WriteOnly); - -void closeWallet() -{ - Kopete::WalletManager::self()->closeWallet(); -} - -void delay() -{ - QTimer::singleShot(3000, qApp, SLOT(quit())); - qApp->exec(); -} - -void openWalletAsync() -{ - WalletReciever *r = new WalletReciever; - _out << "[ASYNC] About to open wallet, receiver: " << r << endl; - Kopete::WalletManager::self()->openWallet(r, SLOT(gotWallet(KWallet::Wallet *))); -} - -void WalletReciever::gotWallet(KWallet::Wallet *w) -{ - _out << "[ASYNC] Received wallet pointer: " << w << " for receiver: " << this << endl; -} - -void WalletReciever::timer() -{ - _out << "Timer..." << endl; -} - -int main(int argc, char *argv[]) -{ - KAboutData aboutData("kopetewallettest", 0, ki18n("kopetewallettest"), "version"); - KCmdLineArgs::init(argc, argv, &aboutData); - - KCmdLineOptions opts; - opts.add("+action"); - KCmdLineArgs::addCmdLineOptions(opts); - KApplication app("kopetewallettest"); - - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - - // must register with DCOP or async callbacks will fail - _out << "DCOP registration returned " << app.dcopClient()->registerAs(app.name()) << endl; - - for (int i = 0; i < args->count(); ++i) { - QString arg = args->arg(i); - _out << "Processing " << arg << endl; - if (arg == QString::fromLatin1("open")) { - openWalletAsync(); - } - if (arg == QString::fromLatin1("close")) { - closeWallet(); - } - if (arg == QString::fromLatin1("delay")) { - delay(); - } - _out << "Done." << endl; - } - - WalletReciever *r = new WalletReciever; - - QTimer timer; - r->connect(&timer, SIGNAL(timeout()), SLOT(timer())); - timer.start(1000); - - _out << "About to start 30 second event loop" << endl; - QTimer::singleShot(30000, qApp, SLOT(quit())); - return qApp->exec(); -} - -// vim: set noet ts=4 sts=4 sw=4: diff --git a/libkopete/tests/kopetewallettest_program.h b/libkopete/tests/kopetewallettest_program.h deleted file mode 100644 index a2ef3d45a..000000000 --- a/libkopete/tests/kopetewallettest_program.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef KOPETEWALLETTEST_H -#define KOPETEWALLETTEST_H - -#include - -namespace KWallet { -class Wallet; -} - -class WalletReciever : public QObject -{ - Q_OBJECT -public Q_SLOTS: - void timer(); -private Q_SLOTS: - void gotWallet(KWallet::Wallet *w); -}; - -#endif diff --git a/libkopete/tests/link-parser-testcases/broken-html-1.input b/libkopete/tests/link-parser-testcases/broken-html-1.input deleted file mode 100644 index ecaf4b7e0..000000000 --- a/libkopete/tests/link-parser-testcases/broken-html-1.input +++ /dev/null @@ -1 +0,0 @@ -$URL \ No newline at end of file diff --git a/libkopete/tests/link-parser-testcases/broken-html-1.output b/libkopete/tests/link-parser-testcases/broken-html-1.output deleted file mode 100644 index 5bf3f88a2..000000000 --- a/libkopete/tests/link-parser-testcases/broken-html-1.output +++ /dev/null @@ -1 +0,0 @@ -$URL diff --git a/libkopete/tests/link-parser-testcases/working-html-1.input b/libkopete/tests/link-parser-testcases/working-html-1.input deleted file mode 100644 index 306ab4580..000000000 --- a/libkopete/tests/link-parser-testcases/working-html-1.input +++ /dev/null @@ -1 +0,0 @@ -$URL \ No newline at end of file diff --git a/libkopete/tests/link-parser-testcases/working-html-1.output b/libkopete/tests/link-parser-testcases/working-html-1.output deleted file mode 100644 index ecaf4b7e0..000000000 --- a/libkopete/tests/link-parser-testcases/working-html-1.output +++ /dev/null @@ -1 +0,0 @@ -$URL \ No newline at end of file diff --git a/libkopete/tests/link-parser-testcases/working-html-2.input b/libkopete/tests/link-parser-testcases/working-html-2.input deleted file mode 100644 index 4480dee7b..000000000 --- a/libkopete/tests/link-parser-testcases/working-html-2.input +++ /dev/null @@ -1 +0,0 @@ -KDE \ No newline at end of file diff --git a/libkopete/tests/link-parser-testcases/working-html-2.output b/libkopete/tests/link-parser-testcases/working-html-2.output deleted file mode 100644 index 4480dee7b..000000000 --- a/libkopete/tests/link-parser-testcases/working-html-2.output +++ /dev/null @@ -1 +0,0 @@ -KDE \ No newline at end of file diff --git a/libkopete/tests/link-parser-testcases/working-plaintext-1.input b/libkopete/tests/link-parser-testcases/working-plaintext-1.input deleted file mode 100644 index 306ab4580..000000000 --- a/libkopete/tests/link-parser-testcases/working-plaintext-1.input +++ /dev/null @@ -1 +0,0 @@ -$URL \ No newline at end of file diff --git a/libkopete/tests/link-parser-testcases/working-plaintext-1.output b/libkopete/tests/link-parser-testcases/working-plaintext-1.output deleted file mode 100644 index ecaf4b7e0..000000000 --- a/libkopete/tests/link-parser-testcases/working-plaintext-1.output +++ /dev/null @@ -1 +0,0 @@ -$URL \ No newline at end of file diff --git a/libkopete/tests/link-parser-testcases/working-plaintext-2.input b/libkopete/tests/link-parser-testcases/working-plaintext-2.input deleted file mode 100644 index 14e0e6064..000000000 --- a/libkopete/tests/link-parser-testcases/working-plaintext-2.input +++ /dev/null @@ -1 +0,0 @@ -$URL/ \ No newline at end of file diff --git a/libkopete/tests/link-parser-testcases/working-plaintext-2.output b/libkopete/tests/link-parser-testcases/working-plaintext-2.output deleted file mode 100644 index 109c616b2..000000000 --- a/libkopete/tests/link-parser-testcases/working-plaintext-2.output +++ /dev/null @@ -1 +0,0 @@ -$URL/ \ No newline at end of file diff --git a/libkopete/tests/link-parser-testcases/working-plaintext-3.input b/libkopete/tests/link-parser-testcases/working-plaintext-3.input deleted file mode 100644 index 828cd483a..000000000 --- a/libkopete/tests/link-parser-testcases/working-plaintext-3.input +++ /dev/null @@ -1 +0,0 @@ -www.kde.org/ \ No newline at end of file diff --git a/libkopete/tests/link-parser-testcases/working-plaintext-3.output b/libkopete/tests/link-parser-testcases/working-plaintext-3.output deleted file mode 100644 index 9e898eb0b..000000000 --- a/libkopete/tests/link-parser-testcases/working-plaintext-3.output +++ /dev/null @@ -1 +0,0 @@ -www.kde.org/ \ No newline at end of file diff --git a/libkopete/tests/mock/CMakeLists.txt b/libkopete/tests/mock/CMakeLists.txt deleted file mode 100644 index 9350dc74d..000000000 --- a/libkopete/tests/mock/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ - - - - -########### next target ############### - - -########### install files ############### - - - - - diff --git a/libkopete/tests/mock/kopeteaccount_mock.cpp b/libkopete/tests/mock/kopeteaccount_mock.cpp deleted file mode 100644 index 9d6d09e1a..000000000 --- a/libkopete/tests/mock/kopeteaccount_mock.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - Account mock object class - - Copyright (c) 2005 by Duncan Mac-Vicar Prett - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#include "kopeteaccount_mock.h" -#include "kopetemetacontact.h" -#include "kopetestatusmessage.h" - -namespace Kopete { -namespace Test { -namespace Mock { -Account::Account(Kopete::Protocol *parent, const QString &accountID) - : Kopete::Account(parent, accountID) -{ -} - -Account::~Account() -{ -} - -bool Account::createContact(const QString &contactId, Kopete::MetaContact *parentContact) -{ - Q_UNUSED(contactId) - Q_UNUSED(parentContact) - return true; -} - -void Account::connect(const Kopete::OnlineStatus &initialStatus) -{ - Q_UNUSED(initialStatus) - // do nothing -} - -void Account::disconnect() -{ - // do nothing -} - -void Account::setOnlineStatus(const Kopete::OnlineStatus &status, const Kopete::StatusMessage &statusMessage, const OnlineStatusOptions &options) -{ - Q_UNUSED(status) - Q_UNUSED(statusMessage) - Q_UNUSED(options) - // do nothing -} - -void Account::setStatusMessage(const Kopete::StatusMessage &statusMessage) -{ - Q_UNUSED(statusMessage) - // do nothing -} -} // end ns Kopete::Test::Mock -} // end ns Kopete::Test -} // end ns Kopete diff --git a/libkopete/tests/mock/kopeteaccount_mock.h b/libkopete/tests/mock/kopeteaccount_mock.h deleted file mode 100644 index a19ad201a..000000000 --- a/libkopete/tests/mock/kopeteaccount_mock.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - Account mock object class - - Copyright (c) 2005 by Duncan Mac-Vicar Prett - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#ifndef _KOPETEACCOUNT_MOCK_H_ -#define _KOPETEACCOUNT_MOCK_H_ - -#include "kopeteaccount.h" - -namespace Kopete { -class Protocol; -class OnlineStatus; -class StatusMessage; -} - -class QString; - -namespace Kopete { -namespace Test { -namespace Mock { -class Account : public Kopete::Account -{ -public: - Account(Kopete::Protocol *parent, const QString &accountID); - ~Account(); - // pure virtual functions implementation - virtual bool createContact(const QString &contactId, MetaContact *parentContact); - virtual void connect(const Kopete::OnlineStatus &initialStatus = OnlineStatus()); - virtual void disconnect(); - virtual void setOnlineStatus(const Kopete::OnlineStatus &status, const Kopete::StatusMessage &statusMessage = Kopete::StatusMessage(), const OnlineStatusOptions &options = None); - virtual void setStatusMessage(const Kopete::StatusMessage &statusMessage); -}; -} // end ns Kopete::Test::Mock -} // end ns Kopete::Test -} // end ns Kopete - -#endif diff --git a/libkopete/tests/mock/kopetecontact_mock.cpp b/libkopete/tests/mock/kopetecontact_mock.cpp deleted file mode 100644 index 9a6d2b61c..000000000 --- a/libkopete/tests/mock/kopetecontact_mock.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - Contact mock object class - - Copyright (c) 2005 by Duncan Mac-Vicar Prett - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#include "kopetecontact_mock.h" - -namespace Kopete { -namespace Test { -namespace Mock { -Contact::Contact(Kopete::Account *account, const QString &id, Kopete::MetaContact *parent, const QString &icon) : Kopete::Contact(account, id, parent, icon) -{ -} - -Contact::~Contact() -{ -} - -Kopete::ChatSession *Contact::manager(CanCreateFlags canCreate) -{ - Q_UNUSED(canCreate) - return 0L; -} -} // end ns Kopete::Test::Mock -} // end ns Kopete::Test -} // end ns Kopete diff --git a/libkopete/tests/mock/kopetecontact_mock.h b/libkopete/tests/mock/kopetecontact_mock.h deleted file mode 100644 index 38608ab94..000000000 --- a/libkopete/tests/mock/kopetecontact_mock.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Contact mock object class - - Copyright (c) 2005 by Duncan Mac-Vicar Prett - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#ifndef _KOPETECONTACT_MOCK_H_ -#define _KOPETECONTACT_MOCK_H_ - -#include "kopetecontact.h" - -namespace Kopete { -class MetaContact; -class Account; -class ChatSession; -} -class QString; - -namespace Kopete { -namespace Test { -namespace Mock { -class Contact : public Kopete::Contact -{ -public: - Contact(Kopete::Account *account, const QString &id, Kopete::MetaContact *parent, const QString &icon = QString()); - ~Contact(); - virtual Kopete::ChatSession *manager(CanCreateFlags canCreate = CannotCreate); -}; -} // end ns Kopete::Test::Mock -} // end ns Kopete::Test -} // end ns Kopete - -#endif diff --git a/libkopete/tests/mock/kopetemessage_mock.cpp b/libkopete/tests/mock/kopetemessage_mock.cpp deleted file mode 100644 index a0086a0f6..000000000 --- a/libkopete/tests/mock/kopetemessage_mock.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* - Message mock object class - - Copyright (c) 2005 by Duncan Mac-Vicar Prett - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#include "kopetemessage_mock.h" diff --git a/libkopete/tests/mock/kopetemessage_mock.h b/libkopete/tests/mock/kopetemessage_mock.h deleted file mode 100644 index 561e98461..000000000 --- a/libkopete/tests/mock/kopetemessage_mock.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Message mock object class - - Copyright (c) 2005 by Duncan Mac-Vicar Prett - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#ifndef _KOPETEMESSAGE_MOCK_H_ -#define _KOPETEMESSAGE_MOCK_H_ - -#include "kopetemessage.h" - -namespace Kopete { -namespace Test { -namespace Mock { -class Message : public Kopete::Message -{ -}; -} // end ns Kopete::Test::Mock -} // end ns Kopete::Test -} // end ns Kopete - -#endif diff --git a/libkopete/tests/mock/kopetemetacontact_mock.cpp b/libkopete/tests/mock/kopetemetacontact_mock.cpp deleted file mode 100644 index 7ba58250a..000000000 --- a/libkopete/tests/mock/kopetemetacontact_mock.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* - MetaContact Mock Object class - - Copyright (c) 2005 by Duncan Mac-Vicar Prett - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#include "kopetemetacontact_mock.h" diff --git a/libkopete/tests/mock/kopetemetacontact_mock.h b/libkopete/tests/mock/kopetemetacontact_mock.h deleted file mode 100644 index 73886c430..000000000 --- a/libkopete/tests/mock/kopetemetacontact_mock.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - MetaContact Mock Object - - Copyright (c) 2005 by Duncan Mac-Vicar Prett - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#ifndef _KOPETEMETACONTACT_MOCK_H_ -#define _KOPETEMETACONTACT_MOCK_H_ - -#include "kopetemetacontact.h" - -namespace Kopete { -namespace Test { -namespace Mock { -class MetaContact : public Kopete::MetaContact -{ -}; -} // end ns Kopete::Test::Mock -} // end ns Kopete::Test -} // end ns Kopete - -#endif diff --git a/libkopete/tests/mock/kopeteprotocol_mock.cpp b/libkopete/tests/mock/kopeteprotocol_mock.cpp deleted file mode 100644 index bfe034b9a..000000000 --- a/libkopete/tests/mock/kopeteprotocol_mock.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - Protocol mock object class - - Copyright (c) 2005 by Duncan Mac-Vicar Prett - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#include "kopeteprotocol_mock.h" - -namespace Kopete { -namespace Test { -namespace Mock { -Protocol::Protocol(const KComponentData &instance, QObject *parent) - : Kopete::Protocol(instance, parent) -{ -} - -Account *Protocol::createNewAccount(const QString &accountId) -{ - Q_UNUSED(accountId) - return 0L; -} - -AddContactPage *Protocol::createAddContactWidget(QWidget *parent, Kopete::Account *account) -{ - Q_UNUSED(parent) - Q_UNUSED(account) - return 0L; -} - -KopeteEditAccountWidget *Protocol::createEditAccountWidget(Kopete::Account *account, QWidget *parent) -{ - Q_UNUSED(account) - Q_UNUSED(parent) - return 0L; -} -} // end ns mock -} // end ns test -} // end ns kopete diff --git a/libkopete/tests/mock/kopeteprotocol_mock.h b/libkopete/tests/mock/kopeteprotocol_mock.h deleted file mode 100644 index ae1555040..000000000 --- a/libkopete/tests/mock/kopeteprotocol_mock.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - Protocol mock object class - - Copyright (c) 2005 by Duncan Mac-Vicar Prett - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#ifndef _KOPETEPROTOCOL_MOCK_H_ -#define _KOPETEPROTOCOL_MOCK_H_ - -#include "kopeteprotocol.h" - -class KComponentData; -class QObject; - -class KopeteEditAccountWidget; -class AddContactPage; -class KopeteEditAccountWidget; - -namespace Kopete { -namespace Test { -namespace Mock { -class Protocol : public Kopete::Protocol -{ -public: - Protocol(const KComponentData &instance, QObject *parent); - // pure virtual functions implemented - virtual Account *createNewAccount(const QString &accountId); - virtual AddContactPage *createAddContactWidget(QWidget *parent, Kopete::Account *account); - virtual KopeteEditAccountWidget *createEditAccountWidget(Kopete::Account *account, QWidget *parent); -}; -} // end ns Kopete::Test::Mock -} // end ns Kopete::Test -} // end ns Kopete - -#endif diff --git a/libkopete/tests/statusmessage_test.cpp b/libkopete/tests/statusmessage_test.cpp deleted file mode 100644 index 1fc362221..000000000 --- a/libkopete/tests/statusmessage_test.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - Unit test for Kopete::StatusMessage class. - - Copyright (c) 2006 by Michaël Larouche - - Kopete (c) 2002-2006 by the Kopete developers - - ************************************************************************* - * * - * 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 of the License, or (at your option) any later version. * - * * - ************************************************************************* -*/ -#include "statusmessage_test.h" - -#include -#include -#include - -#include "kopetestatusmessage.h" - -QTEST_KDEMAIN(StatusMessage_Test, GUI) - -void StatusMessage_Test::testNormalStatus() -{ - Kopete::StatusMessage status1; - status1.setMessage(QLatin1String("http://kopete.kde.org/")); - - QCOMPARE(status1.message(), QString("http://kopete.kde.org/")); - - Kopete::StatusMessage status2(QLatin1String("QTestLib rocks !")); - - QCOMPARE(status2.message(), QString("QTestLib rocks !")); -} - -void StatusMessage_Test::testMusicMetaData() -{ - Kopete::StatusMessage status2; - status2.setMessage(QLatin1String("Jordan Rudess = keyboard god")); - - status2.addMetaData(QLatin1String("musicPlayer"), QString("amaroK")); - status2.addMetaData(QLatin1String("artist"), QString("Dream Theater")); - status2.addMetaData(QLatin1String("title"), QString("Beyond This Life")); - status2.addMetaData(QLatin1String("album"), QString("Live Scenes From New York")); - - QCOMPARE(status2.hasMetaData("hjjhadhasdasd"), false); - QCOMPARE(status2.hasMetaData("artist"), true); - QCOMPARE(status2.metaData("artist").toString(), QString("Dream Theater")); - QCOMPARE(status2.message(), QString("Jordan Rudess = keyboard god")); -} - -void StatusMessage_Test::testAppendHash() -{ - Kopete::StatusMessage status3; - status3.setMessage(QLatin1String("Jordan Rudess = keyboard god")); - - status3.addMetaData(QLatin1String("musicPlayer"), QString("amaroK")); - status3.addMetaData(QLatin1String("artist"), QString("Dream Theater")); - status3.addMetaData(QLatin1String("title"), QString("Beyond This Life")); - status3.addMetaData(QLatin1String("album"), QString("Live Scenes From New York")); - - QCOMPARE(status3.metaData("artist").toString(), QString("Dream Theater")); - QCOMPARE(status3.metaData("title").toString(), QString("Beyond This Life")); - - QHash metadataHash; - metadataHash.insert(QLatin1String("artist"), QLatin1String("Iron Maiden")); - metadataHash.insert(QLatin1String("title"), QLatin1String("Blood Brothers")); - - status3.addMetaData(metadataHash); - - QCOMPARE(status3.metaData("artist").toString(), QString("Iron Maiden")); - QCOMPARE(status3.metaData("title").toString(), QString("Blood Brothers")); - QCOMPARE(status3.metaData("album").toString(), QString("Live Scenes From New York")); -} diff --git a/libkopete/tests/statusmessage_test.h b/libkopete/tests/statusmessage_test.h deleted file mode 100644 index 30b37bc8f..000000000 --- a/libkopete/tests/statusmessage_test.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - Unit test for Kopete::StatusMessage class. - - Copyright (c) 2006 by Michaël Larouche - - Kopete (c) 2002-2006 by the Kopete developers - - ************************************************************************* - * * - * 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 of the License, or (at your option) any later version. * - * * - ************************************************************************* -*/ -#ifndef KOPETESTATUSMESSAGE_TEST_H -#define KOPETESTATUSMESSAGE_TEST_H - -#include - -class StatusMessage_Test : public QObject -{ - Q_OBJECT -private Q_SLOTS: - void testNormalStatus(); - void testMusicMetaData(); - void testAppendHash(); -}; -#endif diff --git a/libkopete/tests/template_test.cpp b/libkopete/tests/template_test.cpp deleted file mode 100644 index 83e253451..000000000 --- a/libkopete/tests/template_test.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - Tests for some requirement - - Copyright (c) 2005 by Duncan Mac-Vicar - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#include "template_test.h" -#include - -using namespace KUnitTest; - -KUNITTEST_MODULE(kunittest_template_test, "KopeteSuite"); -KUNITTEST_MODULE_REGISTER_TESTER(Template_Test); - -void Template_Test::allTests() -{ - testSomething(); -} - -void Template_Test::testSomething() -{ - int result = 1; - int expected = 1; - // result should be the expected one - CHECK(result, expected); -} diff --git a/libkopete/tests/template_test.h b/libkopete/tests/template_test.h deleted file mode 100644 index 6ff9bbed2..000000000 --- a/libkopete/tests/template_test.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Tests for some requirement - - Copyright (c) 2005 by Duncan Mac-Vicar - - Kopete (c) 2002-2005 by the Kopete developers - - ************************************************************************* - * * - * 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. * - * * - ************************************************************************* -*/ - -#ifndef TEMPLATE_TEST_H -#define TEMPLATE_TEST_H - -#include - -// change to SlotTester when it works -class Template_Test : public KUnitTest::Tester -{ -public: - void allTests(); -public Q_SLOTS: - void testSomething(); -private: -}; - -#endif diff --git a/libkopete/tests/xmlcontactstorage_test.cpp b/libkopete/tests/xmlcontactstorage_test.cpp deleted file mode 100644 index 6dbb84457..000000000 --- a/libkopete/tests/xmlcontactstorage_test.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - Unit test for Kopete::StatusMessage class. - - Copyright (c) 2006 by Michaël Larouche - - Kopete (c) 2002-2006 by the Kopete developers - - ************************************************************************* - * * - * 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 of the License, or (at your option) any later version. * - * * - ************************************************************************* -*/ -#include "xmlcontactstorage_test.h" - -// Qt includes -#include - -// KDE includes -#include - -// Kopete includes -#include "kopetecontactliststorage.h" -#include "xmlcontactstorage.h" -#include "kopetegroup.h" -#include "kopetemetacontact.h" - -QTEST_KDEMAIN(XmlContactStorage_Test, GUI) - -QStringList expectedGroupList() -{ - QStringList groupList; - - groupList << QString("Kopete Developers"); - groupList << QString("Kontact Developers"); - groupList << QString("Users"); - groupList << QString("Friends & Family"); - groupList << QString("Top Level"); - - return groupList; -} - -QStringList expectedContactList() -{ - QStringList contactList; - - contactList << QString("Duncan Mac-Vicar Prett"); - contactList << QString("Olivier Goffart"); - contactList << QString("Matt Rogers"); - contactList << QString("Will Stephenson"); - // NOTE: We need ::fromUtf8 so those string will be really read as UTF8, otherwise test fail. - contactList << QString::fromUtf8("Michaël Larouche"); - contactList << QString::fromUtf8("André Duffeck"); - - return contactList; -} - -void XmlContactStorage_Test::testLoad() -{ - // TODO: Check plugin data. - // TODO: Check more things. - QString xmlFilename = QString(SRCDIR) + QString("xmlcontactstorage_test_list.xml"); - - Kopete::ContactListStorage *storage = new Kopete::XmlContactStorage(xmlFilename); - storage->load(); - - // Verify that the loading went well. - QVERIFY(storage->isValid()); - // Check that we have the correct numbers of groups and contacts. - QCOMPARE(storage->groups().size(), 5); - QCOMPARE(storage->contacts().size(), 6); - - // Verify that we parsed the correct group names. - QStringList groupNameList = expectedGroupList(); - QStringList::ConstIterator expectedIt, expectedItEnd = groupNameList.constEnd(); - - uint groupId = 1; - Kopete::Group::List loadGroupList = storage->groups(); - Kopete::Group::List::ConstIterator it, itEnd = loadGroupList.constEnd(); - for (it = loadGroupList.constBegin(), expectedIt = groupNameList.constBegin(); - it != itEnd, expectedIt != expectedItEnd; - ++it, ++expectedIt) { - Kopete::Group *group = (*it); - QString groupName = group->displayName(); - QString expectedGroupName = (*expectedIt); - QCOMPARE(groupName, expectedGroupName); - QCOMPARE(group->groupId(), groupId++); - } - - // Verify that we parsed the correct contacts. - QStringList contactList = expectedContactList(); - QStringList::ConstIterator contactIt, contactItEnd = contactList.constEnd(); - - Kopete::MetaContact::List loadContactList = storage->contacts(); - Kopete::MetaContact::List::ConstIterator loadContactIt, loadContactItEnd = loadContactList.constEnd(); - for (loadContactIt = loadContactList.constBegin(), contactIt = contactList.constBegin(); - loadContactIt != loadContactItEnd, contactIt != contactItEnd; - ++loadContactIt, ++contactIt) { - Kopete::MetaContact *contact = (*loadContactIt); - QString expectedContactName = (*contactIt); - - QCOMPARE(contact->displayName(), expectedContactName); - QCOMPARE((int)contact->displayNameSource(), (int)Kopete::MetaContact::SourceCustom); - } -} diff --git a/libkopete/tests/xmlcontactstorage_test.h b/libkopete/tests/xmlcontactstorage_test.h deleted file mode 100644 index 8932c8897..000000000 --- a/libkopete/tests/xmlcontactstorage_test.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - Unit test for Kopete::StatusMessage class. - - Copyright (c) 2006 by Michaël Larouche - - Kopete (c) 2002-2006 by the Kopete developers - - ************************************************************************* - * * - * 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 of the License, or (at your option) any later version. * - * * - ************************************************************************* -*/ -#ifndef KOPETEXMLCONTACTSTORAGE_TEST_H -#define KOPETEXMLCONTACTSTORAGE_TEST_H - -#include - -class XmlContactStorage_Test : public QObject -{ - Q_OBJECT -private Q_SLOTS: - void testLoad(); -}; - -#endif diff --git a/libkopete/tests/xmlcontactstorage_test_list.xml b/libkopete/tests/xmlcontactstorage_test_list.xml deleted file mode 100644 index 089b431e5..000000000 --- a/libkopete/tests/xmlcontactstorage_test_list.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - Kopete Developers - - - Kontact Developers - - - Users - - - Friends & Family - - - Duncan Mac-Vicar Prett - - - - - - - - - - - Olivier Goffart - - - - - - - - - - - Matt Rogers - - - - - - - - - - - Will Stephenson - - - - - - - - - - - Michaël Larouche - - - - - - - - - - - André Duffeck - - - - - - - - - - diff --git a/protocols/oscar/liboscar/CMakeLists.txt b/protocols/oscar/liboscar/CMakeLists.txt index 6e662bee4..e70977d28 100644 --- a/protocols/oscar/liboscar/CMakeLists.txt +++ b/protocols/oscar/liboscar/CMakeLists.txt @@ -1,106 +1,98 @@ - -add_subdirectory( tests ) - include_directories( ${KOPETE_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/utils ${CMAKE_CURRENT_SOURCE_DIR}/tasks ) ########### next target ############### -set(liboscar_SRCS +set(liboscar_SRCS oscarutils.cpp client.cpp inputprotocolbase.cpp coreprotocol.cpp flapprotocol.cpp snacprotocol.cpp oftprotocol.cpp ofttransfer.cpp transfer.cpp oscarclientstream.cpp safedelete.cpp stream.cpp buffer.cpp rateclassmanager.cpp contactmanager.cpp contact.cpp rateclass.cpp rateclass.h connection.cpp userdetails.cpp oscartypeclasses.cpp oscarmessage.cpp icquserinfo.cpp oscarsettings.cpp connectionhandler.cpp oscarguid.cpp oscarmessageplugin.cpp oftmetatransfer.cpp xtrazxawayservice.cpp xtrazxservice.cpp xtrazxtraznotify.cpp xtrazxrandomizerservice.cpp filetransferhandler.cpp chatroomhandler.cpp tasks/task.cpp tasks/logintask.cpp tasks/oscarlogintask.cpp tasks/closeconnectiontask.cpp tasks/serverversionstask.cpp tasks/rateinfotask.cpp tasks/errortask.cpp tasks/locationrightstask.cpp tasks/profiletask.cpp tasks/blmlimitstask.cpp tasks/servicesetuptask.cpp tasks/icbmparamstask.cpp tasks/prmparamstask.cpp tasks/ssiparamstask.cpp tasks/ssilisttask.cpp tasks/ssiactivatetask.cpp tasks/clientreadytask.cpp tasks/senddcinfotask.cpp tasks/sendidletimetask.cpp tasks/ownuserinfotask.cpp tasks/onlinenotifiertask.cpp tasks/ssimodifytask.cpp tasks/messagereceivertask.cpp tasks/messageacktask.cpp tasks/sendmessagetask.cpp tasks/icqtask.cpp tasks/offlinemessagestask.cpp tasks/ssiauthtask.cpp tasks/userinfotask.cpp tasks/icquserinfotask.cpp tasks/usersearchtask.cpp tasks/warningtask.cpp tasks/typingnotifytask.cpp tasks/buddyicontask.cpp tasks/serverredirecttask.cpp tasks/filetransfertask.cpp tasks/chatnavservicetask.cpp tasks/chatservicetask.cpp tasks/icquserinfoupdatetask.cpp tasks/icqchangepasswordtask.cpp tasks/icqtlvinforequesttask.cpp tasks/icqtlvinfoupdatetask.cpp tasks/chatroomtask.cpp utils/rtf.cc ) add_library( oscar SHARED ${liboscar_SRCS} ) generate_export_header(oscar BASE_NAME oscar) target_link_libraries( oscar KF5::KDELibs4Support Qt5::Gui Qt5::Network Qt5::Xml ) set_target_properties( oscar PROPERTIES VERSION 1.0.0 SOVERSION 1 ) install(TARGETS oscar ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) ########### install files ############### - - - - - diff --git a/protocols/oscar/liboscar/tests/CMakeLists.txt b/protocols/oscar/liboscar/tests/CMakeLists.txt deleted file mode 100644 index 8f660369e..000000000 --- a/protocols/oscar/liboscar/tests/CMakeLists.txt +++ /dev/null @@ -1,84 +0,0 @@ -add_definitions("-DKDESRCDIR=\"${CMAKE_CURRENT_BINARY_DIR}\"") - - -include_directories( - ${KOPETE_SOURCE_DIR}/protocols/oscar/liboscar - ${KOPETE_SOURCE_DIR}/protocols/oscar/liboscar/utils - ${KOPETE_SOURCE_DIR}/protocols/oscar/liboscar/tasks - ${KOPETE_INCLUDES} -) - -set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) - -link_directories( ${CMAKE_CURRENT_BINARY_DIR}/../ ) - -set(LIBOSCAR_TEST_LIBRARIES KF5::KDELibs4Support oscar Qt5::Test) - -########### next target ############### - -set(buffertest_SRCS buffertest.cpp ) - -add_executable(buffertest ${buffertest_SRCS}) -add_test(buffertest buffertest) -ecm_mark_as_test(buffertest) - -target_link_libraries(buffertest ${LIBOSCAR_TEST_LIBRARIES} ) - - - -########### next target ############### - -set(serverversionstest_SRCS serverversionstest.cpp oscartestbase.cpp ) - - -add_executable(serverversionstest ${serverversionstest_SRCS}) -add_test(serverversionstest serverversionstest) -ecm_mark_as_test(serverversionstest) - -target_link_libraries(serverversionstest ${LIBOSCAR_TEST_LIBRARIES} ) - - - -########### next target ############### - -set(connectiontest_SRCS connectiontest.cpp oscartestbase.cpp ) - - -add_executable(connectiontest ${connectiontest_SRCS}) -add_test(connectiontest connectiontest) -ecm_mark_as_test(connectiontest) - -target_link_libraries(connectiontest ${LIBOSCAR_TEST_LIBRARIES}) - - - -########### next target ############### - -set(rateinfotest_SRCS rateinfotest.cpp oscartestbase.cpp ) - - -add_executable(rateinfotest ${rateinfotest_SRCS}) -add_test(rateinfotest rateinfotest) -ecm_mark_as_test(rateinfotest) - -target_link_libraries(rateinfotest ${LIBOSCAR_TEST_LIBRARIES}) - - - -########### next target ############### - -set(filetransfertest_SRCS filetransfertest.cpp oscartestbase.cpp ) - - -add_executable(filetransfertest ${filetransfertest_SRCS}) -add_test(filetransfertest filetransfertest) -ecm_mark_as_test(filetransfertest) - -target_link_libraries(filetransfertest ${LIBOSCAR_TEST_LIBRARIES} ) - - - - -######################################## - - diff --git a/protocols/oscar/liboscar/tests/aimlogintasktest.cpp b/protocols/oscar/liboscar/tests/aimlogintasktest.cpp deleted file mode 100644 index 59c2ecd1a..000000000 --- a/protocols/oscar/liboscar/tests/aimlogintasktest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - AIM Login Task Test - - Copyright (c) 2006 by Matt Rogers - - Kopete (c) 2002-2006 by the Kopete developers - - ************************************************************************* - * * - * 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 of the License, or (at your option) any later version. * - * * - ************************************************************************* -*/ - -#include "aimlogintasktest.h" -#include "buffer.h" -#include "aimlogintask.h" - -OSCAR_TEST_MAIN( AimLoginTaskTest ) - -void AimLoginTaskTest::testAuthString() -{ - if ( ! loadFile("snac1707.buffer") ) - { - QFAIL("couldn't load test data file"); - } - - QByteArray challenge = AimLoginTask::parseAuthString( m_data ); - QVERIFY( challenge == "2000900472" ); - -} - diff --git a/protocols/oscar/liboscar/tests/aimlogintasktest.h b/protocols/oscar/liboscar/tests/aimlogintasktest.h deleted file mode 100644 index fa9cf3db8..000000000 --- a/protocols/oscar/liboscar/tests/aimlogintasktest.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - AIM Login Task Test - - Copyright (c) 2006 by Matt Rogers - - Kopete (c) 2002-2006 by the Kopete developers - - ************************************************************************* - * * - * 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 of the License, or (at your option) any later version. * - * * - ************************************************************************* -*/ - -#ifndef AIMLOGINTASKTEST_H -#define AIMLOGINTASKTEST_H - -#include "oscartestbase.h" - -class AimLoginTaskTest : public OscarTestBase -{ -Q_OBJECT -private Q_SLOTS: - void testAuthString(); - -}; - -#endif diff --git a/protocols/oscar/liboscar/tests/buffertest.h b/protocols/oscar/liboscar/tests/buffertest.h deleted file mode 100644 index d0610c8e4..000000000 --- a/protocols/oscar/liboscar/tests/buffertest.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef BUFFERTEST_H -#define BUFFERTEST_H - -#include - -class BufferTest : public QObject -{ -Q_OBJECT -private Q_SLOTS: - void testAddByte(); - void testAddWord(); - void testAddDWord(); - void testGetTLV(); - void testBytesAvailable(); - void testLength(); - void testGuid(); - -}; - -#endif diff --git a/protocols/oscar/liboscar/tests/logintest.cpp b/protocols/oscar/liboscar/tests/logintest.cpp deleted file mode 100644 index 1a62726af..000000000 --- a/protocols/oscar/liboscar/tests/logintest.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//Licensed under the GNU General Public License - -#include "logintest.h" -#include - -LoginTest::LoginTest(int argc, char ** argv) : QApplication( argc, argv ) -{ - // notify when the transport layer is connected - //connect( myTestObject, SIGNAL(connected()), SLOT(slotConnected()) ); - myClient = new Client(); - - // do test once the event loop is running - QTimer::singleShot( 0, this, SLOT(slotDoTest()) ); - connected = false; -} - -LoginTest::~LoginTest() -{ - delete myTestObject; - delete myClient; -} - -void LoginTest::slotDoTest() -{ - QString server = QString::fromLatin1("login.oscar.aol.com"); - // connect to server - qDebug( "connecting to server "); - - myClient->setIsIcq( true ); - myClient->start( server, 5190, "userid", "password" ); - myClient->connectToServer( server, 5190, false, QString() ); - connected = true; -} - -void LoginTest::slotConnected() -{ - qDebug( "connection is up"); - connected = true; -} - -int main(int argc, char ** argv) -{ - LoginTest a( argc, argv ); - a.exec(); - if ( !a.isConnected() ) - return 0; -} - diff --git a/protocols/oscar/liboscar/tests/logintest.h b/protocols/oscar/liboscar/tests/logintest.h deleted file mode 100644 index 93394732b..000000000 --- a/protocols/oscar/liboscar/tests/logintest.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// C++ Implementation: clientstream_test -// -// Description: -// -// -// Author: Kopete Developers , (C) 2004 -// Licensed under the GNU General Public License - -#ifndef logintest_h -#define logintest_h - -#include -#include -#include - -#include "client.h" -#include "coreprotocol.h" - -#define QT_FATAL_ASSERT 1 - -class LoginTest : public QApplication -{ -Q_OBJECT -public: - LoginTest(int argc, char ** argv); - - ~LoginTest(); - - bool isConnected() { return connected; } - -public Q_SLOTS: - void slotDoTest(); - - void slotConnected(); - - //void slotWarning(int warning); - - //void slotsend(int layer); - -private: - Client* myClient; - - bool connected; -}; - -#endif diff --git a/protocols/oscar/liboscar/tests/main.cpp b/protocols/oscar/liboscar/tests/main.cpp deleted file mode 100644 index 499669240..000000000 --- a/protocols/oscar/liboscar/tests/main.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * main.cpp - * - * Copyright (C) 2004 Zack Rusin - * - * 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.h" - -int main( int argc, char** argv ) -{ - Q_UNUSED( argc ); - Q_UNUSED( argv ); - KUnitTest tests; - return tests.runTests(); -} diff --git a/protocols/oscar/liboscar/tests/rateinfotest.cpp b/protocols/oscar/liboscar/tests/rateinfotest.cpp deleted file mode 100644 index 180aff281..000000000 --- a/protocols/oscar/liboscar/tests/rateinfotest.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - Server Versions Task Test - - Copyright (c) 2006 by Matt Rogers - - Kopete (c) 2002-2006 by the Kopete developers - - ************************************************************************* - * * - * 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 of the License, or (at your option) any later version. * - * * - ************************************************************************* -*/ - -#include "rateinfotest.h" -#include "rateinfotask.h" -#include "buffer.h" -#include "rateclass.h" - -OSCAR_TEST_MAIN( RateInfoTest ) - -void RateInfoTest::testRateClasses() -{ - if ( ! loadFile(QStringLiteral("snac0107.buffer")) ) - { - QFAIL("couldn't load test data file"); - } - //m_data should now be a buffer with our data - - QList rates = RateInfoTask::parseRateClasses( m_data ); - - QVERIFY( rates.isEmpty() == false ); - QVERIFY( rates.count() == 5 ); - - //verify each rate class - QList::iterator it = rates.begin(); - QList::iterator rcEnd = rates.end(); - for ( int i=1; it != rcEnd; ++it, ++i ) - { - RateClass *r = *it; - QVERIFY( r->id() == i ); - Oscar::RateInfo ri = r->getRateInfo(); - - //now we have to verify everything in the struct - if ( i < 3 ) - { - QVERIFY( ri.windowSize == 0x50 ); - QVERIFY( ri.alertLevel == 0x7d0 ); - QVERIFY( ri.limitLevel == 0x5dc ); - QVERIFY( ri.maxLevel == 0x1770 ); - if ( i==1 ) - { - QVERIFY( ri.clearLevel == 0x9c4 ); - QVERIFY( ri.disconnectLevel == 0x320 ); - QVERIFY( ri.currentLevel == 0x16dd ); - } - else - { - QVERIFY( ri.clearLevel == 0xbb8 ); - QVERIFY( ri.disconnectLevel == 0x3e8 ); - QVERIFY( ri.currentLevel == 0x1770 ); - } - } - else if ( i==3 ) - { - QVERIFY( ri.windowSize == 0x14 ); - QVERIFY( ri.clearLevel == 0xc1c ); - QVERIFY( ri.alertLevel == 0x9c4 ); - QVERIFY( ri.limitLevel == 0x7d0 ); - QVERIFY( ri.disconnectLevel == 0x5dc ); - QVERIFY( ri.currentLevel == 0xdac ); - QVERIFY( ri.maxLevel == 0x1194 ); - } - else // i>3 - { - if ( i==4 ) - QVERIFY( ri.windowSize == 0x14 ); - else - QVERIFY( ri.windowSize == 0xa ); - QVERIFY( ri.clearLevel == 0x157c ); - QVERIFY( ri.alertLevel == 0x14b4 ); - QVERIFY( ri.limitLevel == 0x1068 ); - QVERIFY( ri.disconnectLevel == 0xbb8 ); - QVERIFY( ri.currentLevel == 0x1770 ); - QVERIFY( ri.maxLevel == 0x1f40 ); - } - if ( i==1 ) - QVERIFY( ri.lastTime == 0 ); - else - QVERIFY( ri.lastTime == 0xcd ); - QVERIFY( ri.currentState == 0 ); - - //we won't bother verifying the rate group stuff, it's not important. - } -} - diff --git a/protocols/oscar/liboscar/tests/rateinfotest.h b/protocols/oscar/liboscar/tests/rateinfotest.h deleted file mode 100644 index ad2aec920..000000000 --- a/protocols/oscar/liboscar/tests/rateinfotest.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - Rate Info Task Test - - Copyright (c) 2006 by Matt Rogers - - Kopete (c) 2002-2006 by the Kopete developers - - ************************************************************************* - * * - * 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 of the License, or (at your option) any later version. * - * * - ************************************************************************* -*/ - -#ifndef RATEINFOTASKTEST_H -#define RATEINFOTASKTEST_H - -#include "oscartestbase.h" - -class RateInfoTest : public OscarTestBase -{ -Q_OBJECT -private Q_SLOTS: - void testRateClasses(); -}; - -#endif diff --git a/protocols/oscar/liboscar/tests/snac0107.buffer b/protocols/oscar/liboscar/tests/snac0107.buffer deleted file mode 100644 index a620c7374..000000000 Binary files a/protocols/oscar/liboscar/tests/snac0107.buffer and /dev/null differ diff --git a/protocols/oscar/liboscar/tests/snac1503.buffer b/protocols/oscar/liboscar/tests/snac1503.buffer deleted file mode 100644 index 9c790730a..000000000 Binary files a/protocols/oscar/liboscar/tests/snac1503.buffer and /dev/null differ diff --git a/protocols/oscar/liboscar/tests/snac1707.buffer b/protocols/oscar/liboscar/tests/snac1707.buffer deleted file mode 100644 index 0a4454b67..000000000 Binary files a/protocols/oscar/liboscar/tests/snac1707.buffer and /dev/null differ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100755 index 000000000..5d911160d --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(kopete) +add_subdirectory(libkopete) +add_subdirectory(protocols) +add_subdirectory(plugins) diff --git a/tests/kopete/CMakeLists.txt b/tests/kopete/CMakeLists.txt new file mode 100755 index 000000000..2f9b0db82 --- /dev/null +++ b/tests/kopete/CMakeLists.txt @@ -0,0 +1,23 @@ +include_directories( + ${KOPETE_INCLUDES} +) + +link_directories( + ${KOPETE_BINARY_DIR}/libkopete +) + +set( + kopete_libraries + KF5::Contacts + KF5::TextEditor + KF5::NotifyConfig + KF5::Crash + KF5::DBusAddons + ${QIMAGEBLITZ_LIBRARIES} + kopete + kopeteaddaccountwizard + kopetestatusmenu + kopetecontactlist + kopeteidentity + Qt5::Test +) diff --git a/tests/libkopete/CMakeLists.txt b/tests/libkopete/CMakeLists.txt new file mode 100755 index 000000000..7fe11a3f5 --- /dev/null +++ b/tests/libkopete/CMakeLists.txt @@ -0,0 +1,9 @@ +include_directories( + ${KOPETE_INCLUDES} +) + +set( KOPETE_TEST_LIBRARIES + Qt5::Test + KF5::KIOCore + kopete +) diff --git a/libkopete/tests/avatarselectortest_program.h b/tests/plugins/CMakeLists.txt old mode 100644 new mode 100755 similarity index 100% rename from libkopete/tests/avatarselectortest_program.h rename to tests/plugins/CMakeLists.txt diff --git a/tests/protocols/CMakeLists.txt b/tests/protocols/CMakeLists.txt new file mode 100755 index 000000000..0f70f3570 --- /dev/null +++ b/tests/protocols/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(oscar) diff --git a/tests/protocols/oscar/CMakeLists.txt b/tests/protocols/oscar/CMakeLists.txt new file mode 100755 index 000000000..491a0a1e7 --- /dev/null +++ b/tests/protocols/oscar/CMakeLists.txt @@ -0,0 +1,44 @@ +add_definitions("-DKDESRCDIR=\"${CMAKE_CURRENT_BINARY_DIR}\"") +find_package(Qt5 REQUIRED COMPONENTS Test) +include_directories( + ${KOPETE_SOURCE_DIR}/protocols/oscar/liboscar + ${KOPETE_SOURCE_DIR}/protocols/oscar/liboscar/utils + ${KOPETE_SOURCE_DIR}/protocols/oscar/liboscar/tasks + ${KOPETE_INCLUDES} +) + +set( + LIBOSCAR_TEST_LIBRARIES + KF5::KDELibs4Support + oscar + Qt5::Test +) +# Test for buffer +ecm_add_test(buffertest.cpp LINK_LIBRARIES ${LIBOSCAR_TEST_LIBRARIES}) + +# Test for server version tasks +set(serverversionstest_SRCS serverversionstest.cpp oscartestbase.cpp ) +ecm_add_test( + ${serverversionstest_SRCS} + TEST_NAME serverversionstest + LINK_LIBRARIES ${LIBOSCAR_TEST_LIBRARIES} +) + +# Test for connection +set(connectiontest_SRCS connectiontest.cpp oscartestbase.cpp ) +ecm_add_test( + ${connectiontest_SRCS} + TEST_NAME connectiontest + LINK_LIBRARIES ${LIBOSCAR_TEST_LIBRARIES} +) + +# Tests for File Transfer +set(filetransfertest_SRCS filetransfertest.cpp oscartestbase.cpp ) +ecm_add_test( + ${filetransfertest_SRCS} + TEST_NAME filetransfertest + LINK_LIBRARIES ${LIBOSCAR_TEST_LIBRARIES} +) + +#test for oscar guid +ecm_add_test(guidtest.cpp LINK_LIBRARIES ${LIBOSCAR_TEST_LIBRARIES}) diff --git a/protocols/oscar/liboscar/tests/buffertest.cpp b/tests/protocols/oscar/buffertest.cpp old mode 100644 new mode 100755 similarity index 60% rename from protocols/oscar/liboscar/tests/buffertest.cpp rename to tests/protocols/oscar/buffertest.cpp index 38a66c542..9a58b3da5 --- a/protocols/oscar/liboscar/tests/buffertest.cpp +++ b/tests/protocols/oscar/buffertest.cpp @@ -1,87 +1,113 @@ -#include "buffertest.h" +/* + Buffer Test + + Kopete (c) 2002-2006 by the Kopete developers + + ************************************************************************* + * * + * 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 of the License, or (at your option) any later version. * + * * + ************************************************************************* +*/ + #include #include "buffer.h" -QTEST_MAIN(BufferTest) +class BufferTest : public QObject +{ + Q_OBJECT +private slots: + void testAddByte(); + void testAddWord(); + void testAddDWord(); + void testGetTLV(); + void testBytesAvailable(); + void testLength(); + void testGuid(); +}; void BufferTest::testAddByte() { Buffer b; b.addByte(0x00); QVERIFY(b.length() == 1); QVERIFY(b.getByte() == 0x00); } void BufferTest::testAddWord() { Buffer b; b.addWord(0x0101); QVERIFY(b.length() == 2); QVERIFY(b.getWord() == 0x0101); } void BufferTest::testAddDWord() { Buffer b; b.addDWord(0x01010101); QVERIFY(b.length() == 4); QVERIFY(b.getDWord() == 0x01010101); } void BufferTest::testGetTLV() { char raw[] = { 0x00, 0x00, 0x00, 0x01 }; Buffer b; b.addDWord(0x00030004); b.addDWord(0x00000001); - + TLV t = b.getTLV(); QVERIFY( t.type == 0x0003 ); QVERIFY( t.length == 0x0004 ); QVERIFY( t.data == QByteArray::fromRawData( raw, 4 ) ); } void BufferTest::testBytesAvailable() { Buffer b; QVERIFY(b.length() == 0); QVERIFY(b.bytesAvailable() == 0); b.addByte(0x01); b.addWord(0x0203); b.addDWord(0x04050607); QVERIFY(b.bytesAvailable() == 7); b.skipBytes(7); QVERIFY(b.bytesAvailable() == 0); } void BufferTest::testLength() { Buffer b; QVERIFY(b.length() == 0); - + b.addByte(0x01); b.addWord(0x0203); b.addDWord(0x04050607); b.addWord(0x0809); QVERIFY(b.length() == 9); b.getWord(); QVERIFY(b.length() == 9); } void BufferTest::testGuid() { Buffer b; Guid g( QByteArray( "asdfghjkqwertyui" ) ); b.addGuid( g ); QVERIFY( b.bytesAvailable() == 16 ); Guid h = b.getGuid(); QVERIFY( b.bytesAvailable() == 0 ); QCOMPARE( g, h ); - } +QTEST_MAIN(BufferTest) +#include "buffertest.moc" diff --git a/protocols/oscar/liboscar/tests/connectiontest.cpp b/tests/protocols/oscar/connectiontest.cpp old mode 100644 new mode 100755 similarity index 100% rename from protocols/oscar/liboscar/tests/connectiontest.cpp rename to tests/protocols/oscar/connectiontest.cpp diff --git a/protocols/oscar/liboscar/tests/connectiontest.h b/tests/protocols/oscar/connectiontest.h old mode 100644 new mode 100755 similarity index 94% rename from protocols/oscar/liboscar/tests/connectiontest.h rename to tests/protocols/oscar/connectiontest.h index 804ccff24..32616b32e --- a/protocols/oscar/liboscar/tests/connectiontest.h +++ b/tests/protocols/oscar/connectiontest.h @@ -1,36 +1,36 @@ /* Connection Test Copyright (c) 2006 by Matt Rogers Kopete (c) 2002-2006 by the Kopete developers ************************************************************************* * * * 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 of the License, or (at your option) any later version. * * * ************************************************************************* */ #ifndef CONNECTIONTEST_H #define CONNECTIONTEST_H #include "oscartestbase.h" class ConnectionTest : public OscarTestBase { -Q_OBJECT + Q_OBJECT private Q_SLOTS: - ///Checks to make sure that using the non list form of + ///Checks to make sure that using the non list form of ///addToSupportedFamilies works correctly void checkSupportedFamiliesSingle(); ///Checks to make sure that using the list form of addToSupportedFamilies ///works correctly void checkSupportedFamiliesList(); }; #endif diff --git a/protocols/oscar/liboscar/tests/filetransfertest.cpp b/tests/protocols/oscar/filetransfertest.cpp old mode 100644 new mode 100755 similarity index 94% rename from protocols/oscar/liboscar/tests/filetransfertest.cpp rename to tests/protocols/oscar/filetransfertest.cpp index e8435ab0a..aed0ca942 --- a/protocols/oscar/liboscar/tests/filetransfertest.cpp +++ b/tests/protocols/oscar/filetransfertest.cpp @@ -1,40 +1,40 @@ /* Filetransfer Test Copyright (c) 2006 by Matt Rogers Kopete (c) 2002-2006 by the Kopete developers ************************************************************************* * * * 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 of the License, or (at your option) any later version. * * * ************************************************************************* */ #include "filetransfertest.h" #include "filetransfertask.h" +#include "serverversionstask.h" #include "buffer.h" OSCAR_TEST_MAIN( FileTransferTest ) void FileTransferTest::testRRequest() { //TODO - /* Buffer* b = new Buffer(); + Buffer* b = new Buffer(); b->addDWord( 0x00010002 ); b->addDWord( 0x00030004 ); QList families = ServerVersionsTask::buildFamiliesList( b ); QVERIFY( families.isEmpty() == false ); QVERIFY( families.count() == 4 ); QVERIFY( families.takeFirst() == 0x0001 ); QVERIFY( families.takeFirst() == 0x0002 ); QVERIFY( families.takeFirst() == 0x0003 ); QVERIFY( families.takeFirst() == 0x0004 ); - delete b;*/ + delete b; } - diff --git a/protocols/oscar/liboscar/tests/filetransfertest.h b/tests/protocols/oscar/filetransfertest.h old mode 100644 new mode 100755 similarity index 98% rename from protocols/oscar/liboscar/tests/filetransfertest.h rename to tests/protocols/oscar/filetransfertest.h index 22fc71271..ed4be650b --- a/protocols/oscar/liboscar/tests/filetransfertest.h +++ b/tests/protocols/oscar/filetransfertest.h @@ -1,30 +1,30 @@ /* File Transfer Test Copyright (c) 2006 by Matt Rogers Kopete (c) 2002-2006 by the Kopete developers ************************************************************************* * * * 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 of the License, or (at your option) any later version. * * * ************************************************************************* */ #ifndef FILETRANSFERTEST_H #define FILETRANSFERTEST_H #include "oscartestbase.h" class FileTransferTest : public OscarTestBase { -Q_OBJECT + Q_OBJECT private Q_SLOTS: void testRRequest(); }; #endif diff --git a/protocols/oscar/liboscar/tests/guidtest.cpp b/tests/protocols/oscar/guidtest.cpp old mode 100644 new mode 100755 similarity index 100% rename from protocols/oscar/liboscar/tests/guidtest.cpp rename to tests/protocols/oscar/guidtest.cpp diff --git a/protocols/oscar/liboscar/tests/guidtest.h b/tests/protocols/oscar/guidtest.h old mode 100644 new mode 100755 similarity index 95% rename from protocols/oscar/liboscar/tests/guidtest.h rename to tests/protocols/oscar/guidtest.h index a44243238..db346e42c --- a/protocols/oscar/liboscar/tests/guidtest.h +++ b/tests/protocols/oscar/guidtest.h @@ -1,16 +1,16 @@ #ifndef GUIDTEST_H #define GUIDTEST_H #include class GuidTest : public QObject { -Q_OBJECT + Q_OBJECT private Q_SLOTS: void testConstructors(); void testSetData(); void testIsVaild(); void testCompare(); }; #endif diff --git a/protocols/oscar/liboscar/tests/oscartestbase.cpp b/tests/protocols/oscar/oscartestbase.cpp old mode 100644 new mode 100755 similarity index 100% rename from protocols/oscar/liboscar/tests/oscartestbase.cpp rename to tests/protocols/oscar/oscartestbase.cpp diff --git a/protocols/oscar/liboscar/tests/oscartestbase.h b/tests/protocols/oscar/oscartestbase.h old mode 100644 new mode 100755 similarity index 99% rename from protocols/oscar/liboscar/tests/oscartestbase.h rename to tests/protocols/oscar/oscartestbase.h index 7413f62cd..bbc574a06 --- a/protocols/oscar/liboscar/tests/oscartestbase.h +++ b/tests/protocols/oscar/oscartestbase.h @@ -1,65 +1,65 @@ /* oscartestbase.h - OSCAR Testlib base Copyright (c) 2006 by Brian Smith Kopete (c) 2002-2006 by the Kopete developers ************************************************************************* * * * 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 of the License, or (at your option) any later version. * * * ************************************************************************* */ #ifndef OSCARTESTBASE_H #define OSCARTESTBASE_H #include #include class Buffer; /** * @brief Base testcase class */ class OscarTestBase : public QObject { -Q_OBJECT + Q_OBJECT public: OscarTestBase(); /** Default destructor */ ~OscarTestBase(); /** * Set the directory to use to load test files */ void setPath( const QString& path ); /** * Takes a file @p file and attempts to load the file, prepending * the path specified in the constructor as test data. * @returns true on success. */ bool loadFile(const QString& file); protected: Buffer* m_data; QString m_dataDir; }; #define OSCAR_TEST_MAIN(TestObject) \ int main(int argc, char **argv) \ { \ QCoreApplication app(argc, argv); \ TestObject tc; \ if(argv[1]) \ tc.setPath( argv[1] ); \ else \ tc.setPath( KDESRCDIR ); \ return QTest::qExec( &tc, 0, 0 ); \ } #endif diff --git a/protocols/oscar/liboscar/tests/serverversionstest.cpp b/tests/protocols/oscar/serverversionstest.cpp old mode 100644 new mode 100755 similarity index 99% rename from protocols/oscar/liboscar/tests/serverversionstest.cpp rename to tests/protocols/oscar/serverversionstest.cpp index 15d097190..e54957126 --- a/protocols/oscar/liboscar/tests/serverversionstest.cpp +++ b/tests/protocols/oscar/serverversionstest.cpp @@ -1,39 +1,38 @@ /* Server Versions Task Test Copyright (c) 2006 by Matt Rogers Kopete (c) 2002-2006 by the Kopete developers ************************************************************************* * * * 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 of the License, or (at your option) any later version. * * * ************************************************************************* */ #include "serverversionstest.h" #include "serverversionstask.h" #include "buffer.h" OSCAR_TEST_MAIN( ServerVersionsTest ) void ServerVersionsTest::testSupportedFamilies() { Buffer* b = new Buffer(); b->addDWord( 0x00010002 ); b->addDWord( 0x00030004 ); QList families = ServerVersionsTask::buildFamiliesList( b ); QVERIFY( families.isEmpty() == false ); QVERIFY( families.count() == 4 ); QVERIFY( families.takeFirst() == 0x0001 ); QVERIFY( families.takeFirst() == 0x0002 ); QVERIFY( families.takeFirst() == 0x0003 ); QVERIFY( families.takeFirst() == 0x0004 ); delete b; } - diff --git a/protocols/oscar/liboscar/tests/serverversionstest.h b/tests/protocols/oscar/serverversionstest.h old mode 100644 new mode 100755 similarity index 99% rename from protocols/oscar/liboscar/tests/serverversionstest.h rename to tests/protocols/oscar/serverversionstest.h index 47c770438..778da0a91 --- a/protocols/oscar/liboscar/tests/serverversionstest.h +++ b/tests/protocols/oscar/serverversionstest.h @@ -1,30 +1,30 @@ /* Server Versions Task Test Copyright (c) 2006 by Matt Rogers Kopete (c) 2002-2006 by the Kopete developers ************************************************************************* * * * 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 of the License, or (at your option) any later version. * * * ************************************************************************* */ #ifndef SERVERVERSIONSTASKTEST_H #define SERVERVERSIONSTASKTEST_H #include "oscartestbase.h" class ServerVersionsTest : public OscarTestBase { -Q_OBJECT + Q_OBJECT private Q_SLOTS: void testSupportedFamilies(); }; #endif