From 18013dbb911de3d71ad679f697490f161ec19a34 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 22 Mar 2014 02:25:50 -0500 Subject: make the phone and desktop actions more consistent with each other; eg, 'indicator.desktop.open-calendar-app' + 'indicator.phone.open-calendar-app' --- tests/test-live-actions.cpp | 91 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 20 deletions(-) (limited to 'tests/test-live-actions.cpp') diff --git a/tests/test-live-actions.cpp b/tests/test-live-actions.cpp index d6ef424..c67b380 100644 --- a/tests/test-live-actions.cpp +++ b/tests/test-live-actions.cpp @@ -252,44 +252,95 @@ TEST_F(LiveActionsFixture, SetLocation) EXPECT_EQ(expected, m_state->settings->timezone_name.get()); } -TEST_F(LiveActionsFixture, OpenDesktopSettings) +/*** +**** +***/ + +TEST_F(LiveActionsFixture, DesktopOpenAlarmApp) +{ + m_actions->desktop_open_alarm_app(); + const std::string expected = "evolution -c calendar"; + EXPECT_EQ(expected, m_live_actions->last_cmd); +} + +TEST_F(LiveActionsFixture, DesktopOpenAppointment) +{ + Appointment a; + a.uid = "some-uid"; + a.begin = DateTime::NowLocal(); + m_actions->desktop_open_appointment(a); + const std::string expected_substr = "evolution \"calendar:///?startdate="; + EXPECT_NE(m_live_actions->last_cmd.find(expected_substr), std::string::npos); +} + +TEST_F(LiveActionsFixture, DesktopOpenCalendarApp) +{ + m_actions->desktop_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(LiveActionsFixture, DesktopOpenSettingsApp) { - m_actions->open_desktop_settings(); + m_actions->desktop_open_settings_app(); const std::string expected_substr = "control-center"; EXPECT_NE(m_live_actions->last_cmd.find(expected_substr), std::string::npos); } -TEST_F(LiveActionsFixture, OpenPlanner) +/*** +**** +***/ + +namespace { - m_actions->open_planner(); - const std::string expected = "evolution -c calendar"; - EXPECT_EQ(expected, m_live_actions->last_cmd); + const std::string clock_app_url = "appid://com.ubuntu.clock/clock/current-user-version"; + + const std::string calendar_app_url = "appid://com.ubuntu.calendar/calendar/current-user-version"; } -TEST_F(LiveActionsFixture, OpenPhoneSettings) +TEST_F(LiveActionsFixture, PhoneOpenAlarmApp) { - m_actions->open_phone_settings(); - const std::string expected = "settings:///system/time-date"; - EXPECT_EQ(expected, m_live_actions->last_url); + m_actions->phone_open_alarm_app(); + EXPECT_EQ(clock_app_url, m_live_actions->last_url); } -TEST_F(LiveActionsFixture, OpenPhoneClockApp) +TEST_F(LiveActionsFixture, PhoneOpenAppointment) { - m_actions->open_phone_clock_app(); - const std::string expected = "appid://com.ubuntu.clock/clock/current-user-version"; + Appointment a; + + a.uid = "some-uid"; + a.begin = DateTime::NowLocal(); + a.has_alarms = false; + m_actions->phone_open_appointment(a); + EXPECT_EQ(calendar_app_url, m_live_actions->last_url); + + a.has_alarms = true; + m_actions->phone_open_appointment(a); + EXPECT_EQ(clock_app_url, m_live_actions->last_url); + + a.url = "appid://blah"; + m_actions->phone_open_appointment(a); + EXPECT_EQ(a.url, m_live_actions->last_url); +} + +TEST_F(LiveActionsFixture, PhoneOpenCalendarApp) +{ + m_actions->phone_open_calendar_app(DateTime::NowLocal()); + const std::string expected = "appid://com.ubuntu.calendar/calendar/current-user-version"; EXPECT_EQ(expected, m_live_actions->last_url); } -TEST_F(LiveActionsFixture, OpenPlannerAt) +TEST_F(LiveActionsFixture, PhoneOpenSettingsApp) { - const auto now = DateTime::NowLocal(); - m_actions->open_planner_at(now); - const auto today_begins = now.add_full(0, 0, 0, -now.hour(), -now.minute(), -now.seconds()); - const auto gmt = today_begins.to_timezone("UTC"); - const auto expected = gmt.format("evolution \"calendar:///?startdate=%Y%m%dT%H%M%SZ\""); - EXPECT_EQ(expected, m_live_actions->last_cmd); + m_actions->phone_open_settings_app(); + const std::string expected = "settings:///system/time-date"; + EXPECT_EQ(expected, m_live_actions->last_url); } +/*** +**** +***/ + TEST_F(LiveActionsFixture, CalendarState) { // init the clock -- cgit v1.2.3