From dbe04c9deb02ca81c43ca8dd2bb737473e4882de Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 24 Feb 2015 09:57:22 -0600 Subject: Adding a test for amplified volume --- tests/notifications-test.cc | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'tests/notifications-test.cc') diff --git a/tests/notifications-test.cc b/tests/notifications-test.cc index 88ed6c6..21a9312 100644 --- a/tests/notifications-test.cc +++ b/tests/notifications-test.cc @@ -356,3 +356,45 @@ TEST_F(NotificationsTest, HighVolume) { EXPECT_EQ("High volume", notev[0].body); EXPECT_GVARIANT_EQ("@s 'true'", notev[0].hints["x-canonical-value-bar-tint"]); } + +TEST_F(NotificationsTest, ExtendendVolumeNotification) { + auto volumeControl = volumeControlMock(); + auto soundService = standardService(volumeControl, playerListMock()); + + /* Set a volume */ + notifications->clearNotifications(); + setMockVolume(volumeControl, 0.50); + loop(50); + auto notev = notifications->getNotifications(); + ASSERT_EQ(1, notev.size()); + EXPECT_EQ("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-canonical-private-synchronous"]); + EXPECT_GVARIANT_EQ("@i 50", notev[0].hints["value"]); + + /* Allow an amplified volume */ + notifications->clearNotifications(); + indicator_sound_service_set_allow_amplified_volume(soundService.get(), TRUE); + loop(50); + notev = notifications->getNotifications(); + ASSERT_EQ(1, notev.size()); + EXPECT_GVARIANT_EQ("@i 33", notev[0].hints["value"]); + + /* Set to 'over max' */ + notifications->clearNotifications(); + setMockVolume(volumeControl, 1.525); + loop(50); + notev = notifications->getNotifications(); + ASSERT_EQ(1, notev.size()); + EXPECT_GVARIANT_EQ("@i 100", notev[0].hints["value"]); + + /* Put back */ + notifications->clearNotifications(); + indicator_sound_service_set_allow_amplified_volume(soundService.get(), FALSE); + loop(50); + notev = notifications->getNotifications(); + ASSERT_EQ(1, notev.size()); + EXPECT_GVARIANT_EQ("@i 100", notev[0].hints["value"]); +} + -- cgit v1.2.3