Merge lp:~renatofilho/ubuntu-calendar-app/fix-1563742 into lp:ubuntu-calendar-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Arthur Mello
Approved revision: 818
Merged at revision: 817
Proposed branch: lp:~renatofilho/ubuntu-calendar-app/fix-1563742
Merge into: lp:ubuntu-calendar-app
Diff against target: 103 lines (+66/-1)
3 files modified
calendar_canvas.js (+7/-0)
click/calendar.apparmor (+3/-0)
tests/unittests/tst_calendar_canvas.qml (+56/-1)
To merge this branch: bzr merge lp:~renatofilho/ubuntu-calendar-app/fix-1563742
Reviewer Review Type Date Requested Status
Arthur Mello (community) Approve
Jenkins Bot continuous-integration Approve
Review via email: mp+290901@code.launchpad.net

Commit message

Fixed event drawing during the DST change.

Added /etc/writable/timezone as read path on apparmor file.
This is necessary by qtorganizer5-eds to retrieve device timezone.

Description of the change

OBS: You need silo 39 to test it
https://requests.ci-train.ubuntu.com/#/ticket/1213

How to test:

1 - Change your device tz to Europe/Paris
2 - Create a event at 7AM until 8AM before 27th March that repeats every day

Expected result:
Check if the event appears on the same time (7AM-8AM) on 26, 27, 28 of March and all other days

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
815. By Renato Araujo Oliveira Filho

Fix event drawing on DST change.

816. By Renato Araujo Oliveira Filho

Fixed apparmor invalid syntax.

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
817. By Renato Araujo Oliveira Filho

Added tests for events in multiple days.

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
818. By Renato Araujo Oliveira Filho

Remove empty line.

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Arthur Mello (artmello) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'calendar_canvas.js'
2--- calendar_canvas.js 2016-03-21 21:28:31 +0000
3+++ calendar_canvas.js 2016-04-05 14:44:53 +0000
4@@ -8,6 +8,13 @@
5 var untilTime = new Date(until)
6 untilTime.setSeconds(0)
7
8+ // We need that to avoid problems with DST times
9+ // Without this the event will be showed in the wrong time on the day that the DST occur
10+ // Example: 27/03 (Europe/Paris)
11+ if (sinceTime.isSameDay(untilTime)) {
12+ return (untilTime.getHours() * 60) + untilTime.getMinutes();
13+ }
14+
15 var sinceTimeInSecs = sinceTime.getTime()
16 var untilTimeInSecs = untilTime.getTime()
17
18
19=== modified file 'click/calendar.apparmor'
20--- click/calendar.apparmor 2016-03-03 21:42:08 +0000
21+++ click/calendar.apparmor 2016-04-05 14:44:53 +0000
22@@ -6,5 +6,8 @@
23 "accounts",
24 "push-notification-client"
25 ],
26+ "read_path": [
27+ "/etc/writable/timezone"
28+ ],
29 "policy_version": 1.3
30 }
31
32=== modified file 'tests/unittests/tst_calendar_canvas.qml'
33--- tests/unittests/tst_calendar_canvas.qml 2016-03-30 10:42:57 +0000
34+++ tests/unittests/tst_calendar_canvas.qml 2016-04-05 14:44:53 +0000
35@@ -16,7 +16,7 @@
36
37 manager: "memory"
38 startPeriod: new Date(2016, 7, 2, 0, 0, 0, 0)
39- endPeriod: new Date(2016, 13, 2, 0, 0, 0, 0)
40+ endPeriod: new Date(2016, 11, 2, 0, 0, 0, 0)
41 autoUpdate: true
42 }
43 }
44@@ -669,4 +669,59 @@
45 compare(eventsE.intersectionCount, 5)
46 fuzzyCompare(eventsE.width, 0.3, 0.1)
47 }
48+
49+ // Event starts a day before
50+ // 00:00 |XX| ----
51+ // |XX| ----
52+ // 01:00 ---- ----
53+ function test_starts_a_day_before()
54+ {
55+ var data = [{startDate: new Date(2016, 7, 2, 23, 0, 0, 0),
56+ endDate: new Date(2016, 7, 3, 1, 0, 0, 0),
57+ label: "Event at 23:00 until 1:00"}
58+ ]
59+ var model = create_events(data)
60+
61+ var startDate = new Date(2016, 7, 3, 11, 11, 11, 11)
62+ worker.start(model, startDate)
63+ tryCompare(worker, 'done', true)
64+ var eventMap = worker.reply
65+
66+ // "Event at 23:00 until 1:00"
67+ var eventsA = eventMap[0]
68+ compare(eventsA.event.displayLabel, "Event at 23:00 until 1:00")
69+ compare(eventsA.y, 0)
70+ compare(eventsA.startTime, 0)
71+ compare(eventsA.endTime, 60)
72+ compare(eventsA.intersectionCount, 1)
73+ fuzzyCompare(eventsA.width, 1.0, 0.0)
74+ }
75+
76+ // Event ends a day after
77+ // 22:00 |XX| ----
78+ // |XX| ----
79+ // 23:00 |XX| ----
80+ /// |XX| ----
81+ function test_ends_a_day_after()
82+ {
83+ var data = [{startDate: new Date(2016, 7, 2, 22, 0, 0, 0),
84+ endDate: new Date(2016, 7, 3, 1, 0, 0, 0),
85+ label: "Event at 22:00 until 1:00"}
86+ ]
87+ var model = create_events(data)
88+
89+ var startDate = new Date(2016, 7, 2, 0, 0, 0, 0)
90+ worker.start(model, startDate)
91+ tryCompare(worker, 'done', true)
92+ var eventMap = worker.reply
93+
94+ // "Event at 22:00 until 1:00"
95+ var eventsA = eventMap[0]
96+ compare(eventsA.event.displayLabel, "Event at 22:00 until 1:00")
97+ compare(eventsA.y, 0)
98+ compare(eventsA.intersectionCount, 1)
99+ fuzzyCompare(eventsA.startTime, 1320, 0.1)
100+ fuzzyCompare(eventsA.endTime, 1440, 0.1)
101+ fuzzyCompare(eventsA.width, 1.0, 0.0)
102+ }
103 }

Subscribers

People subscribed via source and target branches

to status/vote changes: