From 85cb430bd147719fed43f4ccf04b9d22cad33bfc Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 28 Apr 2016 11:56:11 -0300 Subject: Detect desktop to launch applications. --- tests/test-live-actions.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'tests/test-live-actions.cpp') diff --git a/tests/test-live-actions.cpp b/tests/test-live-actions.cpp index d38893f..12ef362 100644 --- a/tests/test-live-actions.cpp +++ b/tests/test-live-actions.cpp @@ -29,12 +29,9 @@ class MockLiveActions: public LiveActions public: std::string last_cmd; std::string last_url; + explicit MockLiveActions(const std::shared_ptr& state_in): LiveActions(state_in) {} ~MockLiveActions() {} - -protected: - void dispatch_url(const std::string& url) override { last_url = url; } - void execute_command(const std::string& cmd) override { last_cmd = cmd; } }; class TestLiveActionsFixture: public TimedatedFixture @@ -112,7 +109,7 @@ TEST_F(TestLiveActionsFixture, SetLocation) TEST_F(TestLiveActionsFixture, DesktopOpenAlarmApp) { - m_actions->desktop_open_alarm_app(); + m_actions->open_alarm_app(); const std::string expected = "evolution -c calendar"; EXPECT_EQ(expected, m_live_actions->last_cmd); } @@ -122,21 +119,21 @@ TEST_F(TestLiveActionsFixture, DesktopOpenAppointment) Appointment a; a.uid = "some-uid"; a.begin = DateTime::NowLocal(); - m_actions->desktop_open_appointment(a, a.begin); + m_actions->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); } TEST_F(TestLiveActionsFixture, DesktopOpenCalendarApp) { - m_actions->desktop_open_calendar_app(DateTime::NowLocal()); + m_actions->open_calendar_app(DateTime::NowLocal()); const std::string expected_substr = "evolution \"calendar:///?startdate="; EXPECT_NE(m_live_actions->last_cmd.find(expected_substr), std::string::npos); } TEST_F(TestLiveActionsFixture, DesktopOpenSettingsApp) { - m_actions->desktop_open_settings_app(); + m_actions->open_settings_app(); const std::string expected_substr = "control-center"; EXPECT_NE(m_live_actions->last_cmd.find(expected_substr), std::string::npos); } @@ -152,7 +149,7 @@ namespace TEST_F(TestLiveActionsFixture, PhoneOpenAlarmApp) { - m_actions->phone_open_alarm_app(); + m_actions->open_alarm_app(); EXPECT_EQ(clock_app_url, m_live_actions->last_url); } @@ -165,19 +162,19 @@ TEST_F(TestLiveActionsFixture, PhoneOpenAppointment) a.begin = DateTime::NowLocal(); a.type = Appointment::EVENT; auto ocurrenceDate = DateTime::Local(2014, 1, 1, 0, 0, 0); - m_actions->phone_open_appointment(a, ocurrenceDate); + m_actions->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, a.begin); + m_actions->open_appointment(a, a.begin); EXPECT_EQ(clock_app_url, m_live_actions->last_url); } TEST_F(TestLiveActionsFixture, PhoneOpenCalendarApp) { auto now = DateTime::NowLocal(); - m_actions->phone_open_calendar_app(now); + m_actions->open_calendar_app(now); 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); } @@ -185,7 +182,7 @@ TEST_F(TestLiveActionsFixture, PhoneOpenCalendarApp) TEST_F(TestLiveActionsFixture, PhoneOpenSettingsApp) { - m_actions->phone_open_settings_app(); + m_actions->open_settings_app(); const std::string expected = "settings:///system/time-date"; EXPECT_EQ(expected, m_live_actions->last_url); } -- cgit v1.2.3