aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2015-02-27 22:36:17 +0000
committerCI Train Bot <ci-train-bot@canonical.com>2015-02-27 22:36:17 +0000
commitcf091c3e612c41dc8e430f6029e7a6ec62a8f703 (patch)
treebde30e01d0ddaee3323780682f6521839dcd7854 /tests
parentdff67f240ebfc9fe842383d612948597517d3c83 (diff)
parente5a30aa5678ccf55884691e6c8f35cb439d1a3de (diff)
downloadayatana-indicator-sound-cf091c3e612c41dc8e430f6029e7a6ec62a8f703.tar.gz
ayatana-indicator-sound-cf091c3e612c41dc8e430f6029e7a6ec62a8f703.tar.bz2
ayatana-indicator-sound-cf091c3e612c41dc8e430f6029e7a6ec62a8f703.zip
Switch to an internal variable to track blocking notifications
Approved by: Charles Kerr, PS Jenkins bot
Diffstat (limited to 'tests')
-rw-r--r--tests/notifications-test.cc50
1 files changed, 49 insertions, 1 deletions
diff --git a/tests/notifications-test.cc b/tests/notifications-test.cc
index 21a9312..1f7e178 100644
--- a/tests/notifications-test.cc
+++ b/tests/notifications-test.cc
@@ -146,6 +146,25 @@ class NotificationsTest : public ::testing::Test
volume_control_set_volume(volumeControl.get(), vol);
g_object_unref(vol);
}
+
+ void setIndicatorShown (bool shown) {
+ auto bus = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, nullptr);
+
+ g_dbus_connection_call(bus,
+ g_dbus_connection_get_unique_name(bus),
+ "/com/canonical/indicator/sound",
+ "org.gtk.Actions",
+ "SetState",
+ g_variant_new("(sva{sv})", "indicator-shown", g_variant_new_boolean(shown), nullptr),
+ nullptr,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ nullptr,
+ nullptr,
+ nullptr);
+
+ g_clear_object(&bus);
+ }
};
TEST_F(NotificationsTest, BasicObject) {
@@ -357,6 +376,36 @@ TEST_F(NotificationsTest, HighVolume) {
EXPECT_GVARIANT_EQ("@s 'true'", notev[0].hints["x-canonical-value-bar-tint"]);
}
+TEST_F(NotificationsTest, MenuHide) {
+ auto volumeControl = volumeControlMock();
+ auto soundService = standardService(volumeControl, playerListMock());
+
+ /* Set a volume */
+ notifications->clearNotifications();
+ setMockVolume(volumeControl, 0.50);
+ loop(50);
+ auto notev = notifications->getNotifications();
+ EXPECT_EQ(1, notev.size());
+
+ /* Set the indicator to shown, and set a new volume */
+ notifications->clearNotifications();
+ setIndicatorShown(true);
+ loop(50);
+ setMockVolume(volumeControl, 0.60);
+ loop(50);
+ notev = notifications->getNotifications();
+ EXPECT_EQ(0, notev.size());
+
+ /* Set the indicator to hidden, and set a new volume */
+ notifications->clearNotifications();
+ setIndicatorShown(false);
+ loop(50);
+ setMockVolume(volumeControl, 0.70);
+ loop(50);
+ notev = notifications->getNotifications();
+ EXPECT_EQ(1, notev.size());
+}
+
TEST_F(NotificationsTest, ExtendendVolumeNotification) {
auto volumeControl = volumeControlMock();
auto soundService = standardService(volumeControl, playerListMock());
@@ -397,4 +446,3 @@ TEST_F(NotificationsTest, ExtendendVolumeNotification) {
ASSERT_EQ(1, notev.size());
EXPECT_GVARIANT_EQ("@i 100", notev[0].hints["value"]);
}
-