aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArthur Mello <arthur.mello@canonical.com>2016-06-24 13:46:33 -0300
committerRobert Tari <robert@tari.in>2021-07-08 01:07:56 +0200
commitfbef2857a3034d72d2afe9878900979dab3df27d (patch)
treea229f56410327557ef217cd74c1ad9f3edc3c5b6 /tests
parent6a78e3849eadf536e526b9f49613881ef1bc7cdb (diff)
downloadayatana-indicator-datetime-fbef2857a3034d72d2afe9878900979dab3df27d.tar.gz
ayatana-indicator-datetime-fbef2857a3034d72d2afe9878900979dab3df27d.tar.bz2
ayatana-indicator-datetime-fbef2857a3034d72d2afe9878900979dab3df27d.zip
Do not fail test if GSettings schema is not installed
Diffstat (limited to 'tests')
-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};