146
146
volume_control_set_volume(volumeControl.get(), vol);
147
147
g_object_unref(vol);
150
void setIndicatorShown (bool shown) {
151
auto bus = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, nullptr);
153
g_dbus_connection_call(bus,
154
g_dbus_connection_get_unique_name(bus),
155
"/com/canonical/indicator/sound",
158
g_variant_new("(sva{sv})", "indicator-shown", g_variant_new_boolean(shown), nullptr),
160
G_DBUS_CALL_FLAGS_NONE,
166
g_clear_object(&bus);
151
170
TEST_F(NotificationsTest, BasicObject) {
357
376
EXPECT_GVARIANT_EQ("@s 'true'", notev[0].hints["x-canonical-value-bar-tint"]);
379
TEST_F(NotificationsTest, MenuHide) {
380
auto volumeControl = volumeControlMock();
381
auto soundService = standardService(volumeControl, playerListMock());
384
notifications->clearNotifications();
385
setMockVolume(volumeControl, 0.50);
387
auto notev = notifications->getNotifications();
388
EXPECT_EQ(1, notev.size());
390
/* Set the indicator to shown, and set a new volume */
391
notifications->clearNotifications();
392
setIndicatorShown(true);
394
setMockVolume(volumeControl, 0.60);
396
notev = notifications->getNotifications();
397
EXPECT_EQ(0, notev.size());
399
/* Set the indicator to hidden, and set a new volume */
400
notifications->clearNotifications();
401
setIndicatorShown(false);
403
setMockVolume(volumeControl, 0.70);
405
notev = notifications->getNotifications();
406
EXPECT_EQ(1, notev.size());
360
409
TEST_F(NotificationsTest, ExtendendVolumeNotification) {
361
410
auto volumeControl = volumeControlMock();
362
411
auto soundService = standardService(volumeControl, playerListMock());