aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2015-02-13 09:56:22 -0600
committerTed Gould <ted@gould.cx>2015-02-13 09:56:22 -0600
commit8159d6abf29c3618d2a3a7d8084f303d5a057594 (patch)
tree10790350f92c6921127ec8cc4e6a2d05c1516ed6 /tests
parent8ab16462724ab3108d1a16e3cea1c66a10ce775b (diff)
downloadayatana-indicator-sound-8159d6abf29c3618d2a3a7d8084f303d5a057594.tar.gz
ayatana-indicator-sound-8159d6abf29c3618d2a3a7d8084f303d5a057594.tar.bz2
ayatana-indicator-sound-8159d6abf29c3618d2a3a7d8084f303d5a057594.zip
Test stream change base cases
Diffstat (limited to 'tests')
-rw-r--r--tests/notifications-test.cc28
-rw-r--r--tests/volume-control-mock.vala4
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/notifications-test.cc b/tests/notifications-test.cc
index 2aff7ae..b43b691 100644
--- a/tests/notifications-test.cc
+++ b/tests/notifications-test.cc
@@ -186,3 +186,31 @@ TEST_F(NotificationsTest, VolumeChanges) {
notev = notifications->getNotifications();
ASSERT_EQ(0, notev.size());
}
+
+TEST_F(NotificationsTest, StreamChanges) {
+ auto volumeControl = volumeControlMock();
+ auto soundService = standardService(volumeControl, playerListMock());
+
+ /* Set a volume */
+ notifications->clearNotifications();
+ volume_control_set_volume(volumeControl.get(), 50.0);
+ loop(50);
+ auto notev = notifications->getNotifications();
+ ASSERT_EQ(1, notev.size());
+
+ /* Change Streams, no volume change */
+ notifications->clearNotifications();
+ volume_control_mock_set_mock_stream(VOLUME_CONTROL_MOCK(volumeControl.get()), "alarm");
+ volume_control_set_volume(volumeControl.get(), 50.0);
+ loop(50);
+ notev = notifications->getNotifications();
+ EXPECT_EQ(0, notev.size());
+
+ /* Change Streams, volume change */
+ notifications->clearNotifications();
+ volume_control_mock_set_mock_stream(VOLUME_CONTROL_MOCK(volumeControl.get()), "alert");
+ volume_control_set_volume(volumeControl.get(), 60.0);
+ loop(50);
+ notev = notifications->getNotifications();
+ EXPECT_EQ(0, notev.size());
+}
diff --git a/tests/volume-control-mock.vala b/tests/volume-control-mock.vala
index 4de5975..4b846bf 100644
--- a/tests/volume-control-mock.vala
+++ b/tests/volume-control-mock.vala
@@ -39,5 +39,9 @@ public class VolumeControlMock : VolumeControl
public VolumeControlMock() {
ready = true;
+ this.notify["mock-stream"].connect(() => this.notify_property("stream"));
+ this.notify["mock-high-volume"].connect(() => this.notify_property("high-volume"));
+ this.notify["mock-mute"].connect(() => this.notify_property("mute"));
+ this.notify["mock-is-playing"].connect(() => this.notify_property("is-playing"));
}
}