From 95fdfc766027896c19062f8b7e6d9589471be4b0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 12 Feb 2015 15:12:38 -0600 Subject: More notification testings. --- tests/notifications-mock.h | 4 ++++ tests/notifications-test.cc | 21 ++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) (limited to 'tests') 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(VOLUME_CONTROL(volume_control_mock_new()), [](VolumeControl * control){g_clear_object(&control);}); auto soundService = std::shared_ptr(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()); } -- cgit v1.2.3