From 6f1c3f7f25052c1f4c001e30bc8368359531af87 Mon Sep 17 00:00:00 2001 From: Ratchanan Srirattanamet Date: Thu, 7 Dec 2023 02:20:08 +0700 Subject: Bring back Lomiri-specific notification hints As discussed in [1], Lomiri has a custom logic in notification timeout and require the custom hint for timeout to work correctly. Restore the hints from commit 0a88a8d7 ("Remove osd-notify remnants and use native notification timeout"), while keeping the standard timeout in place. Lomiri will ignore standard timeout, while other DE's will ignore the extra hint. [1] https://gitlab.com/ubports/development/core/content-hub/-/merge_requests/32#note_1552217874 --- tests/notification-fixture.h | 2 ++ tests/test-sound.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/notification-fixture.h b/tests/notification-fixture.h index 33bcd7e..7dcc8bf 100644 --- a/tests/notification-fixture.h +++ b/tests/notification-fixture.h @@ -77,6 +77,8 @@ protected: static constexpr char const * SIGNAL_CLOSED {"NotificationClosed"}; + static constexpr char const * HINT_LOMIRI_TIMEOUT {"x-lomiri-snap-decisions-timeout"}; + static constexpr char const * AS_BUSNAME {"org.freedesktop.Accounts"}; static constexpr char const * AS_INTERFACE {"com.lomiri.touch.AccountsService.Sound"}; static constexpr char const * PROP_OTHER_VIBRATIONS {"OtherVibrate"}; diff --git a/tests/test-sound.cpp b/tests/test-sound.cpp index 19dffe3..db1402a 100644 --- a/tests/test-sound.cpp +++ b/tests/test-sound.cpp @@ -100,6 +100,16 @@ TEST_F(NotificationFixture, InteractiveDuration) g_variant_get_child (params, 7, "i", &i32); const auto duration = std::chrono::minutes(duration_minutes); EXPECT_EQ(std::chrono::duration_cast(duration).count(), i32); + + // Due to custom logic in Lomiri, also make sure custom timeout hint is set. + bool b; + auto hints = g_variant_get_child_value (params, 6); + i32 = 0; + b = g_variant_lookup (hints, HINT_LOMIRI_TIMEOUT, "i", &i32); + EXPECT_TRUE(b); + EXPECT_EQ(std::chrono::duration_cast(duration).count(), i32); + g_variant_unref(hints); + ne.reset(); } -- cgit v1.2.3