summaryrefslogtreecommitdiffstats
path: root/libkcal/tests/CMakeLists.txt
blob: 143bade68dbcf125eebd2f64a82b29455d5ec399 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#################################################
#
#  (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_property( TARGET testfields APPEND PROPERTY
  COMPILE_DEFINITIONS INPUT="${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}
)

# Compat tests are broken and have been in a disabled state since before TDE exited
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 )
set ( _all_tests _test1 _test2 _test3 _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} )
	# skip some libical tests if libical < 1.0, due to bug in old libical versions
	if( LIBICAL_LESS_1_0 )
		list( REMOVE_ITEM _test_files data/RecurrenceRule/LibICal/LibICal_TestCase15.ics )
		list( REMOVE_ITEM _test_files data/RecurrenceRule/LibICal/LibICal_TestCase54.ics )
		list( REMOVE_ITEM _test_files data/RecurrenceRule/LibICal/LibICal_TestCase55.ics )
	endif( )
	foreach( _test_file ${_test_files} )
		add_test(
		  ${_test_executable}__${_test_id}__${_test_file}__
			${CMAKE_CURRENT_SOURCE_DIR}/runtestcase.pl ${_test_executable} ${_test_id} ${CMAKE_CURRENT_BINARY_DIR}/${_test_file}
			)
	endforeach( )
endforeach( )