diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-12-08 10:40:44 +0000 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-12-08 10:40:44 +0000 |
commit | f54505942ce2dcc73fcbad79d4f5cdce991bf8cb (patch) | |
tree | 9aab8e9b612adfff946a93365cd0d2fea9aeb74c /tests | |
parent | 4a6ec712275b179decd1844232dce44bc9f9dc19 (diff) | |
download | ayatana-indicator-datetime-f54505942ce2dcc73fcbad79d4f5cdce991bf8cb.tar.gz ayatana-indicator-datetime-f54505942ce2dcc73fcbad79d4f5cdce991bf8cb.tar.bz2 ayatana-indicator-datetime-f54505942ce2dcc73fcbad79d4f5cdce991bf8cb.zip |
Make the datetime indicator build on non-Ubuntu systems (which mostly lack url-dispatcher and Ubuntu Touch sound schema files.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 5 | ||||
-rw-r--r-- | tests/manual-test-snap.cpp | 4 | ||||
-rw-r--r-- | tests/test-actions.cpp | 7 | ||||
-rw-r--r-- | tests/test-exporter.cpp | 4 | ||||
-rw-r--r-- | tests/test-formatter.cpp | 1 | ||||
-rw-r--r-- | tests/test-live-actions.cpp | 2 | ||||
-rw-r--r-- | tests/test-menus.cpp | 8 | ||||
-rw-r--r-- | tests/timedated-fixture.h | 2 |
8 files changed, 32 insertions, 1 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0302da9..8e5e187 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -47,7 +47,9 @@ function(add_test_by_name name) target_link_libraries (${TEST_NAME} indicatordatetimeservice gtest ${DBUSTEST_LIBRARIES} ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBS}) endfunction() add_test_by_name(test-datetime) +if(HAVE_UT_ACCTSERVICE_SYSTEMSOUND_SETTINGS) add_test_by_name(test-snap) +endif() add_test_by_name(test-actions) add_test_by_name(test-alarm-queue) add_test(NAME dear-reader-the-next-test-takes-60-seconds COMMAND true) @@ -66,6 +68,8 @@ set (TEST_NAME manual-test-snap) add_executable (${TEST_NAME} ${TEST_NAME}.cpp) target_link_libraries (${TEST_NAME} indicatordatetimeservice gtest ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBS}) +if (URLDISPATCHER_FOUND) + ## ## EDS Tests ## @@ -92,6 +96,7 @@ add_eds_ics_test_by_name(test-eds-ics-missing-trigger) add_eds_ics_test_by_name(test-eds-ics-tzids) add_eds_ics_test_by_name(test-eds-ics-tzids-2) +endif() # disabling the timezone unit tests because they require # https://code.launchpad.net/~ted/dbus-test-runner/multi-interface-test/+merge/199724 diff --git a/tests/manual-test-snap.cpp b/tests/manual-test-snap.cpp index 95775c8..12d34f3 100644 --- a/tests/manual-test-snap.cpp +++ b/tests/manual-test-snap.cpp @@ -18,6 +18,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifdef HAS_URLDISPATCHER + #include <datetime/appointment.h> #include <datetime/settings-live.h> #include <datetime/snap.h> @@ -99,3 +101,5 @@ int main(int argc, const char* argv[]) g_main_loop_unref(loop); return 0; } + +#endif diff --git a/tests/test-actions.cpp b/tests/test-actions.cpp index 7899d15..0586bcc 100644 --- a/tests/test-actions.cpp +++ b/tests/test-actions.cpp @@ -157,10 +157,13 @@ TEST_F(ActionsFixture, ActionsExist) "desktop.open-alarm-app", "desktop.open-calendar-app", "desktop.open-settings-app", +#ifdef HAS_URLDISPATCHER "phone.open-appointment", "phone.open-alarm-app", "phone.open-calendar-app", - "phone.open-settings-app" }; + "phone.open-settings-app" +#endif + }; for(const auto& name: names) { @@ -200,6 +203,7 @@ TEST_F(ActionsFixture, DesktopOpenSettingsApp) **** ***/ +#ifdef HAS_URLDISPATCHER TEST_F(ActionsFixture, PhoneOpenAlarmApp) { test_action_with_no_args("phone.open-alarm-app", @@ -223,6 +227,7 @@ TEST_F(ActionsFixture, PhoneOpenSettingsApp) test_action_with_no_args("phone.open-settings-app", MockActions::PhoneOpenSettingsApp); } +#endif /*** **** diff --git a/tests/test-exporter.cpp b/tests/test-exporter.cpp index bc8c70a..04c8445 100644 --- a/tests/test-exporter.cpp +++ b/tests/test-exporter.cpp @@ -111,15 +111,19 @@ TEST_F(ExporterFixture, Publish) EXPECT_EQ(1, names.count("desktop.open-appointment")); EXPECT_EQ(1, names.count("desktop.open-calendar-app")); EXPECT_EQ(1, names.count("desktop.open-settings-app")); +#ifdef HAS_URLDISPATCHER EXPECT_EQ(1, names.count("phone.open-alarm-app")); EXPECT_EQ(1, names.count("phone.open-appointment")); EXPECT_EQ(1, names.count("phone.open-calendar-app")); EXPECT_EQ(1, names.count("phone.open-settings-app")); +#endif EXPECT_EQ(1, names.count("calendar")); EXPECT_EQ(1, names.count("desktop_greeter-header")); EXPECT_EQ(1, names.count("desktop-header")); +#ifdef HAS_URLDISPATCHER EXPECT_EQ(1, names.count("phone_greeter-header")); EXPECT_EQ(1, names.count("phone-header")); +#endif EXPECT_EQ(1, names.count("set-location")); // try closing the connection prematurely diff --git a/tests/test-formatter.cpp b/tests/test-formatter.cpp index e9aa4e9..e61daa7 100644 --- a/tests/test-formatter.cpp +++ b/tests/test-formatter.cpp @@ -108,6 +108,7 @@ TEST_F(FormatterFixture, TestPhoneHeader) EXPECT_EQ(std::string(" 6:30 PM"), formatter.header.get()); } } +#endif #define EM_SPACE "\u2003" diff --git a/tests/test-live-actions.cpp b/tests/test-live-actions.cpp index 9f17001..aade9c7 100644 --- a/tests/test-live-actions.cpp +++ b/tests/test-live-actions.cpp @@ -94,6 +94,7 @@ namespace const std::string calendar_app_url = "appid://com.ubuntu.calendar/calendar/current-user-version"; } +#ifdef HAS_URLDISPATCHER TEST_F(TimedateFixture, PhoneOpenAlarmApp) { m_actions->phone_open_alarm_app(); @@ -128,6 +129,7 @@ TEST_F(TimedateFixture, PhoneOpenSettingsApp) const std::string expected = "settings:///system/time-date"; EXPECT_EQ(expected, m_live_actions->last_url); } +#endif /*** **** diff --git a/tests/test-menus.cpp b/tests/test-menus.cpp index 6e88b7b..f0c5653 100644 --- a/tests/test-menus.cpp +++ b/tests/test-menus.cpp @@ -97,8 +97,10 @@ protected: if (profile == Menu::Desktop) expected_action = "indicator.desktop.open-calendar-app"; +#ifdef HAS_URLDISPATCHER else if (profile == Menu::Phone) expected_action = "indicator.phone.open-calendar-app"; +#endif else expected_action = nullptr; @@ -322,6 +324,7 @@ private: g_clear_object(&submenu); } +#ifdef HAS_URLDISPATCHER void InspectPhoneAppointments(GMenuModel* menu_model, bool can_open_planner) { auto submenu = g_menu_model_get_item_link(menu_model, 0, G_MENU_LINK_SUBMENU); @@ -354,6 +357,7 @@ private: // cleanup g_clear_object(&submenu); } +#endif protected: @@ -371,6 +375,7 @@ protected: InspectEmptySection(menu_model, Menu::Appointments); break; +#ifdef HAS_URLDISPATCHER case Menu::Phone: InspectPhoneAppointments(menu_model, can_open_planner); break; @@ -378,6 +383,7 @@ protected: case Menu::PhoneGreeter: InspectEmptySection(menu_model, Menu::Appointments); break; +#endif default: g_warn_if_reached(); @@ -449,8 +455,10 @@ protected: if (profile == Menu::Desktop) expected_action = "indicator.desktop.open-settings-app"; +#ifdef HAS_URLDISPATCHER else if (profile == Menu::Phone) expected_action = "indicator.phone.open-settings-app"; +#endif // get the Settings section auto submenu = g_menu_model_get_item_link(menu_model, 0, G_MENU_LINK_SUBMENU); diff --git a/tests/timedated-fixture.h b/tests/timedated-fixture.h index 00269e0..07b3d9f 100644 --- a/tests/timedated-fixture.h +++ b/tests/timedated-fixture.h @@ -36,7 +36,9 @@ public: ~MockLiveActions() {} protected: +#ifdef HAS_URLDISPATCHER void dispatch_url(const std::string& url) override { last_url = url; } +#endif void execute_command(const std::string& cmd) override { last_cmd = cmd; } }; |