From a87ed3b20459a9f067718e0212306008f2dfdaef Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Wed, 22 Nov 2023 21:28:00 +0100 Subject: Use different code path for Lomiri notifications --- tests/integration/indicator-sound-test-base.cpp | 8 +++++++- tests/notifications-mock.h | 2 +- tests/notifications-test.cc | 8 ++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/integration/indicator-sound-test-base.cpp b/tests/integration/indicator-sound-test-base.cpp index eb4ee8c..bec21b4 100644 --- a/tests/integration/indicator-sound-test-base.cpp +++ b/tests/integration/indicator-sound-test-base.cpp @@ -72,7 +72,7 @@ void IndicatorSoundTestBase::SetUp() "GetCapabilities", "", "as", - "ret = ['actions', 'body', 'body-markup', 'icon-static', 'image/svg+xml', 'private-synchronous', 'append', 'private-icon-only', 'truncation']" + "ret = ['actions', 'body', 'body-markup', 'icon-static', 'image/svg+xml', 'x-lomiri-private-synchronous', 'x-lomiri-private-icon-only', 'x-lomiri-truncation', 'private-synchronous', 'append', 'private-icon-only', 'truncation']" ).waitForFinished(); int waitedTime = 0; @@ -647,8 +647,14 @@ void IndicatorSoundTestBase::checkVolumeNotification(double volume, QString cons QVariantMap hints; ASSERT_TRUE(qDBusArgumentToMap(args.at(6), hints)); ASSERT_TRUE(hints.contains("value")); + ASSERT_TRUE (hints.contains ("x-lomiri-non-shaped-icon")); + ASSERT_TRUE (hints.contains ("x-lomiri-value-bar-tint")); + ASSERT_TRUE (hints.contains ("x-lomiri-private-synchronous")); EXPECT_EQ(volume*100, hints["value"]); + EXPECT_EQ (true, hints["x-lomiri-non-shaped-icon"]); + EXPECT_EQ (isLoud, hints["x-lomiri-value-bar-tint"]); + EXPECT_EQ (true, hints["x-lomiri-private-synchronous"]); } void IndicatorSoundTestBase::checkHighVolumeNotification(QVariantList call) diff --git a/tests/notifications-mock.h b/tests/notifications-mock.h index 3ae8da5..ef39d8c 100644 --- a/tests/notifications-mock.h +++ b/tests/notifications-mock.h @@ -31,7 +31,7 @@ class NotificationsMock DbusTestDbusMockObject * baseobj = nullptr; public: - NotificationsMock (const std::vector& capabilities = {"actions", "body", "body-markup", "icon-static", "image/svg+xml", "private-synchronous", "append", "private-icon-only", "truncation"}) { + NotificationsMock (const std::vector& capabilities = {"actions", "body", "body-markup", "icon-static", "image/svg+xml", "x-lomiri-private-synchronous", "x-lomiri-private-icon-only", "x-lomiri-truncation", "private-synchronous", "append", "private-icon-only", "truncation"}) { mock = dbus_test_dbus_mock_new("org.freedesktop.Notifications"); dbus_test_task_set_bus(DBUS_TEST_TASK(mock), DBUS_TEST_SERVICE_BUS_SESSION); dbus_test_task_set_name(DBUS_TEST_TASK(mock), "Notify"); diff --git a/tests/notifications-test.cc b/tests/notifications-test.cc index 0233ca6..c29c8fb 100644 --- a/tests/notifications-test.cc +++ b/tests/notifications-test.cc @@ -259,6 +259,7 @@ TEST_F(NotificationsTest, VolumeChanges) { EXPECT_EQ("ayatana-indicator-sound", notev[0].app_name); EXPECT_EQ("Volume", notev[0].summary); EXPECT_EQ(0, notev[0].actions.size()); + EXPECT_GVARIANT_EQ ("@s 'true'", notev[0].hints["x-lomiri-private-synchronous"]); EXPECT_GVARIANT_EQ("@i 50", notev[0].hints["value"]); /* Set a different volume */ @@ -431,6 +432,7 @@ TEST_F(NotificationsTest, DISABLED_HighVolume) { ASSERT_EQ(1, notev.size()); EXPECT_EQ("Volume", notev[0].summary); EXPECT_EQ("Speakers", notev[0].body); + EXPECT_GVARIANT_EQ ("@s 'false'", notev[0].hints["x-lomiri-value-bar-tint"]); /* Set high volume with volume change */ notifications->clearNotifications(); @@ -441,6 +443,7 @@ TEST_F(NotificationsTest, DISABLED_HighVolume) { ASSERT_LT(0, notev.size()); /* This passes with one or two since it would just be an update to the first if a second was sent */ EXPECT_EQ("Volume", notev[0].summary); EXPECT_EQ("Speakers", notev[0].body); + EXPECT_GVARIANT_EQ ("@s 'true'", notev[0].hints["x-lomiri-value-bar-tint"]); /* Move it back */ volume_warning_mock_set_high_volume(VOLUME_WARNING_MOCK(volumeWarning.get()), false); @@ -510,6 +513,7 @@ TEST_F(NotificationsTest, DISABLED_ExtendendVolumeNotification) { EXPECT_EQ("Volume", notev[0].summary); EXPECT_EQ(0, notev[0].actions.size()); EXPECT_GVARIANT_EQ("@i 50", notev[0].hints["value"]); + EXPECT_GVARIANT_EQ ("@s 'true'", notev[0].hints["x-lomiri-private-synchronous"]); /* Allow an amplified volume */ notifications->clearNotifications(); @@ -623,10 +627,14 @@ TEST_F(NotificationsTest, DISABLED_TriggerWarning) { if (warning_expected) { EXPECT_TRUE(volume_warning_get_active(volumeWarning.get())); ASSERT_EQ(1, notev.size()); + EXPECT_GVARIANT_EQ ("@s 'true'", notev[0].hints["x-lomiri-snap-decisions"]); + EXPECT_GVARIANT_EQ (nullptr, notev[0].hints["x-lomiri-private-synchronous"]); } else { EXPECT_FALSE(volume_warning_get_active(volumeWarning.get())); ASSERT_EQ(1, notev.size()); + EXPECT_GVARIANT_EQ (nullptr, notev[0].hints["x-lomiri-snap-decisions"]); + EXPECT_GVARIANT_EQ("@s 'true'", notev[0].hints["x-lomiri-private-synchronous"]); } } // multimedia_active -- cgit v1.2.3