Merge lp:~renatofilho/indicator-datetime/fix-1508438 into lp:indicator-datetime/15.10
- fix-1508438
- Merge into trunk.15.10
Status: | Merged |
---|---|
Approved by: | Charles Kerr |
Approved revision: | 453 |
Merged at revision: | 446 |
Proposed branch: | lp:~renatofilho/indicator-datetime/fix-1508438 |
Merge into: | lp:indicator-datetime/15.10 |
Diff against target: |
1145 lines (+497/-214) 20 files modified
CMakeLists.txt (+3/-2) debian/control (+2/-0) include/datetime/engine-eds.h (+3/-2) include/datetime/myself.h (+62/-0) src/CMakeLists.txt (+1/-0) src/engine-eds.cpp (+185/-196) src/main.cpp (+2/-1) src/myself.cpp (+76/-0) tests/CMakeLists.txt (+3/-1) tests/run-eds-ics-test.sh (+9/-1) tests/test-eds-ics-all-day-events.cpp (+3/-2) tests/test-eds-ics-missing-trigger.cpp (+2/-1) tests/test-eds-ics-non-attending-alarms.cpp (+79/-0) tests/test-eds-ics-non-attending-alarms.ics.in (+53/-0) tests/test-eds-ics-nonrepeating-events.cpp (+3/-2) tests/test-eds-ics-repeating-events.cpp (+3/-2) tests/test-eds-ics-repeating-valarms.cpp (+2/-1) tests/test-eds-ics-tzids-2.cpp (+2/-1) tests/test-eds-ics-tzids-utc.cpp (+2/-1) tests/test-eds-ics-tzids.cpp (+2/-1) |
To merge this branch: | bzr merge lp:~renatofilho/indicator-datetime/fix-1508438 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Charles Kerr (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Arthur Mello (community) | Approve | ||
Review via email: mp+290502@code.launchpad.net |
Commit message
Ignore alarms for events marked as not attending.
Description of the change
How To test:
1 - Create a event on google calendar in the next minutes
2 - Mark the event as not attending
3 - On phone sync your calendar
3.1 - Make sure that the new event appears on your calendar app
4 - Make sure that the event does not show on indicator
5 - Wait until the event starts and make sure that no alarm is played.
Renato Araujo Oliveira Filho (renatofilho) : | # |
Charles Kerr (charlesk) : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:449
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Charles Kerr (charlesk) : | # |
Charles Kerr (charlesk) wrote : | # |
The code looks fine.
It may be an issue on my system, but I'm getting inconsistent test failures when I run ctest in a repeat-until-fail loop. I suspect this is a timing issue in the test setup rather than a bug in the new code.
Renato Araujo Oliveira Filho (renatofilho) wrote : | # |
any specific tets?
- 452. By Renato Araujo Oliveira Filho
-
Does not free list that was used on concat.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:452
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Charles Kerr (charlesk) : | # |
- 453. By Renato Araujo Oliveira Filho
-
Reduce libaccounts-
glib-dev required version.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:453
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Charles Kerr (charlesk) : | # |
- 454. By Renato Araujo Oliveira Filho
-
Trunk merged.
Preview Diff
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2016-02-03 16:33:39 +0000 | |||
3 | +++ CMakeLists.txt 2016-04-19 02:46:55 +0000 | |||
4 | @@ -20,7 +20,7 @@ | |||
5 | 20 | 20 | ||
6 | 21 | ## | 21 | ## |
7 | 22 | ## GNU standard installation directories | 22 | ## GNU standard installation directories |
9 | 23 | ## | 23 | ## |
10 | 24 | 24 | ||
11 | 25 | include (GNUInstallDirs) | 25 | include (GNUInstallDirs) |
12 | 26 | if (EXISTS "/etc/debian_version") # Workaround for libexecdir on debian | 26 | if (EXISTS "/etc/debian_version") # Workaround for libexecdir on debian |
13 | @@ -47,7 +47,8 @@ | |||
14 | 47 | gstreamer-1.0>=1.2 | 47 | gstreamer-1.0>=1.2 |
15 | 48 | libnotify>=0.7.6 | 48 | libnotify>=0.7.6 |
16 | 49 | url-dispatcher-1>=1 | 49 | url-dispatcher-1>=1 |
18 | 50 | properties-cpp>=0.0.1) | 50 | properties-cpp>=0.0.1 |
19 | 51 | libaccounts-glib>=1.18) | ||
20 | 51 | include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS}) | 52 | include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS}) |
21 | 52 | 53 | ||
22 | 53 | ## | 54 | ## |
23 | 54 | 55 | ||
24 | === modified file 'debian/control' | |||
25 | --- debian/control 2016-03-10 16:20:36 +0000 | |||
26 | +++ debian/control 2016-04-19 02:46:55 +0000 | |||
27 | @@ -29,6 +29,8 @@ | |||
28 | 29 | gvfs-daemons, | 29 | gvfs-daemons, |
29 | 30 | # for phone alarm/calendar notification sound tests: | 30 | # for phone alarm/calendar notification sound tests: |
30 | 31 | ubuntu-touch-sounds, | 31 | ubuntu-touch-sounds, |
31 | 32 | # for query user e-mails based on accounts | ||
32 | 33 | libaccounts-glib-dev, | ||
33 | 32 | Standards-Version: 3.9.3 | 34 | Standards-Version: 3.9.3 |
34 | 33 | Homepage: https://launchpad.net/indicator-datetime | 35 | Homepage: https://launchpad.net/indicator-datetime |
35 | 34 | # If you aren't a member of ~indicator-applet-developers but need to upload | 36 | # If you aren't a member of ~indicator-applet-developers but need to upload |
36 | 35 | 37 | ||
37 | === modified file 'include/datetime/engine-eds.h' | |||
38 | --- include/datetime/engine-eds.h 2014-12-08 02:52:50 +0000 | |||
39 | +++ include/datetime/engine-eds.h 2016-04-19 02:46:55 +0000 | |||
40 | @@ -36,16 +36,17 @@ | |||
41 | 36 | /**** | 36 | /**** |
42 | 37 | ***** | 37 | ***** |
43 | 38 | ****/ | 38 | ****/ |
44 | 39 | class Myself; | ||
45 | 39 | 40 | ||
46 | 40 | /** | 41 | /** |
47 | 41 | * Class wrapper around EDS so multiple #EdsPlanners can share resources | 42 | * Class wrapper around EDS so multiple #EdsPlanners can share resources |
49 | 42 | * | 43 | * |
50 | 43 | * @see EdsPlanner | 44 | * @see EdsPlanner |
51 | 44 | */ | 45 | */ |
52 | 45 | class EdsEngine: public Engine | 46 | class EdsEngine: public Engine |
53 | 46 | { | 47 | { |
54 | 47 | public: | 48 | public: |
56 | 48 | EdsEngine(); | 49 | EdsEngine(const std::shared_ptr<Myself> &myself); |
57 | 49 | ~EdsEngine(); | 50 | ~EdsEngine(); |
58 | 50 | 51 | ||
59 | 51 | void get_appointments(const DateTime& begin, | 52 | void get_appointments(const DateTime& begin, |
60 | 52 | 53 | ||
61 | === added file 'include/datetime/myself.h' | |||
62 | --- include/datetime/myself.h 1970-01-01 00:00:00 +0000 | |||
63 | +++ include/datetime/myself.h 2016-04-19 02:46:55 +0000 | |||
64 | @@ -0,0 +1,62 @@ | |||
65 | 1 | /* | ||
66 | 2 | * Copyright 2016 Canonical Ltd. | ||
67 | 3 | * | ||
68 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
69 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
70 | 6 | * by the Free Software Foundation. | ||
71 | 7 | * | ||
72 | 8 | * This program is distributed in the hope that it will be useful, but | ||
73 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
74 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
75 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
76 | 12 | * | ||
77 | 13 | * You should have received a copy of the GNU General Public License along | ||
78 | 14 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
79 | 15 | * | ||
80 | 16 | * Authors: | ||
81 | 17 | * Renato Araujo Oliveira Filho <renato.filho@canonical.com> | ||
82 | 18 | */ | ||
83 | 19 | |||
84 | 20 | #ifndef INDICATOR_DATETIME_MYSELF_H | ||
85 | 21 | #define INDICATOR_DATETIME_MYSELF_H | ||
86 | 22 | |||
87 | 23 | #include <core/property.h> | ||
88 | 24 | |||
89 | 25 | #include <string> | ||
90 | 26 | #include <set> | ||
91 | 27 | #include <memory.h> | ||
92 | 28 | #include <glib.h> | ||
93 | 29 | |||
94 | 30 | typedef struct _AgManager AgManager; | ||
95 | 31 | |||
96 | 32 | namespace unity { | ||
97 | 33 | namespace indicator { | ||
98 | 34 | namespace datetime { | ||
99 | 35 | |||
100 | 36 | class Myself | ||
101 | 37 | { | ||
102 | 38 | public: | ||
103 | 39 | Myself(); | ||
104 | 40 | |||
105 | 41 | const core::Property<std::set<std::string>>& emails() | ||
106 | 42 | { | ||
107 | 43 | return m_emails; | ||
108 | 44 | } | ||
109 | 45 | |||
110 | 46 | bool isMyEmail(const std::string &email); | ||
111 | 47 | |||
112 | 48 | private: | ||
113 | 49 | std::shared_ptr<AgManager> m_accounts_manager; | ||
114 | 50 | core::Property<std::set<std::string> > m_emails; | ||
115 | 51 | |||
116 | 52 | static void on_accounts_changed(AgManager*, guint, Myself*); | ||
117 | 53 | void reloadEmails(); | ||
118 | 54 | |||
119 | 55 | }; | ||
120 | 56 | |||
121 | 57 | |||
122 | 58 | } // namespace datetime | ||
123 | 59 | } // namespace indicator | ||
124 | 60 | } // namespace unity | ||
125 | 61 | |||
126 | 62 | #endif // INDICATOR_DATETIME_MYSELF_H | ||
127 | 0 | 63 | ||
128 | === modified file 'src/CMakeLists.txt' | |||
129 | --- src/CMakeLists.txt 2015-09-01 09:52:13 +0000 | |||
130 | +++ src/CMakeLists.txt 2016-04-19 02:46:55 +0000 | |||
131 | @@ -23,6 +23,7 @@ | |||
132 | 23 | locations.cpp | 23 | locations.cpp |
133 | 24 | locations-settings.cpp | 24 | locations-settings.cpp |
134 | 25 | menu.cpp | 25 | menu.cpp |
135 | 26 | myself.cpp | ||
136 | 26 | notifications.cpp | 27 | notifications.cpp |
137 | 27 | planner.cpp | 28 | planner.cpp |
138 | 28 | planner-aggregate.cpp | 29 | planner-aggregate.cpp |
139 | 29 | 30 | ||
140 | === modified file 'src/engine-eds.cpp' | |||
141 | --- src/engine-eds.cpp 2016-03-22 19:32:25 +0000 | |||
142 | +++ src/engine-eds.cpp 2016-04-19 02:46:55 +0000 | |||
143 | @@ -18,6 +18,7 @@ | |||
144 | 18 | */ | 18 | */ |
145 | 19 | 19 | ||
146 | 20 | #include <datetime/engine-eds.h> | 20 | #include <datetime/engine-eds.h> |
147 | 21 | #include <datetime/myself.h> | ||
148 | 21 | 22 | ||
149 | 22 | #include <libical/ical.h> | 23 | #include <libical/ical.h> |
150 | 23 | #include <libical/icaltime.h> | 24 | #include <libical/icaltime.h> |
151 | @@ -48,7 +49,8 @@ | |||
152 | 48 | { | 49 | { |
153 | 49 | public: | 50 | public: |
154 | 50 | 51 | ||
156 | 51 | Impl() | 52 | Impl(const std::shared_ptr<Myself> &myself) |
157 | 53 | : m_myself(myself) | ||
158 | 52 | { | 54 | { |
159 | 53 | auto cancellable_deleter = [](GCancellable * c) { | 55 | auto cancellable_deleter = [](GCancellable * c) { |
160 | 54 | g_cancellable_cancel(c); | 56 | g_cancellable_cancel(c); |
161 | @@ -56,8 +58,10 @@ | |||
162 | 56 | }; | 58 | }; |
163 | 57 | 59 | ||
164 | 58 | m_cancellable = std::shared_ptr<GCancellable>(g_cancellable_new(), cancellable_deleter); | 60 | m_cancellable = std::shared_ptr<GCancellable>(g_cancellable_new(), cancellable_deleter); |
165 | 59 | |||
166 | 60 | e_source_registry_new(m_cancellable.get(), on_source_registry_ready, this); | 61 | e_source_registry_new(m_cancellable.get(), on_source_registry_ready, this); |
167 | 62 | m_myself->emails().changed().connect([this](const std::set<std::string> &) { | ||
168 | 63 | set_dirty_soon(); | ||
169 | 64 | }); | ||
170 | 61 | } | 65 | } |
171 | 62 | 66 | ||
172 | 63 | ~Impl() | 67 | ~Impl() |
173 | @@ -92,26 +96,19 @@ | |||
174 | 92 | /** | 96 | /** |
175 | 93 | *** init the default timezone | 97 | *** init the default timezone |
176 | 94 | **/ | 98 | **/ |
177 | 95 | |||
178 | 96 | icaltimezone * default_timezone = nullptr; | 99 | icaltimezone * default_timezone = nullptr; |
179 | 97 | const auto tz = timezone.timezone.get().c_str(); | 100 | const auto tz = timezone.timezone.get().c_str(); |
188 | 98 | if (tz && *tz) | 101 | auto gtz = timezone_from_name(tz, nullptr, nullptr, &default_timezone); |
189 | 99 | { | 102 | if (gtz == nullptr) { |
190 | 100 | default_timezone = icaltimezone_get_builtin_timezone(tz); | 103 | gtz = g_time_zone_new_local(); |
183 | 101 | |||
184 | 102 | if (default_timezone == nullptr) // maybe str is a tzid? | ||
185 | 103 | default_timezone = icaltimezone_get_builtin_timezone_from_tzid(tz); | ||
186 | 104 | |||
187 | 105 | g_debug("default_timezone is %p", (void*)default_timezone); | ||
191 | 106 | } | 104 | } |
192 | 107 | 105 | ||
193 | 106 | g_debug("default_timezone is %s", default_timezone ? icaltimezone_get_display_name(default_timezone) : "null"); | ||
194 | 107 | |||
195 | 108 | /** | 108 | /** |
196 | 109 | *** walk through the sources to build the appointment list | 109 | *** walk through the sources to build the appointment list |
197 | 110 | **/ | 110 | **/ |
198 | 111 | 111 | ||
199 | 112 | auto gtz = default_timezone != nullptr | ||
200 | 113 | ? g_time_zone_new(icaltimezone_get_location(default_timezone)) | ||
201 | 114 | : g_time_zone_new_local(); | ||
202 | 115 | auto main_task = std::make_shared<Task>(this, func, default_timezone, gtz, begin, end); | 112 | auto main_task = std::make_shared<Task>(this, func, default_timezone, gtz, begin, end); |
203 | 116 | 113 | ||
204 | 117 | for (auto& kv : m_clients) | 114 | for (auto& kv : m_clients) |
205 | @@ -125,35 +122,14 @@ | |||
206 | 125 | auto extension = e_source_get_extension(source, E_SOURCE_EXTENSION_CALENDAR); | 122 | auto extension = e_source_get_extension(source, E_SOURCE_EXTENSION_CALENDAR); |
207 | 126 | const auto color = e_source_selectable_get_color(E_SOURCE_SELECTABLE(extension)); | 123 | const auto color = e_source_selectable_get_color(E_SOURCE_SELECTABLE(extension)); |
208 | 127 | 124 | ||
238 | 128 | auto begin_str = isodate_from_time_t(begin.to_unix()); | 125 | e_cal_client_generate_instances( |
239 | 129 | auto end_str = isodate_from_time_t(end.to_unix()); | 126 | client, |
240 | 130 | auto sexp_fmt = g_strdup_printf("(%%s? (make-time \"%s\") (make-time \"%s\"))", begin_str, end_str); | 127 | begin.to_unix(), |
241 | 131 | g_clear_pointer(&begin_str, g_free); | 128 | end.to_unix(), |
242 | 132 | g_clear_pointer(&end_str, g_free); | 129 | m_cancellable.get(), |
243 | 133 | 130 | on_event_generated, | |
244 | 134 | // ask EDS about alarms that occur in this window... | 131 | new ClientSubtask(main_task, client, m_cancellable, color), |
245 | 135 | auto sexp = g_strdup_printf(sexp_fmt, "has-alarms-in-range"); | 132 | on_event_generated_list_ready); |
217 | 136 | g_debug("%s alarm sexp is %s", G_STRLOC, sexp); | ||
218 | 137 | e_cal_client_get_object_list_as_comps( | ||
219 | 138 | client, | ||
220 | 139 | sexp, | ||
221 | 140 | m_cancellable.get(), | ||
222 | 141 | on_alarm_component_list_ready, | ||
223 | 142 | new ClientSubtask(main_task, client, m_cancellable, color)); | ||
224 | 143 | g_clear_pointer(&sexp, g_free); | ||
225 | 144 | |||
226 | 145 | // ask EDS about events that occur in this window... | ||
227 | 146 | sexp = g_strdup_printf(sexp_fmt, "occur-in-time-range"); | ||
228 | 147 | g_debug("%s event sexp is %s", G_STRLOC, sexp); | ||
229 | 148 | e_cal_client_get_object_list_as_comps( | ||
230 | 149 | client, | ||
231 | 150 | sexp, | ||
232 | 151 | m_cancellable.get(), | ||
233 | 152 | on_event_component_list_ready, | ||
234 | 153 | new ClientSubtask(main_task, client, m_cancellable, color)); | ||
235 | 154 | g_clear_pointer(&sexp, g_free); | ||
236 | 155 | |||
237 | 156 | g_clear_pointer(&sexp_fmt, g_free); | ||
246 | 157 | } | 133 | } |
247 | 158 | } | 134 | } |
248 | 159 | 135 | ||
249 | @@ -591,6 +567,8 @@ | |||
250 | 591 | ECalClient* client; | 567 | ECalClient* client; |
251 | 592 | std::shared_ptr<GCancellable> cancellable; | 568 | std::shared_ptr<GCancellable> cancellable; |
252 | 593 | std::string color; | 569 | std::string color; |
253 | 570 | GList *components; | ||
254 | 571 | GList *instance_components; | ||
255 | 594 | 572 | ||
256 | 595 | ClientSubtask(const std::shared_ptr<Task>& task_in, | 573 | ClientSubtask(const std::shared_ptr<Task>& task_in, |
257 | 596 | ECalClient* client_in, | 574 | ECalClient* client_in, |
258 | @@ -598,10 +576,13 @@ | |||
259 | 598 | const char* color_in): | 576 | const char* color_in): |
260 | 599 | task(task_in), | 577 | task(task_in), |
261 | 600 | client(client_in), | 578 | client(client_in), |
263 | 601 | cancellable(cancellable_in) | 579 | cancellable(cancellable_in), |
264 | 580 | components(nullptr), | ||
265 | 581 | instance_components(nullptr) | ||
266 | 602 | { | 582 | { |
267 | 603 | if (color_in) | 583 | if (color_in) |
268 | 604 | color = color_in; | 584 | color = color_in; |
269 | 585 | |||
270 | 605 | } | 586 | } |
271 | 606 | }; | 587 | }; |
272 | 607 | 588 | ||
273 | @@ -648,87 +629,122 @@ | |||
274 | 648 | return ret; | 629 | return ret; |
275 | 649 | } | 630 | } |
276 | 650 | 631 | ||
358 | 651 | static void | 632 | static gboolean |
359 | 652 | on_alarm_component_list_ready(GObject * oclient, | 633 | on_event_generated(ECalComponent *comp, |
360 | 653 | GAsyncResult * res, | 634 | time_t, |
361 | 654 | gpointer gsubtask) | 635 | time_t, |
362 | 655 | { | 636 | gpointer gsubtask) |
363 | 656 | GError * error = NULL; | 637 | { |
364 | 657 | GSList * comps_slist = NULL; | 638 | auto subtask = static_cast<ClientSubtask*>(gsubtask); |
365 | 658 | auto subtask = static_cast<ClientSubtask*>(gsubtask); | 639 | const gchar *uid = nullptr; |
366 | 659 | 640 | e_cal_component_get_uid (comp, &uid); | |
367 | 660 | if (e_cal_client_get_object_list_as_comps_finish(E_CAL_CLIENT(oclient), | 641 | g_object_ref(comp); |
368 | 661 | res, | 642 | if (e_cal_component_is_instance(comp)) |
369 | 662 | &comps_slist, | 643 | subtask->instance_components = g_list_append(subtask->instance_components, comp); |
370 | 663 | &error)) | 644 | else |
371 | 664 | { | 645 | subtask->components = g_list_append(subtask->components, comp); |
372 | 665 | // _generate_alarms takes a GList, so make a shallow one | 646 | return TRUE; |
373 | 666 | GList * comps_list = nullptr; | 647 | } |
374 | 667 | for (auto l=comps_slist; l!=nullptr; l=l->next) | 648 | |
375 | 668 | comps_list = g_list_prepend(comps_list, l->data); | 649 | static void |
376 | 669 | 650 | on_event_generated_list_ready(gpointer gsubtask) | |
377 | 670 | constexpr std::array<ECalComponentAlarmAction,1> omit = { | 651 | { |
378 | 671 | (ECalComponentAlarmAction)-1 | 652 | auto subtask = static_cast<ClientSubtask*>(gsubtask); |
379 | 672 | }; // list of action types to omit, terminated with -1 | 653 | |
380 | 673 | GSList * comp_alarms = nullptr; | 654 | // generate alarms |
381 | 674 | e_cal_util_generate_alarms_for_list( | 655 | constexpr std::array<ECalComponentAlarmAction,1> omit = { |
382 | 675 | comps_list, | 656 | (ECalComponentAlarmAction)-1 |
383 | 676 | subtask->task->begin.to_unix(), | 657 | }; // list of action types to omit, terminated with -1 |
384 | 677 | subtask->task->end.to_unix(), | 658 | GSList * comp_alarms = nullptr; |
385 | 678 | const_cast<ECalComponentAlarmAction*>(omit.data()), | 659 | |
386 | 679 | &comp_alarms, | 660 | // we do not need translate tz for instance events, |
387 | 680 | e_cal_client_resolve_tzid_cb, | 661 | // they are aredy in the correct time |
388 | 681 | oclient, | 662 | e_cal_util_generate_alarms_for_list( |
389 | 682 | subtask->task->default_timezone); | 663 | subtask->instance_components, |
390 | 683 | 664 | subtask->task->begin.to_unix(), | |
391 | 684 | // walk the alarms & add them | 665 | subtask->task->end.to_unix(), |
392 | 685 | for (auto l=comp_alarms; l!=nullptr; l=l->next) | 666 | const_cast<ECalComponentAlarmAction*>(omit.data()), |
393 | 686 | add_alarms_to_subtask(static_cast<ECalComponentAlarms*>(l->data), subtask, subtask->task->gtz); | 667 | &comp_alarms, |
394 | 687 | 668 | e_cal_client_resolve_tzid_cb, | |
395 | 688 | // cleanup | 669 | subtask->client, |
396 | 689 | e_cal_free_alarms(comp_alarms); | 670 | nullptr); |
397 | 690 | g_list_free(comps_list); | 671 | |
398 | 691 | e_cal_client_free_ecalcomp_slist(comps_slist); | 672 | // convert timezone for non-instance events |
399 | 692 | } | 673 | e_cal_util_generate_alarms_for_list( |
400 | 693 | else if (error != nullptr) | 674 | subtask->components, |
401 | 694 | { | 675 | subtask->task->begin.to_unix(), |
402 | 695 | if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) | 676 | subtask->task->end.to_unix(), |
403 | 696 | g_warning("can't get ecalcomponent list: %s", error->message); | 677 | const_cast<ECalComponentAlarmAction*>(omit.data()), |
404 | 697 | 678 | &comp_alarms, | |
405 | 698 | g_error_free(error); | 679 | e_cal_client_resolve_tzid_cb, |
406 | 699 | } | 680 | subtask->client, |
407 | 700 | 681 | subtask->task->default_timezone); | |
408 | 701 | delete subtask; | 682 | |
409 | 702 | } | 683 | // walk the alarms & add them |
410 | 703 | 684 | for (auto l=comp_alarms; l!=nullptr; l=l->next) | |
411 | 704 | static void | 685 | add_alarms_to_subtask(static_cast<ECalComponentAlarms*>(l->data), subtask, subtask->task->gtz); |
412 | 705 | on_event_component_list_ready(GObject * oclient, | 686 | |
413 | 706 | GAsyncResult * res, | 687 | subtask->components = g_list_concat(subtask->components, subtask->instance_components); |
414 | 707 | gpointer gsubtask) | 688 | // add events without alarm |
415 | 708 | { | 689 | for (auto l=subtask->components; l!=nullptr; l=l->next) { |
416 | 709 | GError * error = NULL; | 690 | auto component = static_cast<ECalComponent*>(l->data); |
417 | 710 | GSList * comps_slist = NULL; | 691 | if (!e_cal_component_has_alarms(component)) |
418 | 711 | auto subtask = static_cast<ClientSubtask*>(gsubtask); | 692 | add_event_to_subtask(component, subtask, subtask->task->gtz); |
419 | 712 | 693 | } | |
420 | 713 | if (e_cal_client_get_object_list_as_comps_finish(E_CAL_CLIENT(oclient), | 694 | g_list_free_full(subtask->components, g_object_unref); |
421 | 714 | res, | 695 | e_cal_free_alarms(comp_alarms); |
422 | 715 | &comps_slist, | 696 | delete subtask; |
423 | 716 | &error)) | 697 | } |
424 | 717 | { | 698 | |
425 | 718 | for (auto l=comps_slist; l!=nullptr; l=l->next) | 699 | static GTimeZone * |
426 | 719 | add_event_to_subtask(static_cast<ECalComponent*>(l->data), subtask, subtask->task->gtz); | 700 | timezone_from_name (const char * tzid, |
427 | 720 | 701 | ECalClient * client, | |
428 | 721 | e_cal_client_free_ecalcomp_slist(comps_slist); | 702 | GCancellable * cancellable, |
429 | 722 | } | 703 | icaltimezone **itimezone) |
430 | 723 | else if (error != nullptr) | 704 | { |
431 | 724 | { | 705 | if (tzid == nullptr) |
432 | 725 | if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) | 706 | return nullptr; |
433 | 726 | g_warning("can't get ecalcomponent list: %s", error->message); | 707 | |
434 | 727 | 708 | auto itz = icaltimezone_get_builtin_timezone_from_tzid(tzid); // usually works | |
435 | 728 | g_error_free(error); | 709 | |
436 | 729 | } | 710 | if (itz == nullptr) // fallback |
437 | 730 | 711 | itz = icaltimezone_get_builtin_timezone(tzid); | |
438 | 731 | delete subtask; | 712 | |
439 | 713 | if (client && (itz == nullptr)) // ok we have a strange tzid... ask EDS to look it up in VTIMEZONES | ||
440 | 714 | e_cal_client_get_timezone_sync(client, tzid, &itz, cancellable, nullptr); | ||
441 | 715 | |||
442 | 716 | const char* identifier {}; | ||
443 | 717 | if (itimezone) | ||
444 | 718 | *itimezone = itz; | ||
445 | 719 | |||
446 | 720 | if (itz != nullptr) | ||
447 | 721 | { | ||
448 | 722 | identifier = icaltimezone_get_display_name(itz); | ||
449 | 723 | |||
450 | 724 | if (identifier == nullptr) | ||
451 | 725 | identifier = icaltimezone_get_location(itz); | ||
452 | 726 | } | ||
453 | 727 | |||
454 | 728 | // handle the TZID /freeassociation.sourceforge.net/Tzfile/[Location] case | ||
455 | 729 | if (identifier != nullptr) | ||
456 | 730 | { | ||
457 | 731 | const char* pch; | ||
458 | 732 | const char* key = "/freeassociation.sourceforge.net/"; | ||
459 | 733 | if ((pch = strstr(identifier, key))) | ||
460 | 734 | { | ||
461 | 735 | identifier = pch + strlen(key); | ||
462 | 736 | key = "Tzfile/"; // some don't have this, so check for it separately | ||
463 | 737 | if ((pch = strstr(identifier, key))) | ||
464 | 738 | identifier = pch + strlen(key); | ||
465 | 739 | } | ||
466 | 740 | } | ||
467 | 741 | |||
468 | 742 | if (identifier == nullptr) | ||
469 | 743 | g_warning("Unrecognized TZID: '%s'", tzid); | ||
470 | 744 | else | ||
471 | 745 | return g_time_zone_new(identifier); | ||
472 | 746 | |||
473 | 747 | return nullptr; | ||
474 | 732 | } | 748 | } |
475 | 733 | 749 | ||
476 | 734 | static DateTime | 750 | static DateTime |
477 | @@ -740,51 +756,9 @@ | |||
478 | 740 | DateTime out; | 756 | DateTime out; |
479 | 741 | g_return_val_if_fail(in.value != nullptr, out); | 757 | g_return_val_if_fail(in.value != nullptr, out); |
480 | 742 | 758 | ||
524 | 743 | GTimeZone * gtz {}; | 759 | GTimeZone * gtz = timezone_from_name(in.tzid, client, cancellable.get(), nullptr); |
525 | 744 | if (in.tzid != nullptr) | 760 | if (gtz == nullptr) |
483 | 745 | { | ||
484 | 746 | auto itz = icaltimezone_get_builtin_timezone_from_tzid(in.tzid); // usually works | ||
485 | 747 | |||
486 | 748 | if (itz == nullptr) // fallback | ||
487 | 749 | itz = icaltimezone_get_builtin_timezone(in.tzid); | ||
488 | 750 | |||
489 | 751 | if (itz == nullptr) // ok we have a strange tzid... ask EDS to look it up in VTIMEZONES | ||
490 | 752 | e_cal_client_get_timezone_sync(client, in.tzid, &itz, cancellable.get(), nullptr); | ||
491 | 753 | |||
492 | 754 | const char* identifier {}; | ||
493 | 755 | |||
494 | 756 | if (itz != nullptr) | ||
495 | 757 | { | ||
496 | 758 | identifier = icaltimezone_get_display_name(itz); | ||
497 | 759 | |||
498 | 760 | if (identifier == nullptr) | ||
499 | 761 | identifier = icaltimezone_get_location(itz); | ||
500 | 762 | } | ||
501 | 763 | |||
502 | 764 | // handle the TZID /freeassociation.sourceforge.net/Tzfile/[Location] case | ||
503 | 765 | if (identifier != nullptr) | ||
504 | 766 | { | ||
505 | 767 | const char* pch; | ||
506 | 768 | const char* key = "/freeassociation.sourceforge.net/"; | ||
507 | 769 | if ((pch = strstr(identifier, key))) | ||
508 | 770 | { | ||
509 | 771 | identifier = pch + strlen(key); | ||
510 | 772 | key = "Tzfile/"; // some don't have this, so check for it separately | ||
511 | 773 | if ((pch = strstr(identifier, key))) | ||
512 | 774 | identifier = pch + strlen(key); | ||
513 | 775 | } | ||
514 | 776 | } | ||
515 | 777 | |||
516 | 778 | if (identifier == nullptr) | ||
517 | 779 | g_warning("Unrecognized TZID: '%s'", in.tzid); | ||
518 | 780 | |||
519 | 781 | gtz = g_time_zone_new(identifier); | ||
520 | 782 | g_debug("%s eccdt.tzid -> offset is %d", G_STRLOC, in.tzid, (int)g_time_zone_get_offset(gtz,0)); | ||
521 | 783 | } | ||
522 | 784 | else | ||
523 | 785 | { | ||
526 | 786 | gtz = g_time_zone_ref(default_timezone); | 761 | gtz = g_time_zone_ref(default_timezone); |
527 | 787 | } | ||
528 | 788 | 762 | ||
529 | 789 | out = DateTime(gtz, | 763 | out = DateTime(gtz, |
530 | 790 | in.value->year, | 764 | in.value->year, |
531 | @@ -797,7 +771,7 @@ | |||
532 | 797 | return out; | 771 | return out; |
533 | 798 | } | 772 | } |
534 | 799 | 773 | ||
536 | 800 | static bool | 774 | bool |
537 | 801 | is_component_interesting(ECalComponent * component) | 775 | is_component_interesting(ECalComponent * component) |
538 | 802 | { | 776 | { |
539 | 803 | // we only want calendar events and vtodos | 777 | // we only want calendar events and vtodos |
540 | @@ -823,6 +797,28 @@ | |||
541 | 823 | disabled = true; | 797 | disabled = true; |
542 | 824 | } | 798 | } |
543 | 825 | e_cal_component_free_categories_list(categ_list); | 799 | e_cal_component_free_categories_list(categ_list); |
544 | 800 | |||
545 | 801 | if (!disabled) { | ||
546 | 802 | // we don't want not attending alarms | ||
547 | 803 | // check if the user is part of attendee list if we found it check the status | ||
548 | 804 | GSList *attendeeList = nullptr; | ||
549 | 805 | e_cal_component_get_attendee_list(component, &attendeeList); | ||
550 | 806 | |||
551 | 807 | for (GSList *attendeeIter=attendeeList; attendeeIter != nullptr; attendeeIter = attendeeIter->next) { | ||
552 | 808 | ECalComponentAttendee *attendee = static_cast<ECalComponentAttendee *>(attendeeIter->data); | ||
553 | 809 | if (attendee->value) { | ||
554 | 810 | if (strncmp(attendee->value, "mailto:", 7) == 0) { | ||
555 | 811 | if (m_myself->isMyEmail(attendee->value+7)) { | ||
556 | 812 | disabled = (attendee->status == ICAL_PARTSTAT_DECLINED); | ||
557 | 813 | break; | ||
558 | 814 | } | ||
559 | 815 | } | ||
560 | 816 | } | ||
561 | 817 | } | ||
562 | 818 | if (attendeeList) | ||
563 | 819 | e_cal_component_free_attendee_list(attendeeList); | ||
564 | 820 | } | ||
565 | 821 | |||
566 | 826 | if (disabled) | 822 | if (disabled) |
567 | 827 | return false; | 823 | return false; |
568 | 828 | 824 | ||
569 | @@ -903,35 +899,13 @@ | |||
570 | 903 | } | 899 | } |
571 | 904 | 900 | ||
572 | 905 | static void | 901 | static void |
573 | 906 | add_event_to_subtask(ECalComponent * component, | ||
574 | 907 | ClientSubtask * subtask, | ||
575 | 908 | GTimeZone * gtz) | ||
576 | 909 | { | ||
577 | 910 | // events with alarms are covered by add_alarms_to_subtask(), | ||
578 | 911 | // so skip them here | ||
579 | 912 | auto auids = e_cal_component_get_alarm_uids(component); | ||
580 | 913 | const bool has_alarms = auids != nullptr; | ||
581 | 914 | cal_obj_uid_list_free(auids); | ||
582 | 915 | if (has_alarms) | ||
583 | 916 | return; | ||
584 | 917 | |||
585 | 918 | // add it. simple, eh? | ||
586 | 919 | if (is_component_interesting(component)) | ||
587 | 920 | { | ||
588 | 921 | Appointment appointment = get_appointment(subtask->client, subtask->cancellable, component, gtz); | ||
589 | 922 | appointment.color = subtask->color; | ||
590 | 923 | subtask->task->appointments.push_back(appointment); | ||
591 | 924 | } | ||
592 | 925 | } | ||
593 | 926 | |||
594 | 927 | static void | ||
595 | 928 | add_alarms_to_subtask(ECalComponentAlarms * comp_alarms, | 902 | add_alarms_to_subtask(ECalComponentAlarms * comp_alarms, |
596 | 929 | ClientSubtask * subtask, | 903 | ClientSubtask * subtask, |
597 | 930 | GTimeZone * gtz) | 904 | GTimeZone * gtz) |
598 | 931 | { | 905 | { |
599 | 932 | auto& component = comp_alarms->comp; | 906 | auto& component = comp_alarms->comp; |
600 | 933 | 907 | ||
602 | 934 | if (!is_component_interesting(component)) | 908 | if (!subtask->task->p->is_component_interesting(component)) |
603 | 935 | return; | 909 | return; |
604 | 936 | 910 | ||
605 | 937 | Appointment baseline = get_appointment(subtask->client, subtask->cancellable, component, gtz); | 911 | Appointment baseline = get_appointment(subtask->client, subtask->cancellable, component, gtz); |
606 | @@ -965,7 +939,6 @@ | |||
607 | 965 | auto instance_time = std::make_pair(DateTime{gtz, ai->occur_start}, | 939 | auto instance_time = std::make_pair(DateTime{gtz, ai->occur_start}, |
608 | 966 | DateTime{gtz, ai->occur_end}); | 940 | DateTime{gtz, ai->occur_end}); |
609 | 967 | auto trigger_time = DateTime{gtz, ai->trigger}; | 941 | auto trigger_time = DateTime{gtz, ai->trigger}; |
610 | 968 | |||
611 | 969 | auto& alarm = alarms[instance_time][trigger_time]; | 942 | auto& alarm = alarms[instance_time][trigger_time]; |
612 | 970 | 943 | ||
613 | 971 | if (alarm.text.empty()) | 944 | if (alarm.text.empty()) |
614 | @@ -990,6 +963,21 @@ | |||
615 | 990 | } | 963 | } |
616 | 991 | } | 964 | } |
617 | 992 | 965 | ||
618 | 966 | |||
619 | 967 | static void | ||
620 | 968 | add_event_to_subtask(ECalComponent * component, | ||
621 | 969 | ClientSubtask * subtask, | ||
622 | 970 | GTimeZone * gtz) | ||
623 | 971 | { | ||
624 | 972 | // add it. simple, eh? | ||
625 | 973 | if (subtask->task->p->is_component_interesting(component)) | ||
626 | 974 | { | ||
627 | 975 | Appointment appointment = get_appointment(subtask->client, subtask->cancellable, component, gtz); | ||
628 | 976 | appointment.color = subtask->color; | ||
629 | 977 | subtask->task->appointments.push_back(appointment); | ||
630 | 978 | } | ||
631 | 979 | } | ||
632 | 980 | |||
633 | 993 | /*** | 981 | /*** |
634 | 994 | **** | 982 | **** |
635 | 995 | ***/ | 983 | ***/ |
636 | @@ -1062,14 +1050,15 @@ | |||
637 | 1062 | ESourceRegistry* m_source_registry {}; | 1050 | ESourceRegistry* m_source_registry {}; |
638 | 1063 | guint m_rebuild_tag {}; | 1051 | guint m_rebuild_tag {}; |
639 | 1064 | time_t m_rebuild_deadline {}; | 1052 | time_t m_rebuild_deadline {}; |
640 | 1053 | std::shared_ptr<Myself> m_myself; | ||
641 | 1065 | }; | 1054 | }; |
642 | 1066 | 1055 | ||
643 | 1067 | /*** | 1056 | /*** |
644 | 1068 | **** | 1057 | **** |
645 | 1069 | ***/ | 1058 | ***/ |
646 | 1070 | 1059 | ||
649 | 1071 | EdsEngine::EdsEngine(): | 1060 | EdsEngine::EdsEngine(const std::shared_ptr<Myself> &myself): |
650 | 1072 | p(new Impl()) | 1061 | p(new Impl(myself)) |
651 | 1073 | { | 1062 | { |
652 | 1074 | } | 1063 | } |
653 | 1075 | 1064 | ||
654 | 1076 | 1065 | ||
655 | === modified file 'src/main.cpp' | |||
656 | --- src/main.cpp 2016-04-12 17:03:36 +0000 | |||
657 | +++ src/main.cpp 2016-04-19 02:46:55 +0000 | |||
658 | @@ -25,6 +25,7 @@ | |||
659 | 25 | #include <datetime/exporter.h> | 25 | #include <datetime/exporter.h> |
660 | 26 | #include <datetime/locations-settings.h> | 26 | #include <datetime/locations-settings.h> |
661 | 27 | #include <datetime/menu.h> | 27 | #include <datetime/menu.h> |
662 | 28 | #include <datetime/myself.h> | ||
663 | 28 | #include <datetime/planner-aggregate.h> | 29 | #include <datetime/planner-aggregate.h> |
664 | 29 | #include <datetime/planner-snooze.h> | 30 | #include <datetime/planner-snooze.h> |
665 | 30 | #include <datetime/planner-range.h> | 31 | #include <datetime/planner-range.h> |
666 | @@ -58,7 +59,7 @@ | |||
667 | 58 | if (!g_strcmp0("lightdm", g_get_user_name())) | 59 | if (!g_strcmp0("lightdm", g_get_user_name())) |
668 | 59 | engine.reset(new MockEngine); | 60 | engine.reset(new MockEngine); |
669 | 60 | else | 61 | else |
671 | 61 | engine.reset(new EdsEngine); | 62 | engine.reset(new EdsEngine(std::shared_ptr<Myself>(new Myself))); |
672 | 62 | 63 | ||
673 | 63 | return engine; | 64 | return engine; |
674 | 64 | } | 65 | } |
675 | 65 | 66 | ||
676 | === added file 'src/myself.cpp' | |||
677 | --- src/myself.cpp 1970-01-01 00:00:00 +0000 | |||
678 | +++ src/myself.cpp 2016-04-19 02:46:55 +0000 | |||
679 | @@ -0,0 +1,76 @@ | |||
680 | 1 | /* | ||
681 | 2 | * Copyright 2016 Canonical Ltd. | ||
682 | 3 | * | ||
683 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
684 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
685 | 6 | * by the Free Software Foundation. | ||
686 | 7 | * | ||
687 | 8 | * This program is distributed in the hope that it will be useful, but | ||
688 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
689 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
690 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
691 | 12 | * | ||
692 | 13 | * You should have received a copy of the GNU General Public License along | ||
693 | 14 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
694 | 15 | * | ||
695 | 16 | * Authors: | ||
696 | 17 | * Renato Araujo Oliveira Filho <renato.filho@canonical.com> | ||
697 | 18 | */ | ||
698 | 19 | |||
699 | 20 | #include "datetime/myself.h" | ||
700 | 21 | |||
701 | 22 | #include <libaccounts-glib/ag-manager.h> | ||
702 | 23 | #include <libaccounts-glib/ag-account.h> | ||
703 | 24 | |||
704 | 25 | #include <algorithm> | ||
705 | 26 | |||
706 | 27 | namespace unity { | ||
707 | 28 | namespace indicator { | ||
708 | 29 | namespace datetime { | ||
709 | 30 | |||
710 | 31 | Myself::Myself() | ||
711 | 32 | : m_accounts_manager(ag_manager_new(), g_object_unref) | ||
712 | 33 | { | ||
713 | 34 | reloadEmails(); | ||
714 | 35 | g_object_connect(m_accounts_manager.get(), | ||
715 | 36 | "signal::account-created", on_accounts_changed, this, | ||
716 | 37 | "signal::account-deleted", on_accounts_changed, this, | ||
717 | 38 | "signal::account-updated", on_accounts_changed, this, | ||
718 | 39 | nullptr); | ||
719 | 40 | } | ||
720 | 41 | |||
721 | 42 | bool Myself::isMyEmail(const std::string &email) | ||
722 | 43 | { | ||
723 | 44 | return m_emails.get().count(email) > 0; | ||
724 | 45 | } | ||
725 | 46 | |||
726 | 47 | void Myself::on_accounts_changed(AgManager *, guint, Myself *self) | ||
727 | 48 | { | ||
728 | 49 | self->reloadEmails(); | ||
729 | 50 | } | ||
730 | 51 | |||
731 | 52 | void Myself::reloadEmails() | ||
732 | 53 | { | ||
733 | 54 | std::set<std::string> emails; | ||
734 | 55 | |||
735 | 56 | auto manager = m_accounts_manager.get(); | ||
736 | 57 | auto ids = ag_manager_list(manager); | ||
737 | 58 | for (auto l=ids; l!=nullptr; l=l->next) | ||
738 | 59 | { | ||
739 | 60 | auto acc = ag_manager_get_account(manager, GPOINTER_TO_UINT(l->data)); | ||
740 | 61 | if (acc) { | ||
741 | 62 | auto account_name = ag_account_get_display_name(acc); | ||
742 | 63 | if (account_name != nullptr) | ||
743 | 64 | emails.insert(account_name); | ||
744 | 65 | g_object_unref(acc); | ||
745 | 66 | } | ||
746 | 67 | } | ||
747 | 68 | ag_manager_list_free(ids); | ||
748 | 69 | |||
749 | 70 | m_emails.set(emails); | ||
750 | 71 | } | ||
751 | 72 | |||
752 | 73 | } // namespace datetime | ||
753 | 74 | } // namespace indicator | ||
754 | 75 | } // namespace unity | ||
755 | 76 | |||
756 | 0 | 77 | ||
757 | === modified file 'tests/CMakeLists.txt' | |||
758 | --- tests/CMakeLists.txt 2016-03-22 18:51:50 +0000 | |||
759 | +++ tests/CMakeLists.txt 2016-04-19 02:46:55 +0000 | |||
760 | @@ -85,7 +85,8 @@ | |||
761 | 85 | ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} # arg2: test executable path | 85 | ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} # arg2: test executable path |
762 | 86 | ${TEST_NAME} # arg3: test name | 86 | ${TEST_NAME} # arg3: test name |
763 | 87 | ${CMAKE_CURRENT_SOURCE_DIR}/test-eds-ics-config-files # arg4: base directory for config file template | 87 | ${CMAKE_CURRENT_SOURCE_DIR}/test-eds-ics-config-files # arg4: base directory for config file template |
765 | 88 | ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.ics) # arg5: the ical file for this test | 88 | ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.ics # arg5: the ical file for this test |
766 | 89 | ${CMAKE_CURRENT_SOURCE_DIR}/accounts.db) # arg6: online accounts database | ||
767 | 89 | endfunction() | 90 | endfunction() |
768 | 90 | add_eds_ics_test_by_name(test-eds-ics-all-day-events) | 91 | add_eds_ics_test_by_name(test-eds-ics-all-day-events) |
769 | 91 | add_eds_ics_test_by_name(test-eds-ics-repeating-events) | 92 | add_eds_ics_test_by_name(test-eds-ics-repeating-events) |
770 | @@ -95,6 +96,7 @@ | |||
771 | 95 | add_eds_ics_test_by_name(test-eds-ics-tzids) | 96 | add_eds_ics_test_by_name(test-eds-ics-tzids) |
772 | 96 | add_eds_ics_test_by_name(test-eds-ics-tzids-2) | 97 | add_eds_ics_test_by_name(test-eds-ics-tzids-2) |
773 | 97 | add_eds_ics_test_by_name(test-eds-ics-tzids-utc) | 98 | add_eds_ics_test_by_name(test-eds-ics-tzids-utc) |
774 | 99 | add_eds_ics_test_by_name(test-eds-ics-non-attending-alarms) | ||
775 | 98 | 100 | ||
776 | 99 | 101 | ||
777 | 100 | # disabling the timezone unit tests because they require | 102 | # disabling the timezone unit tests because they require |
778 | 101 | 103 | ||
779 | === added file 'tests/accounts.db' | |||
780 | 102 | Binary files tests/accounts.db 1970-01-01 00:00:00 +0000 and tests/accounts.db 2016-04-19 02:46:55 +0000 differ | 104 | Binary files tests/accounts.db 1970-01-01 00:00:00 +0000 and tests/accounts.db 2016-04-19 02:46:55 +0000 differ |
781 | === modified file 'tests/run-eds-ics-test.sh' | |||
782 | --- tests/run-eds-ics-test.sh 2015-07-20 16:31:28 +0000 | |||
783 | +++ tests/run-eds-ics-test.sh 2016-04-19 02:46:55 +0000 | |||
784 | @@ -6,6 +6,7 @@ | |||
785 | 6 | TEST_NAME=$3 # test name | 6 | TEST_NAME=$3 # test name |
786 | 7 | CONFIG_DIR=$4 # config files | 7 | CONFIG_DIR=$4 # config files |
787 | 8 | ICS_FILE=$5 # ical file holding test data | 8 | ICS_FILE=$5 # ical file holding test data |
788 | 9 | ACCOUNTS_DB=$6 # online account database | ||
789 | 9 | 10 | ||
790 | 10 | echo "this script: ${SELF}" | 11 | echo "this script: ${SELF}" |
791 | 11 | echo "test-runner: ${TEST_RUNNER}" | 12 | echo "test-runner: ${TEST_RUNNER}" |
792 | @@ -54,8 +55,15 @@ | |||
793 | 54 | cp --verbose --archive ${ICS_FILE} ${XDG_DATA_HOME}/evolution/tasks/system/tasks.ics | 55 | cp --verbose --archive ${ICS_FILE} ${XDG_DATA_HOME}/evolution/tasks/system/tasks.ics |
794 | 55 | fi | 56 | fi |
795 | 56 | 57 | ||
796 | 58 | # prepare online accounts database | ||
797 | 59 | if [ -e ${ACCOUNTS_DB} ]; then | ||
798 | 60 | echo "copying ${ACCOUNTS_DB} into $HOME" | ||
799 | 61 | mkdir -p ${XDG_CONFIG_HOME}/libaccounts-glib/ | ||
800 | 62 | cp --verbose --archive ${ACCOUNTS_DB} ${XDG_CONFIG_HOME}/libaccounts-glib/accounts.db | ||
801 | 63 | fi | ||
802 | 64 | |||
803 | 57 | # run the test | 65 | # run the test |
805 | 58 | ${TEST_RUNNER} --keep-env --max-wait=90 --task ${TEST_EXEC} --task-name ${TEST_NAME} --wait-until-complete | 66 | ${TEST_RUNNER} --keep-env --max-wait=90 --task ${TEST_EXEC} --task-name ${TEST_NAME} --wait-until-complete |
806 | 59 | rv=$? | 67 | rv=$? |
807 | 60 | 68 | ||
808 | 61 | # if the test passed, blow away the tmpdir | 69 | # if the test passed, blow away the tmpdir |
809 | 62 | 70 | ||
810 | === modified file 'tests/test-eds-ics-all-day-events.cpp' | |||
811 | --- tests/test-eds-ics-all-day-events.cpp 2015-05-21 12:47:24 +0000 | |||
812 | +++ tests/test-eds-ics-all-day-events.cpp 2016-04-19 02:46:55 +0000 | |||
813 | @@ -22,6 +22,7 @@ | |||
814 | 22 | #include <datetime/alarm-queue-simple.h> | 22 | #include <datetime/alarm-queue-simple.h> |
815 | 23 | #include <datetime/clock-mock.h> | 23 | #include <datetime/clock-mock.h> |
816 | 24 | #include <datetime/engine-eds.h> | 24 | #include <datetime/engine-eds.h> |
817 | 25 | #include <datetime/myself.h> | ||
818 | 25 | #include <datetime/planner-range.h> | 26 | #include <datetime/planner-range.h> |
819 | 26 | 27 | ||
820 | 27 | #include <gtest/gtest.h> | 28 | #include <gtest/gtest.h> |
821 | @@ -41,7 +42,7 @@ | |||
822 | 41 | TEST_F(VAlarmFixture, MultipleAppointments) | 42 | TEST_F(VAlarmFixture, MultipleAppointments) |
823 | 42 | { | 43 | { |
824 | 43 | // start the EDS engine | 44 | // start the EDS engine |
826 | 44 | auto engine = std::make_shared<EdsEngine>(); | 45 | auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
827 | 45 | 46 | ||
828 | 46 | // we need a consistent timezone for the planner and our local DateTimes | 47 | // we need a consistent timezone for the planner and our local DateTimes |
829 | 47 | constexpr char const * zone_str {"America/Chicago"}; | 48 | constexpr char const * zone_str {"America/Chicago"}; |
830 | @@ -66,7 +67,7 @@ | |||
831 | 66 | constexpr int max_wait_sec = 10; | 67 | constexpr int max_wait_sec = 10; |
832 | 67 | wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND); | 68 | wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND); |
833 | 68 | } | 69 | } |
835 | 69 | 70 | ||
836 | 70 | // what we expect to get... | 71 | // what we expect to get... |
837 | 71 | Appointment expected_appt; | 72 | Appointment expected_appt; |
838 | 72 | expected_appt.uid = "20150521T111538Z-7449-1000-3572-0@ghidorah"; | 73 | expected_appt.uid = "20150521T111538Z-7449-1000-3572-0@ghidorah"; |
839 | 73 | 74 | ||
840 | === modified file 'tests/test-eds-ics-missing-trigger.cpp' | |||
841 | --- tests/test-eds-ics-missing-trigger.cpp 2015-10-13 14:40:02 +0000 | |||
842 | +++ tests/test-eds-ics-missing-trigger.cpp 2016-04-19 02:46:55 +0000 | |||
843 | @@ -22,6 +22,7 @@ | |||
844 | 22 | #include <datetime/alarm-queue-simple.h> | 22 | #include <datetime/alarm-queue-simple.h> |
845 | 23 | #include <datetime/clock-mock.h> | 23 | #include <datetime/clock-mock.h> |
846 | 24 | #include <datetime/engine-eds.h> | 24 | #include <datetime/engine-eds.h> |
847 | 25 | #include <datetime/myself.h> | ||
848 | 25 | #include <datetime/planner-range.h> | 26 | #include <datetime/planner-range.h> |
849 | 26 | 27 | ||
850 | 27 | #include <gtest/gtest.h> | 28 | #include <gtest/gtest.h> |
851 | @@ -41,7 +42,7 @@ | |||
852 | 41 | TEST_F(VAlarmFixture, MissingTriggers) | 42 | TEST_F(VAlarmFixture, MissingTriggers) |
853 | 42 | { | 43 | { |
854 | 43 | // start the EDS engine | 44 | // start the EDS engine |
856 | 44 | auto engine = std::make_shared<EdsEngine>(); | 45 | auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
857 | 45 | 46 | ||
858 | 46 | // we need a consistent timezone for the planner and our local DateTimes | 47 | // we need a consistent timezone for the planner and our local DateTimes |
859 | 47 | constexpr char const * zone_str {"America/Chicago"}; | 48 | constexpr char const * zone_str {"America/Chicago"}; |
860 | 48 | 49 | ||
861 | === added file 'tests/test-eds-ics-non-attending-alarms.cpp' | |||
862 | --- tests/test-eds-ics-non-attending-alarms.cpp 1970-01-01 00:00:00 +0000 | |||
863 | +++ tests/test-eds-ics-non-attending-alarms.cpp 2016-04-19 02:46:55 +0000 | |||
864 | @@ -0,0 +1,79 @@ | |||
865 | 1 | /* | ||
866 | 2 | * Copyright 2015 Canonical Ltd. | ||
867 | 3 | * | ||
868 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
869 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
870 | 6 | * by the Free Software Foundation. | ||
871 | 7 | * | ||
872 | 8 | * This program is distributed in the hope that it will be useful, but | ||
873 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
874 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
875 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
876 | 12 | * | ||
877 | 13 | * You should have received a copy of the GNU General Public License along | ||
878 | 14 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
879 | 15 | * | ||
880 | 16 | * Authors: | ||
881 | 17 | * Charles Kerr <charles.kerr@canonical.com> | ||
882 | 18 | */ | ||
883 | 19 | |||
884 | 20 | #include <algorithm> | ||
885 | 21 | |||
886 | 22 | #include <datetime/alarm-queue-simple.h> | ||
887 | 23 | #include <datetime/clock-mock.h> | ||
888 | 24 | #include <datetime/engine-eds.h> | ||
889 | 25 | #include <datetime/myself.h> | ||
890 | 26 | #include <datetime/planner-range.h> | ||
891 | 27 | |||
892 | 28 | #include <gtest/gtest.h> | ||
893 | 29 | |||
894 | 30 | #include "glib-fixture.h" | ||
895 | 31 | #include "print-to.h" | ||
896 | 32 | #include "timezone-mock.h" | ||
897 | 33 | #include "wakeup-timer-mock.h" | ||
898 | 34 | |||
899 | 35 | using namespace unity::indicator::datetime; | ||
900 | 36 | using VAlarmFixture = GlibFixture; | ||
901 | 37 | |||
902 | 38 | /*** | ||
903 | 39 | **** | ||
904 | 40 | ***/ | ||
905 | 41 | |||
906 | 42 | TEST_F(VAlarmFixture, NonAttendingEvent) | ||
907 | 43 | { | ||
908 | 44 | // start the EDS engine | ||
909 | 45 | auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); | ||
910 | 46 | |||
911 | 47 | // we need a consistent timezone for the planner and our local DateTimes | ||
912 | 48 | constexpr char const * zone_str {"America/Recife"}; | ||
913 | 49 | auto tz = std::make_shared<MockTimezone>(zone_str); | ||
914 | 50 | auto gtz = g_time_zone_new(zone_str); | ||
915 | 51 | |||
916 | 52 | // make a planner that looks at the first half of 2016 in EDS | ||
917 | 53 | auto planner = std::make_shared<SimpleRangePlanner>(engine, tz); | ||
918 | 54 | const DateTime range_begin {gtz, 2016,1, 1, 0, 0, 0.0}; | ||
919 | 55 | const DateTime range_end {gtz, 2016,6,31,23,59,59.5}; | ||
920 | 56 | planner->range().set(std::make_pair(range_begin, range_end)); | ||
921 | 57 | |||
922 | 58 | // give EDS a moment to load | ||
923 | 59 | if (planner->appointments().get().empty()) { | ||
924 | 60 | g_message("waiting a moment for EDS to load..."); | ||
925 | 61 | auto on_appointments_changed = [this](const std::vector<Appointment>& appointments){ | ||
926 | 62 | g_message("ah, they loaded"); | ||
927 | 63 | if (!appointments.empty()) | ||
928 | 64 | g_main_loop_quit(loop); | ||
929 | 65 | }; | ||
930 | 66 | core::ScopedConnection conn(planner->appointments().changed().connect(on_appointments_changed)); | ||
931 | 67 | constexpr int max_wait_sec = 10; | ||
932 | 68 | wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND); | ||
933 | 69 | } | ||
934 | 70 | |||
935 | 71 | // the planner should match what we've got in the calendar.ics file | ||
936 | 72 | const auto appts = planner->appointments().get(); | ||
937 | 73 | EXPECT_EQ(2, appts.size()); | ||
938 | 74 | EXPECT_EQ(appts[0].begin, DateTime(gtz, 2016, 4, 4, 16, 0, 0)); | ||
939 | 75 | EXPECT_EQ(appts[1].begin, DateTime(gtz, 2016, 4, 6, 16, 0, 0)); | ||
940 | 76 | |||
941 | 77 | // cleanup | ||
942 | 78 | g_time_zone_unref(gtz); | ||
943 | 79 | } | ||
944 | 0 | 80 | ||
945 | === added file 'tests/test-eds-ics-non-attending-alarms.ics.in' | |||
946 | --- tests/test-eds-ics-non-attending-alarms.ics.in 1970-01-01 00:00:00 +0000 | |||
947 | +++ tests/test-eds-ics-non-attending-alarms.ics.in 2016-04-19 02:46:55 +0000 | |||
948 | @@ -0,0 +1,53 @@ | |||
949 | 1 | BEGIN:VCALENDAR | ||
950 | 2 | CALSCALE:GREGORIAN | ||
951 | 3 | PRODID:-//Ximian//NONSGML Evolution Calendar//EN | ||
952 | 4 | VERSION:2.0 | ||
953 | 5 | X-EVOLUTION-DATA-REVISION:2015-04-05T21:32:47.354433Z(2) | ||
954 | 6 | BEGIN:VEVENT | ||
955 | 7 | STATUS:CONFIRMED | ||
956 | 8 | DTSTAMP:20160405T152128Z | ||
957 | 9 | CREATED:20160405T152128Z | ||
958 | 10 | UID:ddtvl069dn2cquo8dhg3j9c360@google.com | ||
959 | 11 | SEQUENCE:1 | ||
960 | 12 | TRANSP:OPAQUE | ||
961 | 13 | SUMMARY:Every day at 4PM | ||
962 | 14 | DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/America/Recife: | ||
963 | 15 | 20160404T160000 | ||
964 | 16 | RRULE:FREQ=DAILY;UNTIL=20160406T190000Z | ||
965 | 17 | DTEND;TZID=/freeassociation.sourceforge.net/Tzfile/America/Recife: | ||
966 | 18 | 20160404T170000 | ||
967 | 19 | ATTENDEE;CN=Uphablet;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT; | ||
968 | 20 | CUTYPE=INDIVIDUAL:mailto:uphablet@ubuntu.com | ||
969 | 21 | LAST-MODIFIED:20160405T152128Z | ||
970 | 22 | BEGIN:VALARM | ||
971 | 23 | TRIGGER;VALUE=DURATION:-PT30M | ||
972 | 24 | ACTION:EMAIL | ||
973 | 25 | DESCRIPTION:This is an event reminder | ||
974 | 26 | X-EVOLUTION-ALARM-UID:20160405T152128Z-2848-32011-1844-65@ubuntu-phablet | ||
975 | 27 | END:VALARM | ||
976 | 28 | END:VEVENT | ||
977 | 29 | BEGIN:VEVENT | ||
978 | 30 | STATUS:CONFIRMED | ||
979 | 31 | DTSTAMP:20160405T152128Z | ||
980 | 32 | CREATED:20160405T151054Z | ||
981 | 33 | UID:ddtvl069dn2cquo8dhg3j9c360@google.com | ||
982 | 34 | SEQUENCE:1 | ||
983 | 35 | TRANSP:OPAQUE | ||
984 | 36 | SUMMARY::Every day at 4PM | ||
985 | 37 | DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/America/Fortaleza: | ||
986 | 38 | 20160405T160000 | ||
987 | 39 | RECURRENCE-ID;TZID=/freeassociation.sourceforge.net/Tzfile/America/Recife: | ||
988 | 40 | 20160405T160000 | ||
989 | 41 | DTEND;TZID=/freeassociation.sourceforge.net/Tzfile/America/Fortaleza: | ||
990 | 42 | 20160405T170000 | ||
991 | 43 | ATTENDEE;CN=Uphablet;PARTSTAT=DECLINED;ROLE=REQ-PARTICIPANT; | ||
992 | 44 | CUTYPE=INDIVIDUAL:mailto:uphablet@ubuntu.com | ||
993 | 45 | LAST-MODIFIED:20160405T152128Z | ||
994 | 46 | BEGIN:VALARM | ||
995 | 47 | TRIGGER;VALUE=DURATION:-PT30M | ||
996 | 48 | ACTION:EMAIL | ||
997 | 49 | DESCRIPTION:This is an event reminder | ||
998 | 50 | X-EVOLUTION-ALARM-UID:20160405T152128Z-2848-32011-1844-66@ubuntu-phablet | ||
999 | 51 | END:VALARM | ||
1000 | 52 | END:VEVENT | ||
1001 | 53 | END:VCALENDAR | ||
1002 | 0 | 54 | ||
1003 | === modified file 'tests/test-eds-ics-nonrepeating-events.cpp' | |||
1004 | --- tests/test-eds-ics-nonrepeating-events.cpp 2015-10-13 14:40:02 +0000 | |||
1005 | +++ tests/test-eds-ics-nonrepeating-events.cpp 2016-04-19 02:46:55 +0000 | |||
1006 | @@ -22,6 +22,7 @@ | |||
1007 | 22 | #include <datetime/alarm-queue-simple.h> | 22 | #include <datetime/alarm-queue-simple.h> |
1008 | 23 | #include <datetime/clock-mock.h> | 23 | #include <datetime/clock-mock.h> |
1009 | 24 | #include <datetime/engine-eds.h> | 24 | #include <datetime/engine-eds.h> |
1010 | 25 | #include <datetime/myself.h> | ||
1011 | 25 | #include <datetime/planner-range.h> | 26 | #include <datetime/planner-range.h> |
1012 | 26 | 27 | ||
1013 | 27 | #include <gtest/gtest.h> | 28 | #include <gtest/gtest.h> |
1014 | @@ -41,7 +42,7 @@ | |||
1015 | 41 | TEST_F(VAlarmFixture, MultipleAppointments) | 42 | TEST_F(VAlarmFixture, MultipleAppointments) |
1016 | 42 | { | 43 | { |
1017 | 43 | // start the EDS engine | 44 | // start the EDS engine |
1019 | 44 | auto engine = std::make_shared<EdsEngine>(); | 45 | auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
1020 | 45 | 46 | ||
1021 | 46 | // we need a consistent timezone for the planner and our local DateTimes | 47 | // we need a consistent timezone for the planner and our local DateTimes |
1022 | 47 | constexpr char const * zone_str {"America/Chicago"}; | 48 | constexpr char const * zone_str {"America/Chicago"}; |
1023 | @@ -66,7 +67,7 @@ | |||
1024 | 66 | constexpr int max_wait_sec = 10; | 67 | constexpr int max_wait_sec = 10; |
1025 | 67 | wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND); | 68 | wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND); |
1026 | 68 | } | 69 | } |
1028 | 69 | 70 | ||
1029 | 70 | // what we expect to get... | 71 | // what we expect to get... |
1030 | 71 | Appointment expected_appt; | 72 | Appointment expected_appt; |
1031 | 72 | expected_appt.uid = "20150520T000726Z-3878-32011-1770-81@ubuntu-phablet"; | 73 | expected_appt.uid = "20150520T000726Z-3878-32011-1770-81@ubuntu-phablet"; |
1032 | 73 | 74 | ||
1033 | === modified file 'tests/test-eds-ics-repeating-events.cpp' | |||
1034 | --- tests/test-eds-ics-repeating-events.cpp 2015-10-13 14:40:02 +0000 | |||
1035 | +++ tests/test-eds-ics-repeating-events.cpp 2016-04-19 02:46:55 +0000 | |||
1036 | @@ -22,6 +22,7 @@ | |||
1037 | 22 | #include <datetime/alarm-queue-simple.h> | 22 | #include <datetime/alarm-queue-simple.h> |
1038 | 23 | #include <datetime/clock-mock.h> | 23 | #include <datetime/clock-mock.h> |
1039 | 24 | #include <datetime/engine-eds.h> | 24 | #include <datetime/engine-eds.h> |
1040 | 25 | #include <datetime/myself.h> | ||
1041 | 25 | #include <datetime/planner-range.h> | 26 | #include <datetime/planner-range.h> |
1042 | 26 | 27 | ||
1043 | 27 | #include <gtest/gtest.h> | 28 | #include <gtest/gtest.h> |
1044 | @@ -41,7 +42,7 @@ | |||
1045 | 41 | TEST_F(VAlarmFixture, MultipleAppointments) | 42 | TEST_F(VAlarmFixture, MultipleAppointments) |
1046 | 42 | { | 43 | { |
1047 | 43 | // start the EDS engine | 44 | // start the EDS engine |
1049 | 44 | auto engine = std::make_shared<EdsEngine>(); | 45 | auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
1050 | 45 | 46 | ||
1051 | 46 | // we need a consistent timezone for the planner and our local DateTimes | 47 | // we need a consistent timezone for the planner and our local DateTimes |
1052 | 47 | constexpr char const * zone_str {"America/Chicago"}; | 48 | constexpr char const * zone_str {"America/Chicago"}; |
1053 | @@ -66,7 +67,7 @@ | |||
1054 | 66 | constexpr int max_wait_sec = 10; | 67 | constexpr int max_wait_sec = 10; |
1055 | 67 | wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND); | 68 | wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND); |
1056 | 68 | } | 69 | } |
1058 | 69 | 70 | ||
1059 | 70 | // what we expect to get... | 71 | // what we expect to get... |
1060 | 71 | Appointment expected_appt; | 72 | Appointment expected_appt; |
1061 | 72 | expected_appt.uid = "20150507T211449Z-4262-32011-1418-1@ubuntu-phablet"; | 73 | expected_appt.uid = "20150507T211449Z-4262-32011-1418-1@ubuntu-phablet"; |
1062 | 73 | 74 | ||
1063 | === modified file 'tests/test-eds-ics-repeating-valarms.cpp' | |||
1064 | --- tests/test-eds-ics-repeating-valarms.cpp 2015-05-20 23:23:32 +0000 | |||
1065 | +++ tests/test-eds-ics-repeating-valarms.cpp 2016-04-19 02:46:55 +0000 | |||
1066 | @@ -22,6 +22,7 @@ | |||
1067 | 22 | #include <datetime/alarm-queue-simple.h> | 22 | #include <datetime/alarm-queue-simple.h> |
1068 | 23 | #include <datetime/clock-mock.h> | 23 | #include <datetime/clock-mock.h> |
1069 | 24 | #include <datetime/engine-eds.h> | 24 | #include <datetime/engine-eds.h> |
1070 | 25 | #include <datetime/myself.h> | ||
1071 | 25 | #include <datetime/planner-range.h> | 26 | #include <datetime/planner-range.h> |
1072 | 26 | 27 | ||
1073 | 27 | #include <gtest/gtest.h> | 28 | #include <gtest/gtest.h> |
1074 | @@ -41,7 +42,7 @@ | |||
1075 | 41 | TEST_F(VAlarmFixture, MultipleAppointments) | 42 | TEST_F(VAlarmFixture, MultipleAppointments) |
1076 | 42 | { | 43 | { |
1077 | 43 | // start the EDS engine | 44 | // start the EDS engine |
1079 | 44 | auto engine = std::make_shared<EdsEngine>(); | 45 | auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
1080 | 45 | 46 | ||
1081 | 46 | // we need a consistent timezone for the planner and our local DateTimes | 47 | // we need a consistent timezone for the planner and our local DateTimes |
1082 | 47 | constexpr char const * zone_str {"America/Chicago"}; | 48 | constexpr char const * zone_str {"America/Chicago"}; |
1083 | 48 | 49 | ||
1084 | === modified file 'tests/test-eds-ics-tzids-2.cpp' | |||
1085 | --- tests/test-eds-ics-tzids-2.cpp 2015-07-09 20:56:13 +0000 | |||
1086 | +++ tests/test-eds-ics-tzids-2.cpp 2016-04-19 02:46:55 +0000 | |||
1087 | @@ -22,6 +22,7 @@ | |||
1088 | 22 | #include <datetime/alarm-queue-simple.h> | 22 | #include <datetime/alarm-queue-simple.h> |
1089 | 23 | #include <datetime/clock-mock.h> | 23 | #include <datetime/clock-mock.h> |
1090 | 24 | #include <datetime/engine-eds.h> | 24 | #include <datetime/engine-eds.h> |
1091 | 25 | #include <datetime/myself.h> | ||
1092 | 25 | #include <datetime/planner-range.h> | 26 | #include <datetime/planner-range.h> |
1093 | 26 | 27 | ||
1094 | 27 | #include <gtest/gtest.h> | 28 | #include <gtest/gtest.h> |
1095 | @@ -41,7 +42,7 @@ | |||
1096 | 41 | TEST_F(VAlarmFixture, MultipleAppointments) | 42 | TEST_F(VAlarmFixture, MultipleAppointments) |
1097 | 42 | { | 43 | { |
1098 | 43 | // start the EDS engine | 44 | // start the EDS engine |
1100 | 44 | auto engine = std::make_shared<EdsEngine>(); | 45 | auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
1101 | 45 | 46 | ||
1102 | 46 | // we need a consistent timezone for the planner and our local DateTimes | 47 | // we need a consistent timezone for the planner and our local DateTimes |
1103 | 47 | constexpr char const * zone_str {"America/Los_Angeles"}; | 48 | constexpr char const * zone_str {"America/Los_Angeles"}; |
1104 | 48 | 49 | ||
1105 | === modified file 'tests/test-eds-ics-tzids-utc.cpp' | |||
1106 | --- tests/test-eds-ics-tzids-utc.cpp 2016-03-22 19:13:10 +0000 | |||
1107 | +++ tests/test-eds-ics-tzids-utc.cpp 2016-04-19 02:46:55 +0000 | |||
1108 | @@ -22,6 +22,7 @@ | |||
1109 | 22 | #include <datetime/alarm-queue-simple.h> | 22 | #include <datetime/alarm-queue-simple.h> |
1110 | 23 | #include <datetime/clock-mock.h> | 23 | #include <datetime/clock-mock.h> |
1111 | 24 | #include <datetime/engine-eds.h> | 24 | #include <datetime/engine-eds.h> |
1112 | 25 | #include <datetime/myself.h> | ||
1113 | 25 | #include <datetime/planner-range.h> | 26 | #include <datetime/planner-range.h> |
1114 | 26 | 27 | ||
1115 | 27 | #include <gtest/gtest.h> | 28 | #include <gtest/gtest.h> |
1116 | @@ -41,7 +42,7 @@ | |||
1117 | 41 | TEST_F(VAlarmFixture, UTCAppointments) | 42 | TEST_F(VAlarmFixture, UTCAppointments) |
1118 | 42 | { | 43 | { |
1119 | 43 | // start the EDS engine | 44 | // start the EDS engine |
1121 | 44 | auto engine = std::make_shared<EdsEngine>(); | 45 | auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
1122 | 45 | 46 | ||
1123 | 46 | // we need a consistent timezone for the planner and our local DateTimes | 47 | // we need a consistent timezone for the planner and our local DateTimes |
1124 | 47 | constexpr char const * zone_str {"America/Recife"}; | 48 | constexpr char const * zone_str {"America/Recife"}; |
1125 | 48 | 49 | ||
1126 | === modified file 'tests/test-eds-ics-tzids.cpp' | |||
1127 | --- tests/test-eds-ics-tzids.cpp 2015-07-09 19:14:32 +0000 | |||
1128 | +++ tests/test-eds-ics-tzids.cpp 2016-04-19 02:46:55 +0000 | |||
1129 | @@ -22,6 +22,7 @@ | |||
1130 | 22 | #include <datetime/alarm-queue-simple.h> | 22 | #include <datetime/alarm-queue-simple.h> |
1131 | 23 | #include <datetime/clock-mock.h> | 23 | #include <datetime/clock-mock.h> |
1132 | 24 | #include <datetime/engine-eds.h> | 24 | #include <datetime/engine-eds.h> |
1133 | 25 | #include <datetime/myself.h> | ||
1134 | 25 | #include <datetime/planner-range.h> | 26 | #include <datetime/planner-range.h> |
1135 | 26 | 27 | ||
1136 | 27 | #include <gtest/gtest.h> | 28 | #include <gtest/gtest.h> |
1137 | @@ -41,7 +42,7 @@ | |||
1138 | 41 | TEST_F(VAlarmFixture, MultipleAppointments) | 42 | TEST_F(VAlarmFixture, MultipleAppointments) |
1139 | 42 | { | 43 | { |
1140 | 43 | // start the EDS engine | 44 | // start the EDS engine |
1142 | 44 | auto engine = std::make_shared<EdsEngine>(); | 45 | auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>()); |
1143 | 45 | 46 | ||
1144 | 46 | // we need a consistent timezone for the planner and our local DateTimes | 47 | // we need a consistent timezone for the planner and our local DateTimes |
1145 | 47 | constexpr char const * zone_str {"Europe/Berlin"}; | 48 | constexpr char const * zone_str {"Europe/Berlin"}; |
Some change requests inline. Mostly minor, but one potential crasher and memory leak