aboutsummaryrefslogtreecommitdiff
path: root/tests/test-settings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-settings.cpp')
-rw-r--r--tests/test-settings.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test-settings.cpp b/tests/test-settings.cpp
index 707247d..44a0252 100644
--- a/tests/test-settings.cpp
+++ b/tests/test-settings.cpp
@@ -100,6 +100,29 @@ protected:
EXPECT_EQ(str, tmp);
g_clear_pointer(&tmp, g_free);
}
+
+ void TestUIntProperty(core::Property<unsigned int>& property, const gchar* key)
+ {
+ EXPECT_EQ(g_settings_get_uint(m_gsettings, key), property.get());
+
+ unsigned int expected_values[] = { 1, 2, 3 };
+
+ // modify GSettings and confirm that the new value is propagated
+ for(const auto& expected_value : expected_values)
+ {
+ g_settings_set_uint(m_gsettings, key, expected_value);
+ EXPECT_EQ(expected_value, property.get());
+ EXPECT_EQ(expected_value, g_settings_get_uint(m_gsettings, key));
+ }
+
+ // modify the property and confirm that the new value is propagated
+ for(const auto& expected_value : expected_values)
+ {
+ property.set(expected_value);
+ EXPECT_EQ(expected_value, property.get());
+ EXPECT_EQ(expected_value, g_settings_get_uint(m_gsettings, key));
+ }
+ }
};
/***
@@ -125,10 +148,17 @@ TEST_F(SettingsFixture, BoolProperties)
TestBoolProperty(m_settings->show_year, SETTINGS_SHOW_YEAR_S);
}
+TEST_F(SettingsFixture, UIntProperties)
+{
+ TestUIntProperty(m_settings->alarm_duration, SETTINGS_ALARM_DURATION_S);
+ TestUIntProperty(m_settings->alarm_volume, SETTINGS_ALARM_VOLUME_S);
+}
+
TEST_F(SettingsFixture, StringProperties)
{
TestStringProperty(m_settings->custom_time_format, SETTINGS_CUSTOM_TIME_FORMAT_S);
TestStringProperty(m_settings->timezone_name, SETTINGS_TIMEZONE_NAME_S);
+ TestStringProperty(m_settings->alarm_sound, SETTINGS_ALARM_SOUND_S);
}
TEST_F(SettingsFixture, TimeFormatMode)