aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@canonical.com>2016-03-21 14:32:39 -0300
committerRobert Tari <robert@tari.in>2021-07-05 00:44:12 +0200
commitd1935f872fe600f224aa89eff3ab70a48d52c16d (patch)
treec29a046d47f09fc434b08e3c9f0aedb4cc700c65 /tests
parentbf7746273c111b004c56a0868bb1702d96ecb67f (diff)
downloadayatana-indicator-datetime-d1935f872fe600f224aa89eff3ab70a48d52c16d.tar.gz
ayatana-indicator-datetime-d1935f872fe600f224aa89eff3ab70a48d52c16d.tar.bz2
ayatana-indicator-datetime-d1935f872fe600f224aa89eff3ab70a48d52c16d.zip
Make sure that the ocurrence time is used to build the url to launch external application.
Diffstat (limited to 'tests')
-rw-r--r--tests/actions-mock.h6
-rw-r--r--tests/test-actions.cpp4
-rw-r--r--tests/test-live-actions.cpp11
3 files changed, 12 insertions, 9 deletions
diff --git a/tests/actions-mock.h b/tests/actions-mock.h
index 59a0912..346a8f6 100644
--- a/tests/actions-mock.h
+++ b/tests/actions-mock.h
@@ -57,8 +57,9 @@ public:
void desktop_open_alarm_app() {
m_history.push_back(DesktopOpenAlarmApp);
}
- void desktop_open_appointment(const Appointment& appt) {
+ void desktop_open_appointment(const Appointment& appt, const DateTime& dt) {
m_appt = appt;
+ m_date_time = dt;
m_history.push_back(DesktopOpenAppt);
}
void desktop_open_calendar_app(const DateTime& dt) {
@@ -72,8 +73,9 @@ public:
void phone_open_alarm_app() {
m_history.push_back(PhoneOpenAlarmApp);
}
- void phone_open_appointment(const Appointment& appt) {
+ void phone_open_appointment(const Appointment& appt, const DateTime& dt) {
m_appt = appt;
+ m_date_time = dt;
m_history.push_back(PhoneOpenAppt);
}
void phone_open_calendar_app(const DateTime& dt) {
diff --git a/tests/test-actions.cpp b/tests/test-actions.cpp
index aa608a8..96da7cc 100644
--- a/tests/test-actions.cpp
+++ b/tests/test-actions.cpp
@@ -116,7 +116,7 @@ protected:
m_mock_state->mock_range_planner->appointments().set(appointments);
// activate the action
- auto v = g_variant_new_string(appointments[0].uid.c_str());
+ auto v = g_variant_new("(sx)", appointments[0].uid.c_str(), 0);
g_action_group_activate_action(action_group, action_name, v);
// test the results
@@ -134,7 +134,7 @@ protected:
EXPECT_TRUE(m_mock_actions->history().empty());
// activate the action
- v = g_variant_new_string("this-uid-is-not-one-that-we-have");
+ v = g_variant_new("(sx)", "this-uid-is-not-one-that-we-have", 0);
g_action_group_activate_action(action_group, action_name, v);
// test the results
diff --git a/tests/test-live-actions.cpp b/tests/test-live-actions.cpp
index 3f79d7d..e7cb1a2 100644
--- a/tests/test-live-actions.cpp
+++ b/tests/test-live-actions.cpp
@@ -64,7 +64,7 @@ TEST_F(TimedateFixture, DesktopOpenAppointment)
Appointment a;
a.uid = "some-uid";
a.begin = DateTime::NowLocal();
- m_actions->desktop_open_appointment(a);
+ m_actions->desktop_open_appointment(a, a.begin);
const std::string expected_substr = "evolution \"calendar:///?startdate=";
EXPECT_NE(m_live_actions->last_cmd.find(expected_substr), std::string::npos);
}
@@ -106,12 +106,13 @@ TEST_F(TimedateFixture, PhoneOpenAppointment)
a.source_uid = "source-uid";
a.begin = DateTime::NowLocal();
a.type = Appointment::EVENT;
- m_actions->phone_open_appointment(a);
- const std::string appointment_app_url = "calendar://eventid=source-uid/event-uid";
+ auto ocurrenceDate = DateTime::Local(2014, 1, 1, 0, 0, 0);
+ m_actions->phone_open_appointment(a, ocurrenceDate);
+ const std::string appointment_app_url = ocurrenceDate.to_timezone("UTC").format("calendar://startdate=%Y-%m-%dT%H:%M:%S+00:00");
EXPECT_EQ(appointment_app_url, m_live_actions->last_url);
a.type = Appointment::UBUNTU_ALARM;
- m_actions->phone_open_appointment(a);
+ m_actions->phone_open_appointment(a, a.begin);
EXPECT_EQ(clock_app_url, m_live_actions->last_url);
}
@@ -119,7 +120,7 @@ TEST_F(TimedateFixture, PhoneOpenCalendarApp)
{
auto now = DateTime::NowLocal();
m_actions->phone_open_calendar_app(now);
- const std::string expected = now.format("calendar:///?startdate=%Y%m%dT%H%M%SZ");
+ const std::string expected = now.to_timezone("UTC").format("calendar://startdate=%Y-%m-%dT%H:%M:%S+00:00");
EXPECT_EQ(expected, m_live_actions->last_url);
}