diff options
author | Ted Gould <ted@gould.cx> | 2015-02-12 15:12:38 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2015-02-12 15:12:38 -0600 |
commit | 95fdfc766027896c19062f8b7e6d9589471be4b0 (patch) | |
tree | 30ff328c537643dab047ac193ed282f4ce2dffe5 | |
parent | e50350bd0bd5f85cf57cc1d42e6fb34c687063a4 (diff) | |
download | ayatana-indicator-sound-95fdfc766027896c19062f8b7e6d9589471be4b0.tar.gz ayatana-indicator-sound-95fdfc766027896c19062f8b7e6d9589471be4b0.tar.bz2 ayatana-indicator-sound-95fdfc766027896c19062f8b7e6d9589471be4b0.zip |
More notification testings.
-rw-r--r-- | tests/notifications-mock.h | 4 | ||||
-rw-r--r-- | tests/notifications-test.cc | 21 |
2 files changed, 20 insertions, 5 deletions
diff --git a/tests/notifications-mock.h b/tests/notifications-mock.h index b727eec..b0f3b74 100644 --- a/tests/notifications-mock.h +++ b/tests/notifications-mock.h @@ -148,4 +148,8 @@ class NotificationsMock return notifications; } + + bool clearNotifications (void) { + return dbus_test_dbus_mock_object_clear_method_calls(mock, baseobj, nullptr); + } }; diff --git a/tests/notifications-test.cc b/tests/notifications-test.cc index 3da41cd..06eac7a 100644 --- a/tests/notifications-test.cc +++ b/tests/notifications-test.cc @@ -126,14 +126,25 @@ TEST_F(NotificationsTest, VolumeChanges) { auto volumeControl = std::shared_ptr<VolumeControl>(VOLUME_CONTROL(volume_control_mock_new()), [](VolumeControl * control){g_clear_object(&control);}); auto soundService = std::shared_ptr<IndicatorSoundService>(indicator_sound_service_new(playerList.get(), volumeControl.get(), nullptr), [](IndicatorSoundService * service){g_clear_object(&service);}); - loop(50); - + /* Set a volume */ + notifications->clearNotifications(); volume_control_set_volume(volumeControl.get(), 50.0); - loop(50); - auto notev = notifications->getNotifications(); - ASSERT_EQ(1, notev.size()); EXPECT_EQ("indicator-sound", notev[0].app_name); + + /* Set a different volume */ + notifications->clearNotifications(); + volume_control_set_volume(volumeControl.get(), 60.0); + loop(50); + notev = notifications->getNotifications(); + ASSERT_EQ(1, notev.size()); + + /* Set the same volume */ + notifications->clearNotifications(); + volume_control_set_volume(volumeControl.get(), 60.0); + loop(50); + notev = notifications->getNotifications(); + ASSERT_EQ(0, notev.size()); } |