diff options
author | Ratchanan Srirattanamet <ratchanan@ubports.com> | 2023-12-21 19:16:35 +0700 |
---|---|---|
committer | Ratchanan Srirattanamet <ratchanan@ubports.com> | 2023-12-26 20:35:22 +0000 |
commit | 30b2de458752ad0855b508eb2f8ffeee85628cea (patch) | |
tree | f365be20c8095738d4f3aff8b2acdcb22c00c9c1 /tests/notification-fixture.h | |
parent | 6f1c3f7f25052c1f4c001e30bc8368359531af87 (diff) | |
download | ayatana-indicator-datetime-30b2de458752ad0855b508eb2f8ffeee85628cea.tar.gz ayatana-indicator-datetime-30b2de458752ad0855b508eb2f8ffeee85628cea.tar.bz2 ayatana-indicator-datetime-30b2de458752ad0855b508eb2f8ffeee85628cea.zip |
src, tests: enable notification code path without Lomiri depspersonal/peat-psuwit/bring-back-lomiri-hints
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.
Diffstat (limited to 'tests/notification-fixture.h')
-rw-r--r-- | tests/notification-fixture.h | 21 |
1 files changed, 17 insertions, 4 deletions
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); } |