From 30b2de458752ad0855b508eb2f8ffeee85628cea Mon Sep 17 00:00:00 2001 From: Ratchanan Srirattanamet Date: Thu, 21 Dec 2023 19:16:35 +0700 Subject: src, tests: enable notification code path without Lomiri deps With the recent change, the notification code path is no longer Lomiri (or Ubuntu Touch) specific. Theres still some if-def's in the code to avoid adding dependendies in non-Lomiri case. --- tests/notification-fixture.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'tests/notification-fixture.h') diff --git a/tests/notification-fixture.h b/tests/notification-fixture.h index 7dcc8bf..5aedadc 100644 --- a/tests/notification-fixture.h +++ b/tests/notification-fixture.h @@ -77,7 +77,9 @@ protected: static constexpr char const * SIGNAL_CLOSED {"NotificationClosed"}; +#ifdef LOMIRI_FEATURES_ENABLED static constexpr char const * HINT_LOMIRI_TIMEOUT {"x-lomiri-snap-decisions-timeout"}; +#endif static constexpr char const * AS_BUSNAME {"org.freedesktop.Accounts"}; static constexpr char const * AS_INTERFACE {"com.lomiri.touch.AccountsService.Sound"}; @@ -312,20 +314,31 @@ protected: super::TearDown(); } - void make_interactive() + void mock_capabilities(bool mock_lomiri_caps = false) { // GetCapabilities returns an array containing 'actions', // so our notifications will be interactive. - // For this test, it means we should get an expire_timeout - // that matches duration_minutes + + #ifndef LOMIRI_FEATURES_ENABLED + g_assert_false(mock_lomiri_caps); + #endif + + std::string python_code = + std::string("ret = ['actions', 'body'") + + #ifdef LOMIRI_FEATURES_ENABLED + (mock_lomiri_caps ? std::string(", '") + HINT_LOMIRI_TIMEOUT + "'" : "") + + #endif + "]"; + GError * error = nullptr; dbus_test_dbus_mock_object_add_method(notify_mock, notify_obj, METHOD_GET_CAPS, nullptr, G_VARIANT_TYPE_STRING_ARRAY, - "ret = ['actions', 'body']", + python_code.c_str(), &error); + g_assert_no_error (error); } -- cgit v1.2.3