Commit a860a7ed authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Add visitor tests

parent 40d1e469
if (BUILD_TESTING)
add_subdirectory(autotests)
endif()
set(pimeventsplugin_SRCS
pimeventsplugin.cpp
eventdatavisitor.cpp
......
macro(add_plasma_pimeventsplugin_test _source _additional)
set(_test ${_source} ${_additional} testdataparser.cpp)
get_filename_component(_name ${_source} NAME_WE)
add_executable(${_name} ${_test})
add_test(${_name} ${_name})
ecm_mark_as_test(plasma-pimeventsplugin-${_name})
add_definitions(-DQT_TESTCASE_BUILDDIR=\"${CMAKE_CURRENT_SOURCE_DIR}\")
target_link_libraries(${_name} Qt5::Core Qt5::Test KF5::AkonadiCore KF5::AkonadiCalendar KF5::CalendarCore KF5::CalendarEvents)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_BINARY_DIR}/..)
endmacro()
add_plasma_pimeventsplugin_test(eventdatavisitortest.cpp ../eventdatavisitor.cpp)
#add_plasma_pimeventsplugin_test(pimeventsplugintest.cpp "../eventdatavisitor.cpp;../pimeventsplugin.cpp")
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTAMP:20160529T143409Z
CREATED:20160529T143351Z
UID:43f8fa38-6794-4862-a389-11e78d1ad584
LAST-MODIFIED:20160529T143409Z
DESCRIPTION:This is an all-day multi-day event
SUMMARY:Multi day all day event
DTSTART;VALUE=DATE:20160528
DTEND;VALUE=DATE:20160531
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
{
"rangeStart": "2016-05-01",
"rangeEnd": "2016-05-31",
"akonadiId": 1,
"eventData": [
{
"summary": "Multi day all day event",
"description": "This is an all-day multi-day event",
"type": "Event",
"allDay": true,
"isMinor": false,
"startDateTime": {
"date": "2016-05-28",
"time": ""
},
"endDateTime": {
"date": "2016-05-30",
"time": ""
},
"uid": "Akonadi-1"
}
]
}
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTAMP:20160529T143104Z
CREATED:20160529T143019Z
UID:c843300a-856d-4567-8ecc-a29255b6f5f5
LAST-MODIFIED:20160529T143104Z
DESCRIPTION:This is an all-day one day non-recurring event.
SUMMARY:All day one day non-recurring event
DTSTART;VALUE=DATE:20160529
DTEND;VALUE=DATE:20160530
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
{
"rangeStart": "2016-05-01",
"rangeEnd": "2016-05-31",
"akonadiId": 2,
"eventData": [
{
"summary": "All day one day non-recurring event",
"description": "This is an all-day one day non-recurring event.",
"type": "Event",
"allDay": true,
"isMinor": false,
"startDateTime": {
"date": "2016-05-29",
"time": ""
},
"endDateTime": {
"date": "2016-05-29",
"time": ""
},
"uid": "Akonadi-2"
}
]
}
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTAMP:20160529T143448Z
CREATED:20160529T143412Z
UID:1fceddbc-d1b9-4e20-8fea-1d36e191a42d
LAST-MODIFIED:20160529T143448Z
DESCRIPTION:This is an all-day multi-day recurring event
SUMMARY:All day multi-day recurring event
RRULE:FREQ=WEEKLY;BYDAY=FR
DTSTART;VALUE=DATE:20160408
DTEND;VALUE=DATE:20160411
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
{
"rangeStart": "2016-05-01",
"rangeEnd": "2016-05-31",
"akonadiId": 3,
"eventData": [
{
"summary": "All day multi-day recurring event",
"description": "This is an all-day multi-day recurring event",
"type": "Event",
"allDay": true,
"isMinor": false,
"startDateTime": {
"date": "2016-05-06",
"time": ""
},
"endDateTime": {
"date": "2016-05-08",
"time": ""
},
"uid": "Akonadi-3-20160506T000000"
},
{
"summary": "All day multi-day recurring event",
"description": "This is an all-day multi-day recurring event",
"type": "Event",
"allDay": true,
"isMinor": false,
"startDateTime": {
"date": "2016-05-13",
"time": ""
},
"endDateTime": {
"date": "2016-05-15",
"time": ""
},
"uid": "Akonadi-3-20160513T000000"
},
{
"summary": "All day multi-day recurring event",
"description": "This is an all-day multi-day recurring event",
"type": "Event",
"allDay": true,
"isMinor": false,
"startDateTime": {
"date": "2016-05-20",
"time": ""
},
"endDateTime": {
"date": "2016-05-22",
"time": ""
},
"uid": "Akonadi-3-20160520T000000"
},
{
"summary": "All day multi-day recurring event",
"description": "This is an all-day multi-day recurring event",
"type": "Event",
"allDay": true,
"isMinor": false,
"startDateTime": {
"date": "2016-05-27",
"time": ""
},
"endDateTime": {
"date": "2016-05-29",
"time": ""
},
"uid": "Akonadi-3-20160527T000000"
}
]
}
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTAMP:20160529T143257Z
CREATED:20160529T143223Z
UID:9bcaf475-021e-4396-beec-e8206298cade
SEQUENCE:2
LAST-MODIFIED:20160529T143257Z
DESCRIPTION:This is a one day all-day recurring event
SUMMARY:All day one day recurring event
RRULE:FREQ=WEEKLY;BYDAY=FR
DTSTART;VALUE=DATE:20160401
DTEND;VALUE=DATE:20160402
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
{
"rangeStart": "2016-05-01",
"rangeEnd": "2016-05-31",
"akonadiId": 4,
"eventData": [
{
"summary": "All day one day recurring event",
"description": "This is a one day all-day recurring event",
"type": "Event",
"allDay": true,
"isMinor": false,
"startDateTime": {
"date": "2016-05-06",
"time": ""
},
"endDateTime": {
"date": "2016-05-06",
"time": ""
},
"uid": "Akonadi-4-20160506T000000"
},
{
"summary": "All day one day recurring event",
"description": "This is a one day all-day recurring event",
"type": "Event",
"allDay": true,
"isMinor": false,
"startDateTime": {
"date": "2016-05-13",
"time": ""
},
"endDateTime": {
"date": "2016-05-13",
"time": ""
},
"uid": "Akonadi-4-20160513T000000"
},
{
"summary": "All day one day recurring event",
"description": "This is a one day all-day recurring event",
"type": "Event",
"allDay": true,
"isMinor": false,
"startDateTime": {
"date": "2016-05-20",
"time": ""
},
"endDateTime": {
"date": "2016-05-20",
"time": ""
},
"uid": "Akonadi-4-20160520T000000"
},
{
"summary": "All day one day recurring event",
"description": "This is a one day all-day recurring event",
"type": "Event",
"allDay": true,
"isMinor": false,
"startDateTime": {
"date": "2016-05-27",
"time": ""
},
"endDateTime": {
"date": "2016-05-27",
"time": ""
},
"uid": "Akonadi-4-20160527T000000"
}
]
}
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTAMP:20160529T143349Z
CREATED:20160529T143303Z
UID:afa77766-4690-44a3-959f-f5e6cc70043a
LAST-MODIFIED:20160529T143349Z
DESCRIPTION:This is a simple multi day event
SUMMARY:Simple multi day event
DTSTART;TZID=Europe/Prague:20160528T160000
DTEND;TZID=Europe/Prague:20160530T120000
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
{
"rangeStart": "2016-05-01",
"rangeEnd": "2016-05-31",
"akonadiId": 5,
"eventData": [
{
"summary": "Simple multi day event",
"description": "This is a simple multi day event",
"type": "Event",
"allDay": false,
"isMinor": false,
"startDateTime": {
"date": "2016-05-28",
"time": "16:00:00",
"tz": "Europe/Prague"
},
"endDateTime": {
"date": "2016-05-30",
"time": "12:00:00",
"tz": "Europe/Prague"
},
"uid": "Akonadi-5"
}
]
}
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTAMP:20160529T143018Z
CREATED:20160529T142843Z
UID:4d7fdd2c-2d3a-4ecf-8964-00eb92225209
LAST-MODIFIED:20160529T143018Z
DESCRIPTION:This is a simple one-day non-recurring event.
SUMMARY:Simple one day non-recurring event
DTSTART;TZID=Europe/Prague:20160529T144500
DTEND;TZID=Europe/Prague:20160529T154500
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
{
"rangeStart": "2016-05-01",
"rangeEnd": "2016-05-31",
"akonadiId": 6,
"eventData": [
{
"summary": "Simple one day non-recurring event",
"description": "This is a simple one-day non-recurring event.",
"type": "Event",
"allDay": false,
"isMinor": false,
"startDateTime": {
"date": "2016-05-29",
"time": "14:45:00",
"tz": "Europe/Prague"
},
"endDateTime": {
"date": "2016-05-29",
"time": "15:45:00",
"tz": "Europe/Prague"
},
"uid": "Akonadi-6"
}
]
}
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTAMP:20160529T143526Z
CREATED:20160529T143451Z
UID:79146b91-fe07-40ec-ba16-402b4b94f655
LAST-MODIFIED:20160529T143526Z
SUMMARY:Simple multi-day recurring event
DESCRIPTION:This is a simple multi-day recurring event
RRULE:FREQ=WEEKLY;BYDAY=FR
DTSTART;TZID=Europe/Prague:20160408T190000
DTEND;TZID=Europe/Prague:20160410T120000
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
{
"rangeStart": "2016-05-01",
"rangeEnd": "2016-05-31",
"akonadiId": 7,
"eventData": [
{
"summary": "Simple multi-day recurring event",
"description": "This is a simple multi-day recurring event",
"type": "Event",
"allDay": false,
"isMinor": false,
"startDateTime": {
"date": "2016-05-06",
"time": "19:00:00",
"tz": "Europe/Prague"
},
"endDateTime": {
"date": "2016-05-08",
"time": "12:00:00",
"tz": "Europe/Prague"
},
"uid": "Akonadi-7-20160506T190000CEST"
},
{
"summary": "Simple multi-day recurring event",
"description": "This is a simple multi-day recurring event",
"type": "Event",
"allDay": false,
"isMinor": false,
"startDateTime": {
"date": "2016-05-13",
"time": "19:00:00",
"tz": "Europe/Prague"
},
"endDateTime": {
"date": "2016-05-15",
"time": "12:00:00",
"tz": "Europe/Prague"
},
"uid": "Akonadi-7-20160513T190000CEST"
},
{
"summary": "Simple multi-day recurring event",
"description": "This is a simple multi-day recurring event",
"type": "Event",
"allDay": false,
"isMinor": false,
"startDateTime": {
"date": "2016-05-20",
"time": "19:00:00",
"tz": "Europe/Prague"
},
"endDateTime": {
"date": "2016-05-22",
"time": "12:00:00",
"tz": "Europe/Prague"
},
"uid": "Akonadi-7-20160520T190000CEST"
},
{
"summary": "Simple multi-day recurring event",
"description": "This is a simple multi-day recurring event",
"type": "Event",
"allDay": false,
"isMinor": false,
"startDateTime": {
"date": "2016-05-27",
"time": "19:00:00",
"tz": "Europe/Prague"
},
"endDateTime": {
"date": "2016-05-29",
"time": "12:00:00",
"tz": "Europe/Prague"
},
"uid": "Akonadi-7-20160527T190000CEST"
}
]
}
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTAMP:20160529T143213Z
CREATED:20160529T143106Z
UID:69971015-fe9c-4800-a20e-d46bafa24e41
SEQUENCE:2
LAST-MODIFIED:20160529T143213Z
DESCRIPTION:This is a simple one-day recurring event
SUMMARY:Simple one-day recurring event
RRULE:FREQ=WEEKLY;BYDAY=FR
DTSTART;TZID=Europe/Prague:20160401T141500
DTEND;TZID=Europe/Prague:20160401T151500
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
{
"rangeStart": "2016-05-01",
"rangeEnd": "2016-05-31",
"akonadiId": 8,
"eventData": [
{
"summary": "Simple one-day recurring event",
"description": "This is a simple one-day recurring event",
"type": "Event",
"allDay": false,
"isMinor": false,
"startDateTime": {
"date": "2016-05-06",
"time": "14:15:00",
"tz": "Europe/Prague"
},
"endDateTime": {
"date": "2016-05-06",
"time": "15:15:00",
"tz": "Europe/Prague"
},
"uid": "Akonadi-8-20160506T141500CEST"
},
{
"summary": "Simple one-day recurring event",
"description": "This is a simple one-day recurring event",
"type": "Event",
"allDay": false,
"isMinor": false,
"startDateTime": {
"date": "2016-05-13",
"time": "14:15:00",
"tz": "Europe/Prague"
},
"endDateTime": {
"date": "2016-05-13",
"time": "15:15:00",
"tz": "Europe/Prague"
},
"uid": "Akonadi-8-20160513T141500CEST"
},
{
"summary": "Simple one-day recurring event",
"description": "This is a simple one-day recurring event",
"type": "Event",
"allDay": false,
"isMinor": false,
"startDateTime": {
"date": "2016-05-20",
"time": "14:15:00",
"tz": "Europe/Prague"
},
"endDateTime": {
"date": "2016-05-20",
"time": "15:15:00",
"tz": "Europe/Prague"
},
"uid": "Akonadi-8-20160520T141500CEST"
},
{
"summary": "Simple one-day recurring event",
"description": "This is a simple one-day recurring event",
"type": "Event",
"allDay": false,
"isMinor": false,
"startDateTime": {
"date": "2016-05-27",
"time": "14:15:00",
"tz": "Europe/Prague"
},
"endDateTime": {
"date": "2016-05-27",
"time": "15:15:00",
"tz": "Europe/Prague"
},
"uid": "Akonadi-8-20160527T141500CEST"
}
]
}
/*
* Copyright (C) 2016 Daniel Vrátil <dvratil@kde.org>
*
* 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.
*
* This program is distributed in the hope that it will be useful,