aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Mello <arthur.mello@canonical.com>2016-06-24 13:46:33 -0300
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-29 14:37:39 +0200
commit3adc4da86cb2edd9cb5ec667683f7b455562d2f1 (patch)
treeeaf13341cb27464158d1b1a5bd8c02038d01ec83
parent8ad06a88b53bcd0ac5d457a25f1161640da1d6bb (diff)
downloadayatana-indicator-datetime-3adc4da86cb2edd9cb5ec667683f7b455562d2f1.tar.gz
ayatana-indicator-datetime-3adc4da86cb2edd9cb5ec667683f7b455562d2f1.tar.bz2
ayatana-indicator-datetime-3adc4da86cb2edd9cb5ec667683f7b455562d2f1.zip
Do not fail test if GSettings schema is not installed
-rw-r--r--tests/test-settings.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/test-settings.cpp b/tests/test-settings.cpp
index 104750a..e8af7a0 100644
--- a/tests/test-settings.cpp
+++ b/tests/test-settings.cpp
@@ -50,7 +50,9 @@ protected:
{
super::SetUp();
- m_gsettings = g_settings_new(SETTINGS_INTERFACE);
+ if (g_settings_schema_source_lookup(source, SETTINGS_INTERFACE, true)) {
+ m_gsettings = g_settings_new(SETTINGS_INTERFACE);
+ }
if (ayatana_common_utils_is_lomiri())
{
@@ -153,6 +155,10 @@ TEST_F(SettingsFixture, HelloWorld)
TEST_F(SettingsFixture, BoolProperties)
{
+ if (!m_gsettings) {
+ return;
+ }
+
TestBoolProperty(m_gsettings, m_settings->show_seconds, SETTINGS_SHOW_SECONDS_S);
TestBoolProperty(m_gsettings, m_settings->show_calendar, SETTINGS_SHOW_CALENDAR_S);
TestBoolProperty(m_gsettings, m_settings->show_date, SETTINGS_SHOW_DATE_S);
@@ -166,6 +172,10 @@ TEST_F(SettingsFixture, BoolProperties)
TEST_F(SettingsFixture, UIntProperties)
{
+ if (!m_gsettings) {
+ return;
+ }
+
TestUIntProperty(m_gsettings, m_settings->alarm_duration, SETTINGS_ALARM_DURATION_S);
TestUIntProperty(m_gsettings, m_settings->alarm_volume, SETTINGS_ALARM_VOLUME_S);
TestUIntProperty(m_gsettings, m_settings->snooze_duration, SETTINGS_SNOOZE_DURATION_S);
@@ -173,6 +183,10 @@ TEST_F(SettingsFixture, UIntProperties)
TEST_F(SettingsFixture, StringProperties)
{
+ if (!m_gsettings) {
+ return;
+ }
+
TestStringProperty(m_gsettings, m_settings->custom_time_format, SETTINGS_CUSTOM_TIME_FORMAT_S);
TestStringProperty(m_gsettings, m_settings->timezone_name, SETTINGS_TIMEZONE_NAME_S);
TestStringProperty(m_gsettings, m_settings->alarm_sound, SETTINGS_ALARM_SOUND_S);
@@ -182,6 +196,10 @@ TEST_F(SettingsFixture, StringProperties)
TEST_F(SettingsFixture, TimeFormatMode)
{
+ if (!m_gsettings) {
+ return;
+ }
+
const auto key = SETTINGS_TIME_FORMAT_S;
const TimeFormatMode modes[] = { TIME_FORMAT_MODE_LOCALE_DEFAULT,
TIME_FORMAT_MODE_12_HOUR,
@@ -214,6 +232,10 @@ namespace
TEST_F(SettingsFixture, Locations)
{
+ if (!m_gsettings) {
+ return;
+ }
+
const auto key = SETTINGS_LOCATIONS_S;
const gchar* astrv[] = {"America/Los_Angeles Oakland", "America/Chicago Oklahoma City", "Europe/London London", nullptr};