Warning, /frameworks/kcalendarcore/autotests/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 include(ECMMarkAsTest)
0002 
0003 find_package(Qt6Test ${REQUIRED_QT_VERSION} CONFIG REQUIRED)
0004 
0005 # needed by loadcalendar
0006 file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/cal DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
0007 
0008 macro(macro_unit_tests)
0009   foreach(_testname ${ARGN})
0010     add_executable(${_testname} ${_testname}.cpp)
0011     add_test(NAME ${_testname} COMMAND ${_testname})
0012     ecm_mark_as_test(${_testname})
0013     target_link_libraries(${_testname} KF6CalendarCore Qt6::Test LibIcal)
0014   endforeach()
0015 endmacro()
0016 
0017 macro_unit_tests(
0018   testalarm
0019   testattachment
0020   testattendee
0021   testcalfilter
0022   testconference
0023   testcustomproperties
0024   testdateserialization
0025   testduration
0026   testevent
0027   testincidence
0028   testexception
0029   testfilestorage
0030   testfreebusy
0031   testincidencerelation
0032   testicalformat
0033   testidentical
0034   testjournal
0035   testmemorycalendar
0036   testperiod
0037   testfreebusyperiod
0038   testperson
0039   testrecurtodo
0040   teststartdatetimesfordate
0041   teststatus
0042   testtodo
0043   testtimesininterval
0044   testcreateddatecompat
0045   testrecurrenceexception
0046   testoccurrenceiterator
0047   testreadrecurrenceid
0048   incidencestest
0049   loadcalendar
0050   fbrecurring
0051   readandwrite
0052   testfb
0053   testrecurprevious
0054   testrecurrence
0055   testrecurrencetype
0056   testrecurson
0057   testtostring
0058   testvcalexport
0059   testcalendarobserver
0060 )
0061 
0062 set_target_properties(testmemorycalendar PROPERTIES COMPILE_FLAGS -DICALTESTDATADIR="\\"${CMAKE_CURRENT_SOURCE_DIR}/data/\\"")
0063 set_target_properties(testreadrecurrenceid PROPERTIES COMPILE_FLAGS -DICALTESTDATADIR="\\"${CMAKE_CURRENT_SOURCE_DIR}/data/\\"")
0064 set_target_properties(testconference PROPERTIES COMPILE_FLAGS -DICALTESTDATADIR="\\"${CMAKE_CURRENT_SOURCE_DIR}/data/\\"")
0065 # this test cannot work with msvc because libical should not be altered
0066 # and therefore we can't add KCALENDARCORE_EXPORT there
0067 # it should work fine with mingw because of the auto-import feature
0068 # TODO: check if this can build with msvc now (and if it works on Windows)
0069 if(NOT MSVC)
0070   macro_unit_tests(testicaltimezones)
0071   target_link_libraries(testicaltimezones Qt6::Core KF6::CalendarCore)
0072 endif()
0073 
0074 ########### Tests #######################
0075 
0076 file(GLOB_RECURSE testFiles data/RecurrenceRule/*.ics)
0077 file(GLOB_RECURSE vCalFiles data/vCalendar/*.vcs)
0078 file(GLOB_RECURSE compatFiles data/Compat/*.ics)
0079 
0080 find_program(PERL_EXECUTABLE perl)
0081 
0082 macro(kcalcore_run_single_test _prefix _f _test _testarg)
0083   get_filename_component(_fn ${_f} NAME)
0084 
0085   # Write the output file in the build directory.
0086   string(REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" _outFile ${_f})
0087   get_filename_component(_outputPath ${_outFile} PATH)
0088   file(MAKE_DIRECTORY ${_outputPath})
0089 
0090   set(_runner ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/runsingletestcase.pl)
0091   add_test(NAME ${_prefix}-${_fn} COMMAND ${_runner} $<TARGET_FILE:${_test}> ${_testarg} ${_f} ${_outFile})
0092 endmacro()
0093 
0094 file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/FAILED.log)
0095 
0096 foreach(file ${testFiles})
0097   kcalcore_run_single_test(RecurNext ${file} testrecurrence "next")
0098 endforeach()
0099 
0100 foreach(file ${testFiles})
0101   kcalcore_run_single_test(RecurPrev ${file} testrecurprevious "prev")
0102 endforeach()
0103 
0104 foreach(file ${testFiles})
0105   kcalcore_run_single_test(RecursOn ${file} testrecurson "recurson")
0106 endforeach()
0107 
0108 foreach(file ${compatFiles})
0109   kcalcore_run_single_test(Compat ${file} readandwrite "ical")
0110 endforeach()
0111 
0112 foreach(file ${vCalFiles})
0113   kcalcore_run_single_test(VCalIn ${file} readandwrite "ical")
0114 endforeach()