diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-07-31 17:17:53 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2014-07-31 17:17:53 -0500 |
commit | 56d881413ffaa171d4367bb968f5454988e2737e (patch) | |
tree | eb8e7bd230153a9aab43789a707dd409bbfbd975 | |
parent | 8afa4ba3102138f245fba704eba03b907edefa2b (diff) | |
download | ayatana-indicator-datetime-56d881413ffaa171d4367bb968f5454988e2737e.tar.gz ayatana-indicator-datetime-56d881413ffaa171d4367bb968f5454988e2737e.tar.bz2 ayatana-indicator-datetime-56d881413ffaa171d4367bb968f5454988e2737e.zip |
configurable haptic mode, part 3 of 3: expose the new haptic mode setting as a DBus property; sync exporter tests
-rw-r--r-- | data/com.canonical.indicator.datetime.AlarmProperties.xml | 9 | ||||
-rw-r--r-- | src/exporter.cpp | 1 | ||||
-rw-r--r-- | tests/test-exporter.cpp | 12 |
3 files changed, 22 insertions, 0 deletions
diff --git a/data/com.canonical.indicator.datetime.AlarmProperties.xml b/data/com.canonical.indicator.datetime.AlarmProperties.xml index d25fa82..9b38af9 100644 --- a/data/com.canonical.indicator.datetime.AlarmProperties.xml +++ b/data/com.canonical.indicator.datetime.AlarmProperties.xml @@ -11,6 +11,15 @@ </doc:doc> </property> + <property name="HapticFeedback" type="s" access="readwrite"> + <doc:doc> + <doc:description> + <doc:para>What kind of haptic feedback, if any, to trigger with an alarm.</doc:para> + <doc:para>Two modes are currently supported: 'pulse', 'none'.</doc:para> + </doc:description> + </doc:doc> + </property> + <property name="DefaultVolume" type="i" access="readwrite"> <doc:doc> <doc:description> diff --git a/src/exporter.cpp b/src/exporter.cpp index 88aee2f..1d45705 100644 --- a/src/exporter.cpp +++ b/src/exporter.cpp @@ -144,6 +144,7 @@ private: bind_uint_property(m_alarm_props, "duration", m_settings->alarm_duration); bind_uint_property(m_alarm_props, "default-volume", m_settings->alarm_volume); bind_string_property(m_alarm_props, "default-sound", m_settings->alarm_sound); + bind_string_property(m_alarm_props, "haptic-feedback", m_settings->alarm_haptic); } /*** diff --git a/tests/test-exporter.cpp b/tests/test-exporter.cpp index 2e3411a..96665cf 100644 --- a/tests/test-exporter.cpp +++ b/tests/test-exporter.cpp @@ -186,26 +186,35 @@ TEST_F(ExporterFixture, AlarmProperties) auto expected_volume = 1; int expected_duration = 60; const char * expected_sound = "/tmp/foo.wav"; + const char * expected_haptic = "pulse"; settings->alarm_volume.set(expected_volume); settings->alarm_duration.set(expected_duration); settings->alarm_sound.set(expected_sound); + settings->alarm_haptic.set(expected_haptic); wait_msec(); static constexpr const char* const SOUND_PROP {"default-sound"}; static constexpr const char* const VOLUME_PROP {"default-volume"}; static constexpr const char* const DURATION_PROP {"duration"}; + static constexpr const char* const HAPTIC_PROP {"haptic-feedback"}; char* sound = nullptr; + char* haptic = nullptr; int volume = -1; int duration = -1; g_object_get(proxy, SOUND_PROP, &sound, + HAPTIC_PROP, &haptic, VOLUME_PROP, &volume, DURATION_PROP, &duration, nullptr); EXPECT_STREQ(expected_sound, sound); + EXPECT_STREQ(expected_haptic, haptic); EXPECT_EQ(expected_volume, volume); EXPECT_EQ(expected_duration, duration); + g_clear_pointer (&sound, g_free); + g_clear_pointer (&haptic, g_free); + /*** **** Try chaning the DBus properties -- do the Settings change to match it? ***/ @@ -213,13 +222,16 @@ TEST_F(ExporterFixture, AlarmProperties) expected_volume = 100; expected_duration = 30; expected_sound = "/tmp/bar.wav"; + expected_haptic = "none"; g_object_set(proxy, SOUND_PROP, expected_sound, + HAPTIC_PROP, expected_haptic, VOLUME_PROP, expected_volume, DURATION_PROP, expected_duration, nullptr); wait_msec(); EXPECT_STREQ(expected_sound, settings->alarm_sound.get().c_str()); + EXPECT_STREQ(expected_haptic, settings->alarm_haptic.get().c_str()); EXPECT_EQ(expected_volume, settings->alarm_volume.get()); EXPECT_EQ(expected_duration, settings->alarm_duration.get()); |