summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--libkcal/CMakeLists.txt1
-rw-r--r--libkcal/tests/CMakeLists.txt82
-rw-r--r--libkcal/tests/Makefile.am2
-rw-r--r--libkcal/tests/readandwrite.cpp5
-rw-r--r--libkcal/tests/testrecurprevious.cpp5
-rw-r--r--libkcal/tests/testrecurrence.cpp5
-rw-r--r--libkcal/tests/testrecurrencetype.cpp5
-rw-r--r--libkcal/tests/testrecurson.cpp5
-rw-r--r--libkcal/tests/testvcalexport.cpp5
10 files changed, 90 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 852ac4a57..88cc54274 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,6 +28,7 @@ include( CheckCSourceCompiles )
include( CheckCXXSourceCompiles )
include( CheckLibraryExists )
include( CheckSymbolExists )
+enable_testing( )
##### include our cmake modules #################
diff --git a/libkcal/CMakeLists.txt b/libkcal/CMakeLists.txt
index af759febd..dbded2cb4 100644
--- a/libkcal/CMakeLists.txt
+++ b/libkcal/CMakeLists.txt
@@ -17,6 +17,7 @@ tde_import( libkmime )
tde_import( ktnef )
add_subdirectory( versit )
+add_subdirectory( tests )
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
diff --git a/libkcal/tests/CMakeLists.txt b/libkcal/tests/CMakeLists.txt
new file mode 100644
index 000000000..386982c4d
--- /dev/null
+++ b/libkcal/tests/CMakeLists.txt
@@ -0,0 +1,82 @@
+#################################################
+#
+# (C) 2019 Michele Calgaro
+# michele (DOT) calgaro (AT) yahoo (DOT) it
+#
+# Improvements and feedbacks are welcome
+#
+# This file is released under GPL >= 3
+#
+#################################################
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${TDE_INCLUDE_DIR}
+ ${CMAKE_SOURCE_DIR}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}/libkcal
+ ${CMAKE_SOURCE_DIR}/libtdepim
+)
+
+set( _link_libkcal_tests
+ ${TQT_LIBRARIES}
+ DCOP-shared
+ tdecore-shared
+ tdeui-shared
+ tdefx-shared
+ tdeio-shared
+ tdetexteditor-shared
+ kcal-shared
+)
+
+
+### executable files
+
+set( _test_executables
+ fbrecurring readandwrite testcalendar testcalselectdialog testfb testfields testincidence testrecurprevious
+ testrecurrence testrecurrencetype testrecurson testresource testtostring testvcalexport
+)
+
+foreach( _test_name ${_test_executables} )
+ tde_add_check_executable( ${_test_name}
+ SOURCES ${_test_name}.cpp AUTOMOC
+ LINK ${_link_libkcal_tests}
+ )
+endforeach( )
+
+set_target_properties( testfields
+ PROPERTIES COMPILE_FLAGS -DINPUT='\"${CMAKE_CURRENT_SOURCE_DIR}/data/test_pilot.ics\"'
+)
+
+
+### tests
+
+add_custom_command(
+ TARGET fbrecurring PRE_BUILD
+ COMMAND test -d data || cp -vr ${CMAKE_CURRENT_SOURCE_DIR}/data data
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+set ( _test1 testrecurrence "next" ${CMAKE_CURRENT_SOURCE_DIR}/data/RecurrenceRule/*.ics )
+set ( _test2 testrecurprevious "prev" ${CMAKE_CURRENT_SOURCE_DIR}/data/RecurrenceRule/*.ics )
+set ( _test3 testrecurson "recurson" ${CMAKE_CURRENT_SOURCE_DIR}/data/RecurrenceRule/*.ics )
+set ( _test4 readandwrite "ical" ${CMAKE_CURRENT_SOURCE_DIR}/data/Compat/*.ics )
+set ( _test5 testvcalexport "vcal" ${CMAKE_CURRENT_SOURCE_DIR}/data/vCalendar/*.ics )
+set ( _test6 readandwrite "ical" ${CMAKE_CURRENT_SOURCE_DIR}/data/vCalendar/*.vcs )
+set ( _all_tests _test1 _test2 _test3 _test4 _test5 _test6 )
+
+foreach( _test_name ${_all_tests} )
+ list( GET ${_test_name} 0 _test_executable )
+ list( GET ${_test_name} 1 _test_id )
+ list( GET ${_test_name} 2 _test_search_filter )
+ file( GLOB_RECURSE _test_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${_test_search_filter} )
+ foreach( _test_file ${_test_files} )
+ add_test(
+ ${_test_executable}__${_test_file}__
+ ${CMAKE_CURRENT_SOURCE_DIR}/runtestcase.pl ${_test_executable} ${_test_id} ${CMAKE_CURRENT_BINARY_DIR}/${_test_file}
+ )
+ endforeach( )
+endforeach( )
+
diff --git a/libkcal/tests/Makefile.am b/libkcal/tests/Makefile.am
index b9b1cc25a..9b7e6cbb6 100644
--- a/libkcal/tests/Makefile.am
+++ b/libkcal/tests/Makefile.am
@@ -4,8 +4,6 @@ INCLUDES = -I$(top_srcdir)/libkcal \
-I../libical/src/libicalss -I$(srcdir)/../versit \
-I$(top_srcdir) $(all_includes)
-AM_CPPFLAGS = -DKDETOPSRCDIR=\"$(top_srcdir)\"
-
check_PROGRAMS = testtostring \
testincidence \
testcalendar \
diff --git a/libkcal/tests/readandwrite.cpp b/libkcal/tests/readandwrite.cpp
index 5f6c3488d..23056d6e7 100644
--- a/libkcal/tests/readandwrite.cpp
+++ b/libkcal/tests/readandwrite.cpp
@@ -22,7 +22,7 @@
#include "calendarlocal.h"
extern "C" {
-#include "icaltimezone.h"
+#include "libical/icaltimezone.h"
}
#include <tdeaboutdata.h>
@@ -58,9 +58,6 @@ int main( int argc, char **argv )
args->usage( "Wrong number of arguments." );
}
- // use zoneinfo data from source dir
- set_zone_directory( KDETOPSRCDIR "/libkcal/libical/zoneinfo" );
-
TQString input = TQFile::decodeName( args->arg( 0 ) );
TQString output = TQFile::decodeName( args->arg( 1 ) );
diff --git a/libkcal/tests/testrecurprevious.cpp b/libkcal/tests/testrecurprevious.cpp
index 2dae1543f..d8cd90ab4 100644
--- a/libkcal/tests/testrecurprevious.cpp
+++ b/libkcal/tests/testrecurprevious.cpp
@@ -23,7 +23,7 @@
#include "calendarlocal.h"
extern "C" {
-#include "icaltimezone.h"
+#include "libical/icaltimezone.h"
}
#include <tdeaboutdata.h>
@@ -61,9 +61,6 @@ int main( int argc, char **argv )
args->usage( "Wrong number of arguments." );
}
- // use zoneinfo data from source dir
- set_zone_directory( KDETOPSRCDIR "/libkcal/libical/zoneinfo" );
-
TQString input = TQFile::decodeName( args->arg( 0 ) );
kdDebug(5800) << "Input file: " << input << endl;
diff --git a/libkcal/tests/testrecurrence.cpp b/libkcal/tests/testrecurrence.cpp
index 5a77de866..c8eaaa06a 100644
--- a/libkcal/tests/testrecurrence.cpp
+++ b/libkcal/tests/testrecurrence.cpp
@@ -23,7 +23,7 @@
#include "calendarlocal.h"
extern "C" {
-#include "icaltimezone.h"
+#include "libical/icaltimezone.h"
}
#include <tdeaboutdata.h>
@@ -61,9 +61,6 @@ int main( int argc, char **argv )
args->usage( "Wrong number of arguments." );
}
- // use zoneinfo data from source dir
- set_zone_directory( KDETOPSRCDIR "/libkcal/libical/zoneinfo" );
-
TQString input = TQFile::decodeName( args->arg( 0 ) );
kdDebug(5800) << "Input file: " << input << endl;
diff --git a/libkcal/tests/testrecurrencetype.cpp b/libkcal/tests/testrecurrencetype.cpp
index 5a77de866..c8eaaa06a 100644
--- a/libkcal/tests/testrecurrencetype.cpp
+++ b/libkcal/tests/testrecurrencetype.cpp
@@ -23,7 +23,7 @@
#include "calendarlocal.h"
extern "C" {
-#include "icaltimezone.h"
+#include "libical/icaltimezone.h"
}
#include <tdeaboutdata.h>
@@ -61,9 +61,6 @@ int main( int argc, char **argv )
args->usage( "Wrong number of arguments." );
}
- // use zoneinfo data from source dir
- set_zone_directory( KDETOPSRCDIR "/libkcal/libical/zoneinfo" );
-
TQString input = TQFile::decodeName( args->arg( 0 ) );
kdDebug(5800) << "Input file: " << input << endl;
diff --git a/libkcal/tests/testrecurson.cpp b/libkcal/tests/testrecurson.cpp
index f5d1841cd..028273e2e 100644
--- a/libkcal/tests/testrecurson.cpp
+++ b/libkcal/tests/testrecurson.cpp
@@ -23,7 +23,7 @@
#include "calendarlocal.h"
extern "C" {
-#include "icaltimezone.h"
+#include "libical/icaltimezone.h"
}
#include <tdeaboutdata.h>
@@ -61,9 +61,6 @@ int main( int argc, char **argv )
args->usage( "Wrong number of arguments." );
}
- // use zoneinfo data from source dir
- set_zone_directory( KDETOPSRCDIR "/libkcal/libical/zoneinfo" );
-
TQString input = TQFile::decodeName( args->arg( 0 ) );
kdDebug(5800) << "Input file: " << input << endl;
diff --git a/libkcal/tests/testvcalexport.cpp b/libkcal/tests/testvcalexport.cpp
index 7cf619d00..b24894e30 100644
--- a/libkcal/tests/testvcalexport.cpp
+++ b/libkcal/tests/testvcalexport.cpp
@@ -26,7 +26,7 @@
#include "filestorage.h"
extern "C" {
-#include "icaltimezone.h"
+#include "libical/icaltimezone.h"
}
#include <tdeaboutdata.h>
@@ -62,9 +62,6 @@ int main( int argc, char **argv )
args->usage( "Wrong number of arguments." );
}
- // use zoneinfo data from source dir
- set_zone_directory( KDETOPSRCDIR "/libkcal/libical/zoneinfo" );
-
TQString input = TQFile::decodeName( args->arg( 0 ) );
TQString output = TQFile::decodeName( args->arg( 1 ) );