diff options
-rw-r--r-- | src/settings-live.cpp | 30 | ||||
-rw-r--r-- | tests/test-notification.cpp | 4 | ||||
-rw-r--r-- | tests/test-sound.cpp | 12 |
3 files changed, 41 insertions, 5 deletions
diff --git a/src/settings-live.cpp b/src/settings-live.cpp index f908c05..39d8e18 100644 --- a/src/settings-live.cpp +++ b/src/settings-live.cpp @@ -299,27 +299,47 @@ void LiveSettings::update_snooze_duration() void LiveSettings::update_cal_notification_enabled() { - cal_notification_enabled.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_ENABLED_KEY)); + if (m_settings_cal_notification) { + cal_notification_enabled.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_ENABLED_KEY)); + } else { + cal_notification_enabled.set(true); + } } void LiveSettings::update_cal_notification_sounds() { - cal_notification_sounds.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_SOUNDS_KEY)); + if (m_settings_cal_notification) { + cal_notification_sounds.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_SOUNDS_KEY)); + } else { + cal_notification_sounds.set(true); + } } void LiveSettings::update_cal_notification_vibrations() { - cal_notification_vibrations.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_VIBRATIONS_KEY)); + if (m_settings_cal_notification) { + cal_notification_vibrations.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_VIBRATIONS_KEY)); + } else { + cal_notification_vibrations.set(true); + } } void LiveSettings::update_cal_notification_bubbles() { - cal_notification_bubbles.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_BUBBLES_KEY)); + if (m_settings_cal_notification) { + cal_notification_bubbles.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_BUBBLES_KEY)); + } else { + cal_notification_bubbles.set(true); + } } void LiveSettings::update_cal_notification_list() { - cal_notification_list.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_LIST_KEY)); + if (m_settings_cal_notification) { + cal_notification_list.set(g_settings_get_boolean(m_settings_cal_notification, SETTINGS_NOTIFY_LIST_KEY)); + } else { + cal_notification_list.set(true); + } } /*** diff --git a/tests/test-notification.cpp b/tests/test-notification.cpp index b84c6f8..58c0760 100644 --- a/tests/test-notification.cpp +++ b/tests/test-notification.cpp @@ -119,6 +119,10 @@ TEST_F(NotificationFixture,Notification) // set test case properties: cal_notification_enabled settings->cal_notification_enabled.set(test_disabled.cal_notification_enabled); + settings->cal_notification_sounds.set(test_disabled.cal_notification_enabled); + settings->cal_notification_vibrations.set(test_disabled.cal_notification_enabled); + settings->cal_notification_bubbles.set(test_disabled.cal_notification_enabled); + settings->cal_notification_list.set(test_disabled.cal_notification_enabled); // set test case properties: haptic mode settings->alarm_haptic.set(test_haptic.haptic_mode); diff --git a/tests/test-sound.cpp b/tests/test-sound.cpp index 9dbd212..f808db6 100644 --- a/tests/test-sound.cpp +++ b/tests/test-sound.cpp @@ -59,6 +59,12 @@ TEST_F(NotificationFixture, InteractiveDuration) auto sb = std::make_shared<ayatana::indicator::notifications::DefaultSoundBuilder>(); auto snap = create_snap(ne, sb, settings); + settings->cal_notification_enabled.set(true); + settings->cal_notification_sounds.set(true); + settings->cal_notification_vibrations.set(true); + settings->cal_notification_bubbles.set(true); + settings->cal_notification_list.set(true); + make_interactive(); // call the Snap Decision @@ -150,6 +156,12 @@ TEST_F(NotificationFixture,DefaultSounds) auto sb = std::make_shared<TestSoundBuilder>(); auto func = [this](const Appointment&, const Alarm&, const Snap::Response&){g_idle_add(quit_idle, loop);}; + settings->cal_notification_enabled.set(true); + settings->cal_notification_sounds.set(true); + settings->cal_notification_vibrations.set(true); + settings->cal_notification_bubbles.set(true); + settings->cal_notification_list.set(true); + const struct { Appointment appointment; std::string expected_role; |