diff options
author | charles kerr <charlesk@canonical.com> | 2015-12-19 16:01:46 -0600 |
---|---|---|
committer | charles kerr <charlesk@canonical.com> | 2015-12-19 16:01:46 -0600 |
commit | 4b695bacf20b7247f6b16483ede5e5d8b51dd355 (patch) | |
tree | 498ae73530a5aba219866f129f0420f9fabfb18a /tests/notifications-test.cc | |
parent | aee4659081bbca43cb3e7d11bc3263e530876a86 (diff) | |
download | ayatana-indicator-sound-4b695bacf20b7247f6b16483ede5e5d8b51dd355.tar.gz ayatana-indicator-sound-4b695bacf20b7247f6b16483ede5e5d8b51dd355.tar.bz2 ayatana-indicator-sound-4b695bacf20b7247f6b16483ede5e5d8b51dd355.zip |
move max_volume into a reusable 'options' class
Diffstat (limited to 'tests/notifications-test.cc')
-rw-r--r-- | tests/notifications-test.cc | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/tests/notifications-test.cc b/tests/notifications-test.cc index c5d9770..26864cd 100644 --- a/tests/notifications-test.cc +++ b/tests/notifications-test.cc @@ -119,18 +119,27 @@ class NotificationsTest : public ::testing::Test return playerList; } - std::shared_ptr<VolumeControl> volumeControlMock () { + std::shared_ptr<IndicatorSoundOptions> optionsMock () { + auto options = std::shared_ptr<IndicatorSoundOptions>( + INDICATOR_SOUND_OPTIONS(options_mock_new()), + [](IndicatorSoundOptions * options){ + g_clear_object(&options); + }); + return options; + } + + std::shared_ptr<VolumeControl> volumeControlMock (const std::shared_ptr<IndicatorSoundOptions>& optionsMock) { auto volumeControl = std::shared_ptr<VolumeControl>( - VOLUME_CONTROL(volume_control_mock_new()), + VOLUME_CONTROL(volume_control_mock_new(optionsMock.get())), [](VolumeControl * control){ g_clear_object(&control); }); return volumeControl; } - std::shared_ptr<IndicatorSoundService> standardService (std::shared_ptr<VolumeControl> volumeControl, std::shared_ptr<MediaPlayerList> playerList) { + std::shared_ptr<IndicatorSoundService> standardService (std::shared_ptr<VolumeControl> volumeControl, std::shared_ptr<MediaPlayerList> playerList, const std::shared_ptr<IndicatorSoundOptions>& options) { auto soundService = std::shared_ptr<IndicatorSoundService>( - indicator_sound_service_new(playerList.get(), volumeControl.get(), nullptr), + indicator_sound_service_new(playerList.get(), volumeControl.get(), nullptr, options.get()), [](IndicatorSoundService * service){ g_clear_object(&service); }); @@ -168,7 +177,9 @@ class NotificationsTest : public ::testing::Test }; TEST_F(NotificationsTest, BasicObject) { - auto soundService = standardService(volumeControlMock(), playerListMock()); + auto options = optionsMock(); + auto volumeControl = volumeControlMock(options); + auto soundService = standardService(volumeControl, playerListMock(), options); /* Give some time settle */ loop(50); @@ -177,8 +188,9 @@ TEST_F(NotificationsTest, BasicObject) { } TEST_F(NotificationsTest, VolumeChanges) { - auto volumeControl = volumeControlMock(); - auto soundService = standardService(volumeControl, playerListMock()); + auto options = optionsMock(); + auto volumeControl = volumeControlMock(options); + auto soundService = standardService(volumeControl, playerListMock(), options); /* Set a volume */ notifications->clearNotifications(); @@ -216,8 +228,9 @@ TEST_F(NotificationsTest, VolumeChanges) { } TEST_F(NotificationsTest, StreamChanges) { - auto volumeControl = volumeControlMock(); - auto soundService = standardService(volumeControl, playerListMock()); + auto options = optionsMock(); + auto volumeControl = volumeControlMock(options); + auto soundService = standardService(volumeControl, playerListMock(), options); /* Set a volume */ notifications->clearNotifications(); @@ -254,8 +267,9 @@ TEST_F(NotificationsTest, StreamChanges) { } TEST_F(NotificationsTest, IconTesting) { - auto volumeControl = volumeControlMock(); - auto soundService = standardService(volumeControl, playerListMock()); + auto options = optionsMock(); + auto volumeControl = volumeControlMock(options); + auto soundService = standardService(volumeControl, playerListMock(), options); /* Set an initial volume */ notifications->clearNotifications(); @@ -288,8 +302,9 @@ TEST_F(NotificationsTest, IconTesting) { } TEST_F(NotificationsTest, ServerRestart) { - auto volumeControl = volumeControlMock(); - auto soundService = standardService(volumeControl, playerListMock()); + auto options = optionsMock(); + auto volumeControl = volumeControlMock(options); + auto soundService = standardService(volumeControl, playerListMock(), options); /* Set a volume */ notifications->clearNotifications(); @@ -335,8 +350,9 @@ TEST_F(NotificationsTest, ServerRestart) { } TEST_F(NotificationsTest, HighVolume) { - auto volumeControl = volumeControlMock(); - auto soundService = standardService(volumeControl, playerListMock()); + auto options = optionsMock(); + auto volumeControl = volumeControlMock(options); + auto soundService = standardService(volumeControl, playerListMock(), options); /* Set a volume */ notifications->clearNotifications(); @@ -377,8 +393,9 @@ TEST_F(NotificationsTest, HighVolume) { } TEST_F(NotificationsTest, MenuHide) { - auto volumeControl = volumeControlMock(); - auto soundService = standardService(volumeControl, playerListMock()); + auto options = optionsMock(); + auto volumeControl = volumeControlMock(options); + auto soundService = standardService(volumeControl, playerListMock(), options); /* Set a volume */ notifications->clearNotifications(); @@ -407,8 +424,9 @@ TEST_F(NotificationsTest, MenuHide) { } TEST_F(NotificationsTest, DISABLED_ExtendendVolumeNotification) { - auto volumeControl = volumeControlMock(); - auto soundService = standardService(volumeControl, playerListMock()); + auto options = optionsMock(); + auto volumeControl = volumeControlMock(options); + auto soundService = standardService(volumeControl, playerListMock(), options); /* Set a volume */ notifications->clearNotifications(); |