aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-07-16 21:52:08 +0200
committerRobert Tari <robert@tari.in>2021-07-21 02:02:47 +0200
commit217b48352a2591150413c77ca85b6a1ef158e6d5 (patch)
treed511ab0cc1854de03f09f915f57c6e7d518810dd /src
parent7b495005c1998aaf148c17ceb4f5576835d87ba2 (diff)
downloadayatana-indicator-datetime-217b48352a2591150413c77ca85b6a1ef158e6d5.tar.gz
ayatana-indicator-datetime-217b48352a2591150413c77ca85b6a1ef158e6d5.tar.bz2
ayatana-indicator-datetime-217b48352a2591150413c77ca85b6a1ef158e6d5.zip
Fix failing tests
- include/actions-mock.h: Set return value to std::string and return an empty string - include/actions.h: Make open_alarm_app, open_appointment, open_calendar_app and open_settings_app return the uri/command - include/actions-live.h: Make open_alarm_app, open_appointment, open_calendar_app and open_settings_app return the uri/command - src/actions-live.cpp: Make open_alarm_app, open_appointment, open_calendar_app and open_settings_app return the uri/command - tests/test-live-actions.cpp: Drop last_cmd and last_url variables + use return values of actions-live functions for testing + test phone functions on lomiri only - tests/test-live-actions.cpp: test phone functions after setting XDG_CURRENT_DESKTOP - tests/test-settings.cpp: Use SETTINGS_NOTIFY_SCHEMA_ID only if it exists - tests/run-eds-ics-test.sh: Remove return statement - tests/CMakeLists.txt: Enable the timezone unit tests - tests/CMakeLists.txt: Catch race condition while attempting to copy schemas - tests/CMakeLists.txt: Exclude blocking tests on Travis for now - tests/tests-timezones.cpp: Use MockTimezone to construct LiveTimezones + drop section expecting changes after /timezone is modified (not monitored) - tests/test-formater: Change warning to plain message otherwise it can crash the test - .build.yml: Replace libmessaging-menu-dev with ayatana-indicator-messages Git build
Diffstat (limited to 'src')
-rw-r--r--src/actions-live.cpp57
1 files changed, 40 insertions, 17 deletions
diff --git a/src/actions-live.cpp b/src/actions-live.cpp
index 5c49bc4..50add68 100644
--- a/src/actions-live.cpp
+++ b/src/actions-live.cpp
@@ -46,52 +46,70 @@ LiveActions::LiveActions(const std::shared_ptr<State>& state_in):
****
***/
-void LiveActions::open_alarm_app()
+std::string LiveActions::open_alarm_app()
{
+ std::string sReturn = "";
+
if (ayatana_common_utils_is_lomiri())
{
- ayatana_common_utils_open_url("alarm://");
+ sReturn = "alarm://";
+ ayatana_common_utils_open_url(sReturn.c_str());
}
else
{
- ayatana_common_utils_execute_command("evolution -c calendar");
+ sReturn = "evolution -c calendar";
+ ayatana_common_utils_execute_command(sReturn.c_str());
}
+
+ return sReturn;
}
-void LiveActions::open_calendar_app(const DateTime& dt)
+std::string LiveActions::open_calendar_app(const DateTime& dt)
{
+ std::string sReturn = "";
+
if (ayatana_common_utils_is_lomiri())
{
const auto utc = dt.to_timezone("UTC");
- auto cmd = utc.format("calendar://startdate=%Y-%m-%dT%H:%M:%S+00:00");
- ayatana_common_utils_open_url(cmd.c_str());
+ sReturn = utc.format("calendar://startdate=%Y-%m-%dT%H:%M:%S+00:00");
+ ayatana_common_utils_open_url(sReturn.c_str());
}
else
{
const auto utc = dt.start_of_day().to_timezone("UTC");
- auto cmd = utc.format("evolution \"calendar:///?startdate=%Y%m%dT%H%M%SZ\"");
- ayatana_common_utils_execute_command(cmd.c_str());
+ sReturn = utc.format("evolution \"calendar:///?startdate=%Y%m%dT%H%M%SZ\"");
+ ayatana_common_utils_execute_command(sReturn.c_str());
}
+
+ return sReturn;
}
-void LiveActions::open_settings_app()
+std::string LiveActions::open_settings_app()
{
+ std::string sReturn = "";
+
if (ayatana_common_utils_is_lomiri())
{
- ayatana_common_utils_open_url("settings:///system/time-date");
+ sReturn = "settings:///system/time-date";
+ ayatana_common_utils_open_url(sReturn.c_str());
}
else if (ayatana_common_utils_is_unity())
{
- ayatana_common_utils_execute_command("unity-control-center datetime");
+ sReturn = "unity-control-center datetime";
+ ayatana_common_utils_execute_command(sReturn.c_str());
}
else if (ayatana_common_utils_is_mate())
{
- ayatana_common_utils_execute_command("mate-time-admin");
+ sReturn = "mate-time-admin";
+ ayatana_common_utils_execute_command(sReturn.c_str());
}
else
{
- ayatana_common_utils_execute_command("gnome-control-center datetime");
+ sReturn = "gnome-control-center datetime";
+ ayatana_common_utils_execute_command(sReturn.c_str());
}
+
+ return sReturn;
}
bool LiveActions::desktop_has_calendar_app() const
@@ -126,23 +144,28 @@ bool LiveActions::desktop_has_calendar_app() const
return have_calendar;
}
-void LiveActions::open_appointment(const Appointment& appt, const DateTime& date)
+std::string LiveActions::open_appointment(const Appointment& appt, const DateTime& date)
{
+ std::string sReturn = "";
+
if (!appt.activation_url.empty())
{
- ayatana_common_utils_open_url(appt.activation_url.c_str());
+ sReturn = appt.activation_url;
+ ayatana_common_utils_open_url(sReturn.c_str());
}
else switch (appt.type)
{
case Appointment::UBUNTU_ALARM:
- open_alarm_app();
+ sReturn = open_alarm_app();
break;
case Appointment::EVENT:
default:
- open_calendar_app(date);
+ sReturn = open_calendar_app(date);
break;
}
+
+ return sReturn;
}
/***