Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
KDE PIM Add-ons
Commits
33032d5d
Commit
33032d5d
authored
Jun 19, 2016
by
Daniel Vrátil
🤖
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PimEventsPlugin: fix timezone handling in unit-tests
parent
415cc2c3
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
31 additions
and
7 deletions
+31
-7
plugins/plasma/pimeventsplugin/autotests/data/allday-multiday-event.ics
.../pimeventsplugin/autotests/data/allday-multiday-event.ics
+2
-0
plugins/plasma/pimeventsplugin/autotests/data/allday-oneday-event.ics
...ma/pimeventsplugin/autotests/data/allday-oneday-event.ics
+2
-0
plugins/plasma/pimeventsplugin/autotests/data/allday-recurring-multiday-event.ics
...plugin/autotests/data/allday-recurring-multiday-event.ics
+2
-0
plugins/plasma/pimeventsplugin/autotests/data/allday-recurring-oneday-event.ics
...tsplugin/autotests/data/allday-recurring-oneday-event.ics
+2
-0
plugins/plasma/pimeventsplugin/autotests/data/simple-multiday-event.ics
.../pimeventsplugin/autotests/data/simple-multiday-event.ics
+2
-0
plugins/plasma/pimeventsplugin/autotests/data/simple-oneday-event.ics
...ma/pimeventsplugin/autotests/data/simple-oneday-event.ics
+2
-0
plugins/plasma/pimeventsplugin/autotests/data/simple-recurring-multiday-event.ics
...plugin/autotests/data/simple-recurring-multiday-event.ics
+2
-0
plugins/plasma/pimeventsplugin/autotests/data/simple-recurring-oneday-event.ics
...tsplugin/autotests/data/simple-recurring-oneday-event.ics
+2
-0
plugins/plasma/pimeventsplugin/autotests/eventdatavisitortest.cpp
...plasma/pimeventsplugin/autotests/eventdatavisitortest.cpp
+0
-1
plugins/plasma/pimeventsplugin/autotests/fakepimdatasource.cpp
...ns/plasma/pimeventsplugin/autotests/fakepimdatasource.cpp
+1
-1
plugins/plasma/pimeventsplugin/autotests/testdataparser.cpp
plugins/plasma/pimeventsplugin/autotests/testdataparser.cpp
+14
-5
No files found.
plugins/plasma/pimeventsplugin/autotests/data/allday-multiday-event.ics
View file @
33032d5d
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//K Desktop Environment//NONSGML KOrganizer 5.2.50 pre
BEGIN:VEVENT
DTSTAMP:20160529T143409Z
CREATED:20160529T143351Z
...
...
plugins/plasma/pimeventsplugin/autotests/data/allday-oneday-event.ics
View file @
33032d5d
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//K Desktop Environment//NONSGML KOrganizer 5.2.50 pre
BEGIN:VEVENT
DTSTAMP:20160529T143104Z
CREATED:20160529T143019Z
...
...
plugins/plasma/pimeventsplugin/autotests/data/allday-recurring-multiday-event.ics
View file @
33032d5d
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//K Desktop Environment//NONSGML KOrganizer 5.2.50 pre
BEGIN:VEVENT
DTSTAMP:20160529T143448Z
CREATED:20160529T143412Z
...
...
plugins/plasma/pimeventsplugin/autotests/data/allday-recurring-oneday-event.ics
View file @
33032d5d
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//K Desktop Environment//NONSGML KOrganizer 5.2.50 pre
BEGIN:VEVENT
DTSTAMP:20160529T143257Z
CREATED:20160529T143223Z
...
...
plugins/plasma/pimeventsplugin/autotests/data/simple-multiday-event.ics
View file @
33032d5d
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//K Desktop Environment//NONSGML KOrganizer 5.2.50 pre
BEGIN:VEVENT
DTSTAMP:20160529T143349Z
CREATED:20160529T143303Z
...
...
plugins/plasma/pimeventsplugin/autotests/data/simple-oneday-event.ics
View file @
33032d5d
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//K Desktop Environment//NONSGML KOrganizer 5.2.50 pre
BEGIN:VEVENT
DTSTAMP:20160529T143018Z
CREATED:20160529T142843Z
...
...
plugins/plasma/pimeventsplugin/autotests/data/simple-recurring-multiday-event.ics
View file @
33032d5d
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//K Desktop Environment//NONSGML KOrganizer 5.2.50 pre
BEGIN:VEVENT
DTSTAMP:20160529T143526Z
CREATED:20160529T143451Z
...
...
plugins/plasma/pimeventsplugin/autotests/data/simple-recurring-oneday-event.ics
View file @
33032d5d
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//K Desktop Environment//NONSGML KOrganizer 5.2.50 pre
BEGIN:VEVENT
DTSTAMP:20160529T143213Z
CREATED:20160529T143106Z
...
...
plugins/plasma/pimeventsplugin/autotests/eventdatavisitortest.cpp
View file @
33032d5d
...
...
@@ -27,7 +27,6 @@
#include <KCalCore/Event>
#include <KCalCore/Todo>
#include <KCalCore/ICalFormat>
#include <CalendarEvents/CalendarEventsPlugin>
...
...
plugins/plasma/pimeventsplugin/autotests/fakepimdatasource.cpp
View file @
33032d5d
...
...
@@ -23,7 +23,7 @@
FakePimDataSource
::
FakePimDataSource
()
:
PimDataSource
()
,
mCalendar
(
new
KCalCore
::
MemoryCalendar
(
KDateTime
::
UTC
))
,
mCalendar
(
new
KCalCore
::
MemoryCalendar
(
KDateTime
::
LocalZone
))
{
}
...
...
plugins/plasma/pimeventsplugin/autotests/testdataparser.cpp
View file @
33032d5d
...
...
@@ -28,6 +28,7 @@
#include <QtTest/QTest>
#include <KCalCore/ICalFormat>
#include <KCalCore/MemoryCalendar>
#include <CalendarEvents/CalendarEventsPlugin>
...
...
@@ -82,7 +83,7 @@ QDateTime TestDataParser::parseDateTime(const QJsonObject &dateTime)
{
return
QDateTime
(
QDate
::
fromString
(
dateTime
[
QStringLiteral
(
"date"
)].
toString
(),
Qt
::
ISODate
),
QTime
::
fromString
(
dateTime
[
QStringLiteral
(
"time"
)].
toString
(),
Qt
::
ISODate
),
QTimeZone
(
dateTime
[
QStringLiteral
(
"tz"
)].
toString
().
toLatin1
()));
QTimeZone
(
dateTime
[
QStringLiteral
(
"tz"
)].
toString
().
toLatin1
()))
.
toLocalTime
()
;
}
void
TestDataParser
::
parse
()
...
...
@@ -91,9 +92,11 @@ void TestDataParser::parse()
QVERIFY
(
icalFile
.
exists
());
QVERIFY
(
icalFile
.
open
(
QIODevice
::
ReadOnly
));
const
QByteArray
data
=
icalFile
.
readAll
(
);
auto
calendar
=
KCalCore
::
MemoryCalendar
::
Ptr
::
create
(
KDateTime
::
LocalZone
);
KCalCore
::
ICalFormat
format
;
mIncidence
=
format
.
readIncidence
(
data
);
QVERIFY
(
format
.
load
(
calendar
,
icalFile
.
fileName
()));
QVERIFY
(
!
calendar
->
incidences
().
isEmpty
());
mIncidence
=
calendar
->
incidences
().
at
(
0
);
QVERIFY
(
mIncidence
);
QFile
jsonFile
(
QStringLiteral
(
PIMEVENT_DATADIR
"/data/%1.json"
).
arg
(
mTestData
));
...
...
@@ -121,9 +124,15 @@ void TestDataParser::parse()
}
eventData
.
setIsAllDay
(
obj
[
QStringLiteral
(
"allDay"
)].
toBool
());
eventData
.
setIsMinor
(
obj
[
QStringLiteral
(
"isMinor"
)].
toBool
());
const
QDateTime
startDateTime
=
parseDateTime
(
obj
[
QStringLiteral
(
"startDateTime"
)].
toObject
());
QDateTime
startDateTime
=
parseDateTime
(
obj
[
QStringLiteral
(
"startDateTime"
)].
toObject
());
if
(
eventData
.
isAllDay
())
{
startDateTime
.
setTime
(
QTime
(
0
,
0
,
0
,
Qt
::
LocalTime
));
}
eventData
.
setStartDateTime
(
startDateTime
);
const
QDateTime
endDateTime
=
parseDateTime
(
obj
[
QStringLiteral
(
"endDateTime"
)].
toObject
());
QDateTime
endDateTime
=
parseDateTime
(
obj
[
QStringLiteral
(
"endDateTime"
)].
toObject
());
if
(
eventData
.
isAllDay
())
{
endDateTime
.
setTime
(
QTime
(
0
,
0
,
0
,
Qt
::
LocalTime
));
}
eventData
.
setEndDateTime
(
endDateTime
);
eventData
.
setUid
(
obj
[
QStringLiteral
(
"uid"
)].
toString
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment