diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-07-01 09:36:57 +0000 |
---|---|---|
committer | CI bot <ps-jenkins@lists.canonical.com> | 2014-07-01 09:36:57 +0000 |
commit | 6ad9b8d2449c745953a1692b27e8d2b993a722d6 (patch) | |
tree | d0ce34b82460f52322d3bc9215fc7d989e642731 /tests/test-settings.cpp | |
parent | 6880613bbc6535242e95e7f5c65d9a9140eaa28b (diff) | |
parent | 194e79302027047ae36146f6ec4e7c0e9c1d2fc2 (diff) | |
download | ayatana-indicator-datetime-6ad9b8d2449c745953a1692b27e8d2b993a722d6.tar.gz ayatana-indicator-datetime-6ad9b8d2449c745953a1692b27e8d2b993a722d6.tar.bz2 ayatana-indicator-datetime-6ad9b8d2449c745953a1692b27e8d2b993a722d6.zip |
Expose the new alarm settings as DBus properties. Fixes: 1318997
Diffstat (limited to 'tests/test-settings.cpp')
-rw-r--r-- | tests/test-settings.cpp | 46 |
1 files changed, 11 insertions, 35 deletions
diff --git a/tests/test-settings.cpp b/tests/test-settings.cpp index 2b500b2..44a0252 100644 --- a/tests/test-settings.cpp +++ b/tests/test-settings.cpp @@ -101,26 +101,26 @@ protected: g_clear_pointer(&tmp, g_free); } - void TestIntProperty(core::Property<int>& property, const gchar* key) + void TestUIntProperty(core::Property<unsigned int>& property, const gchar* key) { - EXPECT_EQ(g_settings_get_int(m_gsettings, key), property.get()); + EXPECT_EQ(g_settings_get_uint(m_gsettings, key), property.get()); - int expected_values[] = { 1, 2, 3 }; + unsigned int expected_values[] = { 1, 2, 3 }; // modify GSettings and confirm that the new value is propagated - for(const int& expected_value : expected_values) + for(const auto& expected_value : expected_values) { - g_settings_set_int(m_gsettings, key, expected_value); + g_settings_set_uint(m_gsettings, key, expected_value); EXPECT_EQ(expected_value, property.get()); - EXPECT_EQ(expected_value, g_settings_get_int(m_gsettings, key)); + EXPECT_EQ(expected_value, g_settings_get_uint(m_gsettings, key)); } // modify the property and confirm that the new value is propagated - for(const int& expected_value : expected_values) + for(const auto& expected_value : expected_values) { property.set(expected_value); EXPECT_EQ(expected_value, property.get()); - EXPECT_EQ(expected_value, g_settings_get_int(m_gsettings, key)); + EXPECT_EQ(expected_value, g_settings_get_uint(m_gsettings, key)); } } }; @@ -148,9 +148,10 @@ TEST_F(SettingsFixture, BoolProperties) TestBoolProperty(m_settings->show_year, SETTINGS_SHOW_YEAR_S); } -TEST_F(SettingsFixture, IntProperties) +TEST_F(SettingsFixture, UIntProperties) { - TestIntProperty(m_settings->alarm_duration, SETTINGS_ALARM_DURATION_S); + TestUIntProperty(m_settings->alarm_duration, SETTINGS_ALARM_DURATION_S); + TestUIntProperty(m_settings->alarm_volume, SETTINGS_ALARM_VOLUME_S); } TEST_F(SettingsFixture, StringProperties) @@ -181,31 +182,6 @@ TEST_F(SettingsFixture, TimeFormatMode) } } -TEST_F(SettingsFixture, AlarmVolume) -{ - const auto key = SETTINGS_ALARM_VOLUME_S; - const AlarmVolume volumes[] = { ALARM_VOLUME_VERY_QUIET, - ALARM_VOLUME_QUIET, - ALARM_VOLUME_NORMAL, - ALARM_VOLUME_LOUD, - ALARM_VOLUME_VERY_LOUD }; - - for(const auto& val : volumes) - { - g_settings_set_enum(m_gsettings, key, val); - EXPECT_EQ(val, m_settings->alarm_volume.get()); - EXPECT_EQ(val, g_settings_get_enum(m_gsettings, key)); - } - - for(const auto& val : volumes) - { - m_settings->alarm_volume.set(val); - EXPECT_EQ(val, m_settings->alarm_volume.get()); - EXPECT_EQ(val, g_settings_get_enum(m_gsettings, key)); - } -} - - namespace { std::vector<std::string> strv_to_vector(const gchar** strv) |