Merge lp:~renatofilho/indicator-datetime/fix-1508438 into lp:indicator-datetime/15.10

Proposed by Renato Araujo Oliveira Filho
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
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.

To post a comment you must log in.
Revision history for this message
Charles Kerr (charlesk) wrote :

Some change requests inline. Mostly minor, but one potential crasher and memory leak

review: Needs Fixing
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) :
Revision history for this message
Charles Kerr (charlesk) :
Revision history for this message
Arthur Mello (artmello) wrote :

lgtm

review: Approve
Revision history for this message
Charles Kerr (charlesk) wrote :

lgtm, too

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) :
review: Approve
Revision history for this message
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.

Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

any specific tets?

452. By Renato Araujo Oliveira Filho

Does not free list that was used on concat.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) :
review: Approve
453. By Renato Araujo Oliveira Filho

Reduce libaccounts-glib-dev required version.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) :
review: Approve
454. By Renato Araujo Oliveira Filho

Trunk merged.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2016-02-03 16:33:39 +0000
+++ CMakeLists.txt 2016-04-19 02:46:55 +0000
@@ -20,7 +20,7 @@
2020
21##21##
22## GNU standard installation directories22## GNU standard installation directories
23## 23##
2424
25include (GNUInstallDirs)25include (GNUInstallDirs)
26if (EXISTS "/etc/debian_version") # Workaround for libexecdir on debian26if (EXISTS "/etc/debian_version") # Workaround for libexecdir on debian
@@ -47,7 +47,8 @@
47 gstreamer-1.0>=1.247 gstreamer-1.0>=1.2
48 libnotify>=0.7.648 libnotify>=0.7.6
49 url-dispatcher-1>=149 url-dispatcher-1>=1
50 properties-cpp>=0.0.1)50 properties-cpp>=0.0.1
51 libaccounts-glib>=1.18)
51include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS})52include_directories (SYSTEM ${SERVICE_DEPS_INCLUDE_DIRS})
5253
53##54##
5455
=== modified file 'debian/control'
--- debian/control 2016-03-10 16:20:36 +0000
+++ debian/control 2016-04-19 02:46:55 +0000
@@ -29,6 +29,8 @@
29 gvfs-daemons,29 gvfs-daemons,
30# for phone alarm/calendar notification sound tests:30# for phone alarm/calendar notification sound tests:
31 ubuntu-touch-sounds,31 ubuntu-touch-sounds,
32# for query user e-mails based on accounts
33 libaccounts-glib-dev,
32Standards-Version: 3.9.334Standards-Version: 3.9.3
33Homepage: https://launchpad.net/indicator-datetime35Homepage: https://launchpad.net/indicator-datetime
34# If you aren't a member of ~indicator-applet-developers but need to upload36# If you aren't a member of ~indicator-applet-developers but need to upload
3537
=== modified file 'include/datetime/engine-eds.h'
--- include/datetime/engine-eds.h 2014-12-08 02:52:50 +0000
+++ include/datetime/engine-eds.h 2016-04-19 02:46:55 +0000
@@ -36,16 +36,17 @@
36/****36/****
37*****37*****
38****/38****/
39class Myself;
3940
40/**41/**
41 * Class wrapper around EDS so multiple #EdsPlanners can share resources42 * Class wrapper around EDS so multiple #EdsPlanners can share resources
42 * 43 *
43 * @see EdsPlanner44 * @see EdsPlanner
44 */45 */
45class EdsEngine: public Engine46class EdsEngine: public Engine
46{47{
47public:48public:
48 EdsEngine();49 EdsEngine(const std::shared_ptr<Myself> &myself);
49 ~EdsEngine();50 ~EdsEngine();
5051
51 void get_appointments(const DateTime& begin,52 void get_appointments(const DateTime& begin,
5253
=== added file 'include/datetime/myself.h'
--- include/datetime/myself.h 1970-01-01 00:00:00 +0000
+++ include/datetime/myself.h 2016-04-19 02:46:55 +0000
@@ -0,0 +1,62 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Renato Araujo Oliveira Filho <renato.filho@canonical.com>
18 */
19
20#ifndef INDICATOR_DATETIME_MYSELF_H
21#define INDICATOR_DATETIME_MYSELF_H
22
23#include <core/property.h>
24
25#include <string>
26#include <set>
27#include <memory.h>
28#include <glib.h>
29
30typedef struct _AgManager AgManager;
31
32namespace unity {
33namespace indicator {
34namespace datetime {
35
36class Myself
37{
38public:
39 Myself();
40
41 const core::Property<std::set<std::string>>& emails()
42 {
43 return m_emails;
44 }
45
46 bool isMyEmail(const std::string &email);
47
48private:
49 std::shared_ptr<AgManager> m_accounts_manager;
50 core::Property<std::set<std::string> > m_emails;
51
52 static void on_accounts_changed(AgManager*, guint, Myself*);
53 void reloadEmails();
54
55};
56
57
58} // namespace datetime
59} // namespace indicator
60} // namespace unity
61
62#endif // INDICATOR_DATETIME_MYSELF_H
063
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2015-09-01 09:52:13 +0000
+++ src/CMakeLists.txt 2016-04-19 02:46:55 +0000
@@ -23,6 +23,7 @@
23 locations.cpp23 locations.cpp
24 locations-settings.cpp24 locations-settings.cpp
25 menu.cpp25 menu.cpp
26 myself.cpp
26 notifications.cpp27 notifications.cpp
27 planner.cpp28 planner.cpp
28 planner-aggregate.cpp29 planner-aggregate.cpp
2930
=== modified file 'src/engine-eds.cpp'
--- src/engine-eds.cpp 2016-03-22 19:32:25 +0000
+++ src/engine-eds.cpp 2016-04-19 02:46:55 +0000
@@ -18,6 +18,7 @@
18 */18 */
1919
20#include <datetime/engine-eds.h>20#include <datetime/engine-eds.h>
21#include <datetime/myself.h>
2122
22#include <libical/ical.h>23#include <libical/ical.h>
23#include <libical/icaltime.h>24#include <libical/icaltime.h>
@@ -48,7 +49,8 @@
48{49{
49public:50public:
5051
51 Impl()52 Impl(const std::shared_ptr<Myself> &myself)
53 : m_myself(myself)
52 {54 {
53 auto cancellable_deleter = [](GCancellable * c) {55 auto cancellable_deleter = [](GCancellable * c) {
54 g_cancellable_cancel(c);56 g_cancellable_cancel(c);
@@ -56,8 +58,10 @@
56 };58 };
5759
58 m_cancellable = std::shared_ptr<GCancellable>(g_cancellable_new(), cancellable_deleter);60 m_cancellable = std::shared_ptr<GCancellable>(g_cancellable_new(), cancellable_deleter);
59
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);
62 m_myself->emails().changed().connect([this](const std::set<std::string> &) {
63 set_dirty_soon();
64 });
61 }65 }
6266
63 ~Impl()67 ~Impl()
@@ -92,26 +96,19 @@
92 /**96 /**
93 *** init the default timezone97 *** init the default timezone
94 **/98 **/
95
96 icaltimezone * default_timezone = nullptr;99 icaltimezone * default_timezone = nullptr;
97 const auto tz = timezone.timezone.get().c_str();100 const auto tz = timezone.timezone.get().c_str();
98 if (tz && *tz)101 auto gtz = timezone_from_name(tz, nullptr, nullptr, &default_timezone);
99 {102 if (gtz == nullptr) {
100 default_timezone = icaltimezone_get_builtin_timezone(tz);103 gtz = g_time_zone_new_local();
101
102 if (default_timezone == nullptr) // maybe str is a tzid?
103 default_timezone = icaltimezone_get_builtin_timezone_from_tzid(tz);
104
105 g_debug("default_timezone is %p", (void*)default_timezone);
106 }104 }
107105
106 g_debug("default_timezone is %s", default_timezone ? icaltimezone_get_display_name(default_timezone) : "null");
107
108 /**108 /**
109 *** walk through the sources to build the appointment list109 *** walk through the sources to build the appointment list
110 **/110 **/
111111
112 auto gtz = default_timezone != nullptr
113 ? g_time_zone_new(icaltimezone_get_location(default_timezone))
114 : g_time_zone_new_local();
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);
116113
117 for (auto& kv : m_clients)114 for (auto& kv : m_clients)
@@ -125,35 +122,14 @@
125 auto extension = e_source_get_extension(source, E_SOURCE_EXTENSION_CALENDAR);122 auto extension = e_source_get_extension(source, E_SOURCE_EXTENSION_CALENDAR);
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));
127124
128 auto begin_str = isodate_from_time_t(begin.to_unix());125 e_cal_client_generate_instances(
129 auto end_str = isodate_from_time_t(end.to_unix());126 client,
130 auto sexp_fmt = g_strdup_printf("(%%s? (make-time \"%s\") (make-time \"%s\"))", begin_str, end_str);127 begin.to_unix(),
131 g_clear_pointer(&begin_str, g_free);128 end.to_unix(),
132 g_clear_pointer(&end_str, g_free);129 m_cancellable.get(),
133130 on_event_generated,
134 // ask EDS about alarms that occur in this window...131 new ClientSubtask(main_task, client, m_cancellable, color),
135 auto sexp = g_strdup_printf(sexp_fmt, "has-alarms-in-range");132 on_event_generated_list_ready);
136 g_debug("%s alarm sexp is %s", G_STRLOC, sexp);
137 e_cal_client_get_object_list_as_comps(
138 client,
139 sexp,
140 m_cancellable.get(),
141 on_alarm_component_list_ready,
142 new ClientSubtask(main_task, client, m_cancellable, color));
143 g_clear_pointer(&sexp, g_free);
144
145 // ask EDS about events that occur in this window...
146 sexp = g_strdup_printf(sexp_fmt, "occur-in-time-range");
147 g_debug("%s event sexp is %s", G_STRLOC, sexp);
148 e_cal_client_get_object_list_as_comps(
149 client,
150 sexp,
151 m_cancellable.get(),
152 on_event_component_list_ready,
153 new ClientSubtask(main_task, client, m_cancellable, color));
154 g_clear_pointer(&sexp, g_free);
155
156 g_clear_pointer(&sexp_fmt, g_free);
157 }133 }
158 }134 }
159135
@@ -591,6 +567,8 @@
591 ECalClient* client;567 ECalClient* client;
592 std::shared_ptr<GCancellable> cancellable;568 std::shared_ptr<GCancellable> cancellable;
593 std::string color;569 std::string color;
570 GList *components;
571 GList *instance_components;
594572
595 ClientSubtask(const std::shared_ptr<Task>& task_in,573 ClientSubtask(const std::shared_ptr<Task>& task_in,
596 ECalClient* client_in,574 ECalClient* client_in,
@@ -598,10 +576,13 @@
598 const char* color_in):576 const char* color_in):
599 task(task_in),577 task(task_in),
600 client(client_in),578 client(client_in),
601 cancellable(cancellable_in)579 cancellable(cancellable_in),
580 components(nullptr),
581 instance_components(nullptr)
602 {582 {
603 if (color_in)583 if (color_in)
604 color = color_in;584 color = color_in;
585
605 }586 }
606 };587 };
607588
@@ -648,87 +629,122 @@
648 return ret;629 return ret;
649 }630 }
650631
651 static void632 static gboolean
652 on_alarm_component_list_ready(GObject * oclient,633 on_event_generated(ECalComponent *comp,
653 GAsyncResult * res,634 time_t,
654 gpointer gsubtask)635 time_t,
655 {636 gpointer gsubtask)
656 GError * error = NULL;637 {
657 GSList * comps_slist = NULL;638 auto subtask = static_cast<ClientSubtask*>(gsubtask);
658 auto subtask = static_cast<ClientSubtask*>(gsubtask);639 const gchar *uid = nullptr;
659640 e_cal_component_get_uid (comp, &uid);
660 if (e_cal_client_get_object_list_as_comps_finish(E_CAL_CLIENT(oclient),641 g_object_ref(comp);
661 res,642 if (e_cal_component_is_instance(comp))
662 &comps_slist,643 subtask->instance_components = g_list_append(subtask->instance_components, comp);
663 &error))644 else
664 {645 subtask->components = g_list_append(subtask->components, comp);
665 // _generate_alarms takes a GList, so make a shallow one646 return TRUE;
666 GList * comps_list = nullptr;647 }
667 for (auto l=comps_slist; l!=nullptr; l=l->next)648
668 comps_list = g_list_prepend(comps_list, l->data);649 static void
669650 on_event_generated_list_ready(gpointer gsubtask)
670 constexpr std::array<ECalComponentAlarmAction,1> omit = {651 {
671 (ECalComponentAlarmAction)-1652 auto subtask = static_cast<ClientSubtask*>(gsubtask);
672 }; // list of action types to omit, terminated with -1653
673 GSList * comp_alarms = nullptr;654 // generate alarms
674 e_cal_util_generate_alarms_for_list(655 constexpr std::array<ECalComponentAlarmAction,1> omit = {
675 comps_list,656 (ECalComponentAlarmAction)-1
676 subtask->task->begin.to_unix(),657 }; // list of action types to omit, terminated with -1
677 subtask->task->end.to_unix(),658 GSList * comp_alarms = nullptr;
678 const_cast<ECalComponentAlarmAction*>(omit.data()),659
679 &comp_alarms,660 // we do not need translate tz for instance events,
680 e_cal_client_resolve_tzid_cb,661 // they are aredy in the correct time
681 oclient,662 e_cal_util_generate_alarms_for_list(
682 subtask->task->default_timezone);663 subtask->instance_components,
683664 subtask->task->begin.to_unix(),
684 // walk the alarms & add them665 subtask->task->end.to_unix(),
685 for (auto l=comp_alarms; l!=nullptr; l=l->next)666 const_cast<ECalComponentAlarmAction*>(omit.data()),
686 add_alarms_to_subtask(static_cast<ECalComponentAlarms*>(l->data), subtask, subtask->task->gtz);667 &comp_alarms,
687668 e_cal_client_resolve_tzid_cb,
688 // cleanup669 subtask->client,
689 e_cal_free_alarms(comp_alarms);670 nullptr);
690 g_list_free(comps_list);671
691 e_cal_client_free_ecalcomp_slist(comps_slist);672 // convert timezone for non-instance events
692 }673 e_cal_util_generate_alarms_for_list(
693 else if (error != nullptr)674 subtask->components,
694 {675 subtask->task->begin.to_unix(),
695 if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))676 subtask->task->end.to_unix(),
696 g_warning("can't get ecalcomponent list: %s", error->message);677 const_cast<ECalComponentAlarmAction*>(omit.data()),
697678 &comp_alarms,
698 g_error_free(error);679 e_cal_client_resolve_tzid_cb,
699 }680 subtask->client,
700681 subtask->task->default_timezone);
701 delete subtask;682
702 }683 // walk the alarms & add them
703684 for (auto l=comp_alarms; l!=nullptr; l=l->next)
704 static void685 add_alarms_to_subtask(static_cast<ECalComponentAlarms*>(l->data), subtask, subtask->task->gtz);
705 on_event_component_list_ready(GObject * oclient,686
706 GAsyncResult * res,687 subtask->components = g_list_concat(subtask->components, subtask->instance_components);
707 gpointer gsubtask)688 // add events without alarm
708 {689 for (auto l=subtask->components; l!=nullptr; l=l->next) {
709 GError * error = NULL;690 auto component = static_cast<ECalComponent*>(l->data);
710 GSList * comps_slist = NULL;691 if (!e_cal_component_has_alarms(component))
711 auto subtask = static_cast<ClientSubtask*>(gsubtask);692 add_event_to_subtask(component, subtask, subtask->task->gtz);
712693 }
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);
714 res,695 e_cal_free_alarms(comp_alarms);
715 &comps_slist,696 delete subtask;
716 &error))697 }
717 {698
718 for (auto l=comps_slist; l!=nullptr; l=l->next)699 static GTimeZone *
719 add_event_to_subtask(static_cast<ECalComponent*>(l->data), subtask, subtask->task->gtz);700 timezone_from_name (const char * tzid,
720701 ECalClient * client,
721 e_cal_client_free_ecalcomp_slist(comps_slist);702 GCancellable * cancellable,
722 }703 icaltimezone **itimezone)
723 else if (error != nullptr)704 {
724 {705 if (tzid == nullptr)
725 if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))706 return nullptr;
726 g_warning("can't get ecalcomponent list: %s", error->message);707
727708 auto itz = icaltimezone_get_builtin_timezone_from_tzid(tzid); // usually works
728 g_error_free(error);709
729 }710 if (itz == nullptr) // fallback
730711 itz = icaltimezone_get_builtin_timezone(tzid);
731 delete subtask;712
713 if (client && (itz == nullptr)) // ok we have a strange tzid... ask EDS to look it up in VTIMEZONES
714 e_cal_client_get_timezone_sync(client, tzid, &itz, cancellable, nullptr);
715
716 const char* identifier {};
717 if (itimezone)
718 *itimezone = itz;
719
720 if (itz != nullptr)
721 {
722 identifier = icaltimezone_get_display_name(itz);
723
724 if (identifier == nullptr)
725 identifier = icaltimezone_get_location(itz);
726 }
727
728 // handle the TZID /freeassociation.sourceforge.net/Tzfile/[Location] case
729 if (identifier != nullptr)
730 {
731 const char* pch;
732 const char* key = "/freeassociation.sourceforge.net/";
733 if ((pch = strstr(identifier, key)))
734 {
735 identifier = pch + strlen(key);
736 key = "Tzfile/"; // some don't have this, so check for it separately
737 if ((pch = strstr(identifier, key)))
738 identifier = pch + strlen(key);
739 }
740 }
741
742 if (identifier == nullptr)
743 g_warning("Unrecognized TZID: '%s'", tzid);
744 else
745 return g_time_zone_new(identifier);
746
747 return nullptr;
732 }748 }
733749
734 static DateTime750 static DateTime
@@ -740,51 +756,9 @@
740 DateTime out;756 DateTime out;
741 g_return_val_if_fail(in.value != nullptr, out);757 g_return_val_if_fail(in.value != nullptr, out);
742758
743 GTimeZone * gtz {};759 GTimeZone * gtz = timezone_from_name(in.tzid, client, cancellable.get(), nullptr);
744 if (in.tzid != nullptr)760 if (gtz == nullptr)
745 {
746 auto itz = icaltimezone_get_builtin_timezone_from_tzid(in.tzid); // usually works
747
748 if (itz == nullptr) // fallback
749 itz = icaltimezone_get_builtin_timezone(in.tzid);
750
751 if (itz == nullptr) // ok we have a strange tzid... ask EDS to look it up in VTIMEZONES
752 e_cal_client_get_timezone_sync(client, in.tzid, &itz, cancellable.get(), nullptr);
753
754 const char* identifier {};
755
756 if (itz != nullptr)
757 {
758 identifier = icaltimezone_get_display_name(itz);
759
760 if (identifier == nullptr)
761 identifier = icaltimezone_get_location(itz);
762 }
763
764 // handle the TZID /freeassociation.sourceforge.net/Tzfile/[Location] case
765 if (identifier != nullptr)
766 {
767 const char* pch;
768 const char* key = "/freeassociation.sourceforge.net/";
769 if ((pch = strstr(identifier, key)))
770 {
771 identifier = pch + strlen(key);
772 key = "Tzfile/"; // some don't have this, so check for it separately
773 if ((pch = strstr(identifier, key)))
774 identifier = pch + strlen(key);
775 }
776 }
777
778 if (identifier == nullptr)
779 g_warning("Unrecognized TZID: '%s'", in.tzid);
780
781 gtz = g_time_zone_new(identifier);
782 g_debug("%s eccdt.tzid -> offset is %d", G_STRLOC, in.tzid, (int)g_time_zone_get_offset(gtz,0));
783 }
784 else
785 {
786 gtz = g_time_zone_ref(default_timezone);761 gtz = g_time_zone_ref(default_timezone);
787 }
788762
789 out = DateTime(gtz,763 out = DateTime(gtz,
790 in.value->year,764 in.value->year,
@@ -797,7 +771,7 @@
797 return out;771 return out;
798 }772 }
799773
800 static bool774 bool
801 is_component_interesting(ECalComponent * component)775 is_component_interesting(ECalComponent * component)
802 {776 {
803 // we only want calendar events and vtodos777 // we only want calendar events and vtodos
@@ -823,6 +797,28 @@
823 disabled = true;797 disabled = true;
824 }798 }
825 e_cal_component_free_categories_list(categ_list);799 e_cal_component_free_categories_list(categ_list);
800
801 if (!disabled) {
802 // we don't want not attending alarms
803 // check if the user is part of attendee list if we found it check the status
804 GSList *attendeeList = nullptr;
805 e_cal_component_get_attendee_list(component, &attendeeList);
806
807 for (GSList *attendeeIter=attendeeList; attendeeIter != nullptr; attendeeIter = attendeeIter->next) {
808 ECalComponentAttendee *attendee = static_cast<ECalComponentAttendee *>(attendeeIter->data);
809 if (attendee->value) {
810 if (strncmp(attendee->value, "mailto:", 7) == 0) {
811 if (m_myself->isMyEmail(attendee->value+7)) {
812 disabled = (attendee->status == ICAL_PARTSTAT_DECLINED);
813 break;
814 }
815 }
816 }
817 }
818 if (attendeeList)
819 e_cal_component_free_attendee_list(attendeeList);
820 }
821
826 if (disabled)822 if (disabled)
827 return false;823 return false;
828824
@@ -903,35 +899,13 @@
903 }899 }
904900
905 static void901 static void
906 add_event_to_subtask(ECalComponent * component,
907 ClientSubtask * subtask,
908 GTimeZone * gtz)
909 {
910 // events with alarms are covered by add_alarms_to_subtask(),
911 // so skip them here
912 auto auids = e_cal_component_get_alarm_uids(component);
913 const bool has_alarms = auids != nullptr;
914 cal_obj_uid_list_free(auids);
915 if (has_alarms)
916 return;
917
918 // add it. simple, eh?
919 if (is_component_interesting(component))
920 {
921 Appointment appointment = get_appointment(subtask->client, subtask->cancellable, component, gtz);
922 appointment.color = subtask->color;
923 subtask->task->appointments.push_back(appointment);
924 }
925 }
926
927 static void
928 add_alarms_to_subtask(ECalComponentAlarms * comp_alarms,902 add_alarms_to_subtask(ECalComponentAlarms * comp_alarms,
929 ClientSubtask * subtask,903 ClientSubtask * subtask,
930 GTimeZone * gtz)904 GTimeZone * gtz)
931 {905 {
932 auto& component = comp_alarms->comp;906 auto& component = comp_alarms->comp;
933907
934 if (!is_component_interesting(component))908 if (!subtask->task->p->is_component_interesting(component))
935 return;909 return;
936910
937 Appointment baseline = get_appointment(subtask->client, subtask->cancellable, component, gtz);911 Appointment baseline = get_appointment(subtask->client, subtask->cancellable, component, gtz);
@@ -965,7 +939,6 @@
965 auto instance_time = std::make_pair(DateTime{gtz, ai->occur_start},939 auto instance_time = std::make_pair(DateTime{gtz, ai->occur_start},
966 DateTime{gtz, ai->occur_end});940 DateTime{gtz, ai->occur_end});
967 auto trigger_time = DateTime{gtz, ai->trigger};941 auto trigger_time = DateTime{gtz, ai->trigger};
968
969 auto& alarm = alarms[instance_time][trigger_time];942 auto& alarm = alarms[instance_time][trigger_time];
970943
971 if (alarm.text.empty())944 if (alarm.text.empty())
@@ -990,6 +963,21 @@
990 }963 }
991 }964 }
992965
966
967 static void
968 add_event_to_subtask(ECalComponent * component,
969 ClientSubtask * subtask,
970 GTimeZone * gtz)
971 {
972 // add it. simple, eh?
973 if (subtask->task->p->is_component_interesting(component))
974 {
975 Appointment appointment = get_appointment(subtask->client, subtask->cancellable, component, gtz);
976 appointment.color = subtask->color;
977 subtask->task->appointments.push_back(appointment);
978 }
979 }
980
993 /***981 /***
994 ****982 ****
995 ***/983 ***/
@@ -1062,14 +1050,15 @@
1062 ESourceRegistry* m_source_registry {};1050 ESourceRegistry* m_source_registry {};
1063 guint m_rebuild_tag {};1051 guint m_rebuild_tag {};
1064 time_t m_rebuild_deadline {};1052 time_t m_rebuild_deadline {};
1053 std::shared_ptr<Myself> m_myself;
1065};1054};
10661055
1067/***1056/***
1068****1057****
1069***/1058***/
10701059
1071EdsEngine::EdsEngine():1060EdsEngine::EdsEngine(const std::shared_ptr<Myself> &myself):
1072 p(new Impl())1061 p(new Impl(myself))
1073{1062{
1074}1063}
10751064
10761065
=== modified file 'src/main.cpp'
--- src/main.cpp 2016-04-12 17:03:36 +0000
+++ src/main.cpp 2016-04-19 02:46:55 +0000
@@ -25,6 +25,7 @@
25#include <datetime/exporter.h>25#include <datetime/exporter.h>
26#include <datetime/locations-settings.h>26#include <datetime/locations-settings.h>
27#include <datetime/menu.h>27#include <datetime/menu.h>
28#include <datetime/myself.h>
28#include <datetime/planner-aggregate.h>29#include <datetime/planner-aggregate.h>
29#include <datetime/planner-snooze.h>30#include <datetime/planner-snooze.h>
30#include <datetime/planner-range.h>31#include <datetime/planner-range.h>
@@ -58,7 +59,7 @@
58 if (!g_strcmp0("lightdm", g_get_user_name()))59 if (!g_strcmp0("lightdm", g_get_user_name()))
59 engine.reset(new MockEngine);60 engine.reset(new MockEngine);
60 else61 else
61 engine.reset(new EdsEngine);62 engine.reset(new EdsEngine(std::shared_ptr<Myself>(new Myself)));
6263
63 return engine;64 return engine;
64 }65 }
6566
=== added file 'src/myself.cpp'
--- src/myself.cpp 1970-01-01 00:00:00 +0000
+++ src/myself.cpp 2016-04-19 02:46:55 +0000
@@ -0,0 +1,76 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Renato Araujo Oliveira Filho <renato.filho@canonical.com>
18 */
19
20#include "datetime/myself.h"
21
22#include <libaccounts-glib/ag-manager.h>
23#include <libaccounts-glib/ag-account.h>
24
25#include <algorithm>
26
27namespace unity {
28namespace indicator {
29namespace datetime {
30
31Myself::Myself()
32 : m_accounts_manager(ag_manager_new(), g_object_unref)
33{
34 reloadEmails();
35 g_object_connect(m_accounts_manager.get(),
36 "signal::account-created", on_accounts_changed, this,
37 "signal::account-deleted", on_accounts_changed, this,
38 "signal::account-updated", on_accounts_changed, this,
39 nullptr);
40}
41
42bool Myself::isMyEmail(const std::string &email)
43{
44 return m_emails.get().count(email) > 0;
45}
46
47void Myself::on_accounts_changed(AgManager *, guint, Myself *self)
48{
49 self->reloadEmails();
50}
51
52void Myself::reloadEmails()
53{
54 std::set<std::string> emails;
55
56 auto manager = m_accounts_manager.get();
57 auto ids = ag_manager_list(manager);
58 for (auto l=ids; l!=nullptr; l=l->next)
59 {
60 auto acc = ag_manager_get_account(manager, GPOINTER_TO_UINT(l->data));
61 if (acc) {
62 auto account_name = ag_account_get_display_name(acc);
63 if (account_name != nullptr)
64 emails.insert(account_name);
65 g_object_unref(acc);
66 }
67 }
68 ag_manager_list_free(ids);
69
70 m_emails.set(emails);
71}
72
73} // namespace datetime
74} // namespace indicator
75} // namespace unity
76
077
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2016-03-22 18:51:50 +0000
+++ tests/CMakeLists.txt 2016-04-19 02:46:55 +0000
@@ -85,7 +85,8 @@
85 ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} # arg2: test executable path85 ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} # arg2: test executable path
86 ${TEST_NAME} # arg3: test name86 ${TEST_NAME} # arg3: test name
87 ${CMAKE_CURRENT_SOURCE_DIR}/test-eds-ics-config-files # arg4: base directory for config file template87 ${CMAKE_CURRENT_SOURCE_DIR}/test-eds-ics-config-files # arg4: base directory for config file template
88 ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.ics) # arg5: the ical file for this test88 ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.ics # arg5: the ical file for this test
89 ${CMAKE_CURRENT_SOURCE_DIR}/accounts.db) # arg6: online accounts database
89endfunction()90endfunction()
90add_eds_ics_test_by_name(test-eds-ics-all-day-events)91add_eds_ics_test_by_name(test-eds-ics-all-day-events)
91add_eds_ics_test_by_name(test-eds-ics-repeating-events)92add_eds_ics_test_by_name(test-eds-ics-repeating-events)
@@ -95,6 +96,7 @@
95add_eds_ics_test_by_name(test-eds-ics-tzids)96add_eds_ics_test_by_name(test-eds-ics-tzids)
96add_eds_ics_test_by_name(test-eds-ics-tzids-2)97add_eds_ics_test_by_name(test-eds-ics-tzids-2)
97add_eds_ics_test_by_name(test-eds-ics-tzids-utc)98add_eds_ics_test_by_name(test-eds-ics-tzids-utc)
99add_eds_ics_test_by_name(test-eds-ics-non-attending-alarms)
98100
99101
100# disabling the timezone unit tests because they require102# disabling the timezone unit tests because they require
101103
=== added file 'tests/accounts.db'
102Binary files tests/accounts.db 1970-01-01 00:00:00 +0000 and tests/accounts.db 2016-04-19 02:46:55 +0000 differ104Binary files tests/accounts.db 1970-01-01 00:00:00 +0000 and tests/accounts.db 2016-04-19 02:46:55 +0000 differ
=== modified file 'tests/run-eds-ics-test.sh'
--- tests/run-eds-ics-test.sh 2015-07-20 16:31:28 +0000
+++ tests/run-eds-ics-test.sh 2016-04-19 02:46:55 +0000
@@ -6,6 +6,7 @@
6TEST_NAME=$3 # test name6TEST_NAME=$3 # test name
7CONFIG_DIR=$4 # config files7CONFIG_DIR=$4 # config files
8ICS_FILE=$5 # ical file holding test data8ICS_FILE=$5 # ical file holding test data
9ACCOUNTS_DB=$6 # online account database
910
10echo "this script: ${SELF}"11echo "this script: ${SELF}"
11echo "test-runner: ${TEST_RUNNER}"12echo "test-runner: ${TEST_RUNNER}"
@@ -54,8 +55,15 @@
54 cp --verbose --archive ${ICS_FILE} ${XDG_DATA_HOME}/evolution/tasks/system/tasks.ics55 cp --verbose --archive ${ICS_FILE} ${XDG_DATA_HOME}/evolution/tasks/system/tasks.ics
55fi56fi
5657
58# prepare online accounts database
59if [ -e ${ACCOUNTS_DB} ]; then
60 echo "copying ${ACCOUNTS_DB} into $HOME"
61 mkdir -p ${XDG_CONFIG_HOME}/libaccounts-glib/
62 cp --verbose --archive ${ACCOUNTS_DB} ${XDG_CONFIG_HOME}/libaccounts-glib/accounts.db
63fi
64
57# run the test65# run the test
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
59rv=$?67rv=$?
6068
61# if the test passed, blow away the tmpdir69# if the test passed, blow away the tmpdir
6270
=== modified file 'tests/test-eds-ics-all-day-events.cpp'
--- tests/test-eds-ics-all-day-events.cpp 2015-05-21 12:47:24 +0000
+++ tests/test-eds-ics-all-day-events.cpp 2016-04-19 02:46:55 +0000
@@ -22,6 +22,7 @@
22#include <datetime/alarm-queue-simple.h>22#include <datetime/alarm-queue-simple.h>
23#include <datetime/clock-mock.h>23#include <datetime/clock-mock.h>
24#include <datetime/engine-eds.h>24#include <datetime/engine-eds.h>
25#include <datetime/myself.h>
25#include <datetime/planner-range.h>26#include <datetime/planner-range.h>
2627
27#include <gtest/gtest.h>28#include <gtest/gtest.h>
@@ -41,7 +42,7 @@
41TEST_F(VAlarmFixture, MultipleAppointments)42TEST_F(VAlarmFixture, MultipleAppointments)
42{43{
43 // start the EDS engine44 // start the EDS engine
44 auto engine = std::make_shared<EdsEngine>();45 auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>());
4546
46 // we need a consistent timezone for the planner and our local DateTimes47 // we need a consistent timezone for the planner and our local DateTimes
47 constexpr char const * zone_str {"America/Chicago"};48 constexpr char const * zone_str {"America/Chicago"};
@@ -66,7 +67,7 @@
66 constexpr int max_wait_sec = 10;67 constexpr int max_wait_sec = 10;
67 wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND);68 wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND);
68 }69 }
69 70
70 // what we expect to get...71 // what we expect to get...
71 Appointment expected_appt;72 Appointment expected_appt;
72 expected_appt.uid = "20150521T111538Z-7449-1000-3572-0@ghidorah";73 expected_appt.uid = "20150521T111538Z-7449-1000-3572-0@ghidorah";
7374
=== modified file 'tests/test-eds-ics-missing-trigger.cpp'
--- tests/test-eds-ics-missing-trigger.cpp 2015-10-13 14:40:02 +0000
+++ tests/test-eds-ics-missing-trigger.cpp 2016-04-19 02:46:55 +0000
@@ -22,6 +22,7 @@
22#include <datetime/alarm-queue-simple.h>22#include <datetime/alarm-queue-simple.h>
23#include <datetime/clock-mock.h>23#include <datetime/clock-mock.h>
24#include <datetime/engine-eds.h>24#include <datetime/engine-eds.h>
25#include <datetime/myself.h>
25#include <datetime/planner-range.h>26#include <datetime/planner-range.h>
2627
27#include <gtest/gtest.h>28#include <gtest/gtest.h>
@@ -41,7 +42,7 @@
41TEST_F(VAlarmFixture, MissingTriggers)42TEST_F(VAlarmFixture, MissingTriggers)
42{43{
43 // start the EDS engine44 // start the EDS engine
44 auto engine = std::make_shared<EdsEngine>();45 auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>());
4546
46 // we need a consistent timezone for the planner and our local DateTimes47 // we need a consistent timezone for the planner and our local DateTimes
47 constexpr char const * zone_str {"America/Chicago"};48 constexpr char const * zone_str {"America/Chicago"};
4849
=== added file 'tests/test-eds-ics-non-attending-alarms.cpp'
--- tests/test-eds-ics-non-attending-alarms.cpp 1970-01-01 00:00:00 +0000
+++ tests/test-eds-ics-non-attending-alarms.cpp 2016-04-19 02:46:55 +0000
@@ -0,0 +1,79 @@
1/*
2 * Copyright 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Charles Kerr <charles.kerr@canonical.com>
18 */
19
20#include <algorithm>
21
22#include <datetime/alarm-queue-simple.h>
23#include <datetime/clock-mock.h>
24#include <datetime/engine-eds.h>
25#include <datetime/myself.h>
26#include <datetime/planner-range.h>
27
28#include <gtest/gtest.h>
29
30#include "glib-fixture.h"
31#include "print-to.h"
32#include "timezone-mock.h"
33#include "wakeup-timer-mock.h"
34
35using namespace unity::indicator::datetime;
36using VAlarmFixture = GlibFixture;
37
38/***
39****
40***/
41
42TEST_F(VAlarmFixture, NonAttendingEvent)
43{
44 // start the EDS engine
45 auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>());
46
47 // we need a consistent timezone for the planner and our local DateTimes
48 constexpr char const * zone_str {"America/Recife"};
49 auto tz = std::make_shared<MockTimezone>(zone_str);
50 auto gtz = g_time_zone_new(zone_str);
51
52 // make a planner that looks at the first half of 2016 in EDS
53 auto planner = std::make_shared<SimpleRangePlanner>(engine, tz);
54 const DateTime range_begin {gtz, 2016,1, 1, 0, 0, 0.0};
55 const DateTime range_end {gtz, 2016,6,31,23,59,59.5};
56 planner->range().set(std::make_pair(range_begin, range_end));
57
58 // give EDS a moment to load
59 if (planner->appointments().get().empty()) {
60 g_message("waiting a moment for EDS to load...");
61 auto on_appointments_changed = [this](const std::vector<Appointment>& appointments){
62 g_message("ah, they loaded");
63 if (!appointments.empty())
64 g_main_loop_quit(loop);
65 };
66 core::ScopedConnection conn(planner->appointments().changed().connect(on_appointments_changed));
67 constexpr int max_wait_sec = 10;
68 wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND);
69 }
70
71 // the planner should match what we've got in the calendar.ics file
72 const auto appts = planner->appointments().get();
73 EXPECT_EQ(2, appts.size());
74 EXPECT_EQ(appts[0].begin, DateTime(gtz, 2016, 4, 4, 16, 0, 0));
75 EXPECT_EQ(appts[1].begin, DateTime(gtz, 2016, 4, 6, 16, 0, 0));
76
77 // cleanup
78 g_time_zone_unref(gtz);
79}
080
=== added file 'tests/test-eds-ics-non-attending-alarms.ics.in'
--- tests/test-eds-ics-non-attending-alarms.ics.in 1970-01-01 00:00:00 +0000
+++ tests/test-eds-ics-non-attending-alarms.ics.in 2016-04-19 02:46:55 +0000
@@ -0,0 +1,53 @@
1BEGIN:VCALENDAR
2CALSCALE:GREGORIAN
3PRODID:-//Ximian//NONSGML Evolution Calendar//EN
4VERSION:2.0
5X-EVOLUTION-DATA-REVISION:2015-04-05T21:32:47.354433Z(2)
6BEGIN:VEVENT
7STATUS:CONFIRMED
8DTSTAMP:20160405T152128Z
9CREATED:20160405T152128Z
10UID:ddtvl069dn2cquo8dhg3j9c360@google.com
11SEQUENCE:1
12TRANSP:OPAQUE
13SUMMARY:Every day at 4PM
14DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/America/Recife:
15 20160404T160000
16RRULE:FREQ=DAILY;UNTIL=20160406T190000Z
17DTEND;TZID=/freeassociation.sourceforge.net/Tzfile/America/Recife:
18 20160404T170000
19ATTENDEE;CN=Uphablet;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;
20 CUTYPE=INDIVIDUAL:mailto:uphablet@ubuntu.com
21LAST-MODIFIED:20160405T152128Z
22BEGIN:VALARM
23TRIGGER;VALUE=DURATION:-PT30M
24ACTION:EMAIL
25DESCRIPTION:This is an event reminder
26X-EVOLUTION-ALARM-UID:20160405T152128Z-2848-32011-1844-65@ubuntu-phablet
27END:VALARM
28END:VEVENT
29BEGIN:VEVENT
30STATUS:CONFIRMED
31DTSTAMP:20160405T152128Z
32CREATED:20160405T151054Z
33UID:ddtvl069dn2cquo8dhg3j9c360@google.com
34SEQUENCE:1
35TRANSP:OPAQUE
36SUMMARY::Every day at 4PM
37DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/America/Fortaleza:
38 20160405T160000
39RECURRENCE-ID;TZID=/freeassociation.sourceforge.net/Tzfile/America/Recife:
40 20160405T160000
41DTEND;TZID=/freeassociation.sourceforge.net/Tzfile/America/Fortaleza:
42 20160405T170000
43ATTENDEE;CN=Uphablet;PARTSTAT=DECLINED;ROLE=REQ-PARTICIPANT;
44 CUTYPE=INDIVIDUAL:mailto:uphablet@ubuntu.com
45LAST-MODIFIED:20160405T152128Z
46BEGIN:VALARM
47TRIGGER;VALUE=DURATION:-PT30M
48ACTION:EMAIL
49DESCRIPTION:This is an event reminder
50X-EVOLUTION-ALARM-UID:20160405T152128Z-2848-32011-1844-66@ubuntu-phablet
51END:VALARM
52END:VEVENT
53END:VCALENDAR
054
=== modified file 'tests/test-eds-ics-nonrepeating-events.cpp'
--- tests/test-eds-ics-nonrepeating-events.cpp 2015-10-13 14:40:02 +0000
+++ tests/test-eds-ics-nonrepeating-events.cpp 2016-04-19 02:46:55 +0000
@@ -22,6 +22,7 @@
22#include <datetime/alarm-queue-simple.h>22#include <datetime/alarm-queue-simple.h>
23#include <datetime/clock-mock.h>23#include <datetime/clock-mock.h>
24#include <datetime/engine-eds.h>24#include <datetime/engine-eds.h>
25#include <datetime/myself.h>
25#include <datetime/planner-range.h>26#include <datetime/planner-range.h>
2627
27#include <gtest/gtest.h>28#include <gtest/gtest.h>
@@ -41,7 +42,7 @@
41TEST_F(VAlarmFixture, MultipleAppointments)42TEST_F(VAlarmFixture, MultipleAppointments)
42{43{
43 // start the EDS engine44 // start the EDS engine
44 auto engine = std::make_shared<EdsEngine>();45 auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>());
4546
46 // we need a consistent timezone for the planner and our local DateTimes47 // we need a consistent timezone for the planner and our local DateTimes
47 constexpr char const * zone_str {"America/Chicago"};48 constexpr char const * zone_str {"America/Chicago"};
@@ -66,7 +67,7 @@
66 constexpr int max_wait_sec = 10;67 constexpr int max_wait_sec = 10;
67 wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND);68 wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND);
68 }69 }
69 70
70 // what we expect to get...71 // what we expect to get...
71 Appointment expected_appt;72 Appointment expected_appt;
72 expected_appt.uid = "20150520T000726Z-3878-32011-1770-81@ubuntu-phablet";73 expected_appt.uid = "20150520T000726Z-3878-32011-1770-81@ubuntu-phablet";
7374
=== modified file 'tests/test-eds-ics-repeating-events.cpp'
--- tests/test-eds-ics-repeating-events.cpp 2015-10-13 14:40:02 +0000
+++ tests/test-eds-ics-repeating-events.cpp 2016-04-19 02:46:55 +0000
@@ -22,6 +22,7 @@
22#include <datetime/alarm-queue-simple.h>22#include <datetime/alarm-queue-simple.h>
23#include <datetime/clock-mock.h>23#include <datetime/clock-mock.h>
24#include <datetime/engine-eds.h>24#include <datetime/engine-eds.h>
25#include <datetime/myself.h>
25#include <datetime/planner-range.h>26#include <datetime/planner-range.h>
2627
27#include <gtest/gtest.h>28#include <gtest/gtest.h>
@@ -41,7 +42,7 @@
41TEST_F(VAlarmFixture, MultipleAppointments)42TEST_F(VAlarmFixture, MultipleAppointments)
42{43{
43 // start the EDS engine44 // start the EDS engine
44 auto engine = std::make_shared<EdsEngine>();45 auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>());
4546
46 // we need a consistent timezone for the planner and our local DateTimes47 // we need a consistent timezone for the planner and our local DateTimes
47 constexpr char const * zone_str {"America/Chicago"};48 constexpr char const * zone_str {"America/Chicago"};
@@ -66,7 +67,7 @@
66 constexpr int max_wait_sec = 10;67 constexpr int max_wait_sec = 10;
67 wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND);68 wait_msec(max_wait_sec * G_TIME_SPAN_MILLISECOND);
68 }69 }
69 70
70 // what we expect to get...71 // what we expect to get...
71 Appointment expected_appt;72 Appointment expected_appt;
72 expected_appt.uid = "20150507T211449Z-4262-32011-1418-1@ubuntu-phablet";73 expected_appt.uid = "20150507T211449Z-4262-32011-1418-1@ubuntu-phablet";
7374
=== modified file 'tests/test-eds-ics-repeating-valarms.cpp'
--- tests/test-eds-ics-repeating-valarms.cpp 2015-05-20 23:23:32 +0000
+++ tests/test-eds-ics-repeating-valarms.cpp 2016-04-19 02:46:55 +0000
@@ -22,6 +22,7 @@
22#include <datetime/alarm-queue-simple.h>22#include <datetime/alarm-queue-simple.h>
23#include <datetime/clock-mock.h>23#include <datetime/clock-mock.h>
24#include <datetime/engine-eds.h>24#include <datetime/engine-eds.h>
25#include <datetime/myself.h>
25#include <datetime/planner-range.h>26#include <datetime/planner-range.h>
2627
27#include <gtest/gtest.h>28#include <gtest/gtest.h>
@@ -41,7 +42,7 @@
41TEST_F(VAlarmFixture, MultipleAppointments)42TEST_F(VAlarmFixture, MultipleAppointments)
42{43{
43 // start the EDS engine44 // start the EDS engine
44 auto engine = std::make_shared<EdsEngine>();45 auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>());
4546
46 // we need a consistent timezone for the planner and our local DateTimes47 // we need a consistent timezone for the planner and our local DateTimes
47 constexpr char const * zone_str {"America/Chicago"};48 constexpr char const * zone_str {"America/Chicago"};
4849
=== modified file 'tests/test-eds-ics-tzids-2.cpp'
--- tests/test-eds-ics-tzids-2.cpp 2015-07-09 20:56:13 +0000
+++ tests/test-eds-ics-tzids-2.cpp 2016-04-19 02:46:55 +0000
@@ -22,6 +22,7 @@
22#include <datetime/alarm-queue-simple.h>22#include <datetime/alarm-queue-simple.h>
23#include <datetime/clock-mock.h>23#include <datetime/clock-mock.h>
24#include <datetime/engine-eds.h>24#include <datetime/engine-eds.h>
25#include <datetime/myself.h>
25#include <datetime/planner-range.h>26#include <datetime/planner-range.h>
2627
27#include <gtest/gtest.h>28#include <gtest/gtest.h>
@@ -41,7 +42,7 @@
41TEST_F(VAlarmFixture, MultipleAppointments)42TEST_F(VAlarmFixture, MultipleAppointments)
42{43{
43 // start the EDS engine44 // start the EDS engine
44 auto engine = std::make_shared<EdsEngine>();45 auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>());
4546
46 // we need a consistent timezone for the planner and our local DateTimes47 // we need a consistent timezone for the planner and our local DateTimes
47 constexpr char const * zone_str {"America/Los_Angeles"};48 constexpr char const * zone_str {"America/Los_Angeles"};
4849
=== modified file 'tests/test-eds-ics-tzids-utc.cpp'
--- tests/test-eds-ics-tzids-utc.cpp 2016-03-22 19:13:10 +0000
+++ tests/test-eds-ics-tzids-utc.cpp 2016-04-19 02:46:55 +0000
@@ -22,6 +22,7 @@
22#include <datetime/alarm-queue-simple.h>22#include <datetime/alarm-queue-simple.h>
23#include <datetime/clock-mock.h>23#include <datetime/clock-mock.h>
24#include <datetime/engine-eds.h>24#include <datetime/engine-eds.h>
25#include <datetime/myself.h>
25#include <datetime/planner-range.h>26#include <datetime/planner-range.h>
2627
27#include <gtest/gtest.h>28#include <gtest/gtest.h>
@@ -41,7 +42,7 @@
41TEST_F(VAlarmFixture, UTCAppointments)42TEST_F(VAlarmFixture, UTCAppointments)
42{43{
43 // start the EDS engine44 // start the EDS engine
44 auto engine = std::make_shared<EdsEngine>();45 auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>());
4546
46 // we need a consistent timezone for the planner and our local DateTimes47 // we need a consistent timezone for the planner and our local DateTimes
47 constexpr char const * zone_str {"America/Recife"};48 constexpr char const * zone_str {"America/Recife"};
4849
=== modified file 'tests/test-eds-ics-tzids.cpp'
--- tests/test-eds-ics-tzids.cpp 2015-07-09 19:14:32 +0000
+++ tests/test-eds-ics-tzids.cpp 2016-04-19 02:46:55 +0000
@@ -22,6 +22,7 @@
22#include <datetime/alarm-queue-simple.h>22#include <datetime/alarm-queue-simple.h>
23#include <datetime/clock-mock.h>23#include <datetime/clock-mock.h>
24#include <datetime/engine-eds.h>24#include <datetime/engine-eds.h>
25#include <datetime/myself.h>
25#include <datetime/planner-range.h>26#include <datetime/planner-range.h>
2627
27#include <gtest/gtest.h>28#include <gtest/gtest.h>
@@ -41,7 +42,7 @@
41TEST_F(VAlarmFixture, MultipleAppointments)42TEST_F(VAlarmFixture, MultipleAppointments)
42{43{
43 // start the EDS engine44 // start the EDS engine
44 auto engine = std::make_shared<EdsEngine>();45 auto engine = std::make_shared<EdsEngine>(std::make_shared<Myself>());
4546
46 // we need a consistent timezone for the planner and our local DateTimes47 // we need a consistent timezone for the planner and our local DateTimes
47 constexpr char const * zone_str {"Europe/Berlin"};48 constexpr char const * zone_str {"Europe/Berlin"};

Subscribers

People subscribed via source and target branches