diff options
Diffstat (limited to 'tests')
22 files changed, 194 insertions, 31 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 13dd0d8..4aaee45 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -77,23 +77,40 @@ target_link_libraries (${TEST_NAME} indicatordatetimeservice ${SERVICE_DEPS_LIBR find_program(DBUS_RUNNER dbus-test-runner) -function(add_eds_ics_test_by_name name) - set (TEST_NAME ${name}) - set (COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} ${TEST_NAME} PARENT_SCOPE) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}.ics.in" - "${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.ics") - add_executable(${TEST_NAME} ${TEST_NAME}.cpp gschemas.compiled) - target_link_options(${TEST_NAME} PRIVATE -no-pie) - target_link_libraries (${TEST_NAME} indicatordatetimeservice ${DBUSTEST_LIBRARIES} ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES}) - add_test (${TEST_NAME} - ${CMAKE_CURRENT_SOURCE_DIR}/run-eds-ics-test.sh - ${DBUS_RUNNER} # arg1: dbus-test-runner exec - ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} # arg2: test executable path - ${TEST_NAME} # arg3: test name - ${CMAKE_CURRENT_SOURCE_DIR}/test-eds-ics-config-files # arg4: base directory for config file template - ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.ics # arg5: the ical file for this test - ${CMAKE_CURRENT_SOURCE_DIR}/accounts.db) # arg6: online accounts database -endfunction() +if (ENABLE_LOMIRI_FEATURES) + function(add_eds_ics_test_by_name name) + set (TEST_NAME ${name}) + set (COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} ${TEST_NAME} PARENT_SCOPE) + add_executable(${TEST_NAME} ${TEST_NAME}.cpp gschemas.compiled) + target_link_options(${TEST_NAME} PRIVATE -no-pie) + target_link_libraries (${TEST_NAME} indicatordatetimeservice ${DBUSTEST_LIBRARIES} ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES}) + add_test (${TEST_NAME} + ${CMAKE_CURRENT_SOURCE_DIR}/run-mkcal-db-test.sh + ${DBUS_RUNNER} # arg1: dbus-test-runner exec + ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} # arg2: test executable path + ${TEST_NAME} # arg3: test name + ${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}.db # arg4: the database file for this test + ${CMAKE_CURRENT_SOURCE_DIR}/accounts.db) # arg5: online accounts database + endfunction() +else () + function(add_eds_ics_test_by_name name) + set (TEST_NAME ${name}) + set (COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} ${TEST_NAME} PARENT_SCOPE) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}.ics.in" + "${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.ics") + add_executable(${TEST_NAME} ${TEST_NAME}.cpp gschemas.compiled) + target_link_options(${TEST_NAME} PRIVATE -no-pie) + target_link_libraries (${TEST_NAME} indicatordatetimeservice ${DBUSTEST_LIBRARIES} ${SERVICE_DEPS_LIBRARIES} ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES}) + add_test (${TEST_NAME} + ${CMAKE_CURRENT_SOURCE_DIR}/run-eds-ics-test.sh + ${DBUS_RUNNER} # arg1: dbus-test-runner exec + ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} # arg2: test executable path + ${TEST_NAME} # arg3: test name + ${CMAKE_CURRENT_SOURCE_DIR}/test-eds-ics-config-files # arg4: base directory for config file template + ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.ics # arg5: the ical file for this test + ${CMAKE_CURRENT_SOURCE_DIR}/accounts.db) # arg6: online accounts database + endfunction() +endif () add_eds_ics_test_by_name(test-eds-ics-all-day-events) add_eds_ics_test_by_name(test-eds-ics-repeating-events) add_eds_ics_test_by_name(test-eds-ics-nonrepeating-events) diff --git a/tests/run-eds-ics-test.sh b/tests/run-eds-ics-test.sh index 4cbc0d3..01ebc48 100755 --- a/tests/run-eds-ics-test.sh +++ b/tests/run-eds-ics-test.sh @@ -50,21 +50,21 @@ if [ -d ${CONFIG_DIR} ]; then fi # if there's a specific ics file to test, copy it on top of the canned config files -if [ -e ${ICS_FILE} ]; then +if [ -e "${ICS_FILE}" ]; then echo "copying ${ICS_FILE} into $HOME" mkdir -p ${XDG_DATA_HOME}/evolution/tasks/system/ - cp --verbose --archive ${ICS_FILE} ${XDG_DATA_HOME}/evolution/tasks/system/tasks.ics + cp --verbose --archive "${ICS_FILE}" ${XDG_DATA_HOME}/evolution/tasks/system/tasks.ics fi # prepare online accounts database -if [ -e ${ACCOUNTS_DB} ]; then +if [ -e "${ACCOUNTS_DB}" ]; then echo "copying ${ACCOUNTS_DB} into $HOME" mkdir -p ${XDG_CONFIG_HOME}/libaccounts-glib/ - cp --verbose --archive ${ACCOUNTS_DB} ${XDG_CONFIG_HOME}/libaccounts-glib/accounts.db + cp --verbose --archive "${ACCOUNTS_DB}" ${XDG_CONFIG_HOME}/libaccounts-glib/accounts.db fi # run the test -${TEST_RUNNER} --keep-env --max-wait=90 --task ${TEST_EXEC} --task-name ${TEST_NAME} --wait-until-complete +${TEST_RUNNER} --keep-env --max-wait=90 --task "${TEST_EXEC}" --task-name ${TEST_NAME} --wait-until-complete rv=$? # if the test passed, blow away the tmpdir diff --git a/tests/run-mkcal-db-test.sh b/tests/run-mkcal-db-test.sh new file mode 100644 index 0000000..114b9bd --- /dev/null +++ b/tests/run-mkcal-db-test.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +SELF=$0 # this script +TEST_RUNNER=$1 # full executable path of dbus-test-runner +TEST_EXEC=$2 # full executable path of test app +TEST_NAME=$3 # test name +DB_FILE=$4 # database file holding test data +ACCOUNTS_DB=$5 # online account database + +echo "this script: ${SELF}" +echo "test-runner: ${TEST_RUNNER}" +echo "test-exec: ${TEST_EXEC}" +echo "test-name: ${TEST_NAME}" +echo "db-file: ${DB_FILE}" + +# set up the tmpdir +export TEST_TMP_DIR=$(mktemp -p "${TMPDIR:-/tmp}" -d ${TEST_NAME}-XXXXXXXXXX) || exit 1 +echo "running test '${TEST_NAME}' in ${TEST_TMP_DIR}" + +# set up the environment variables +export QT_QPA_PLATFORM=minimal +export HOME=${TEST_TMP_DIR} +export XDG_RUNTIME_DIR=${TEST_TMP_DIR} +export XDG_CACHE_HOME=${TEST_TMP_DIR}/.cache +export XDG_CONFIG_HOME=${TEST_TMP_DIR}/.config +export XDG_DATA_HOME=${TEST_TMP_DIR}/.local/share +export XDG_DESKTOP_DIR=${TEST_TMP_DIR} +export XDG_DOCUMENTS_DIR=${TEST_TMP_DIR} +export XDG_DOWNLOAD_DIR=${TEST_TMP_DIR} +export XDG_MUSIC_DIR=${TEST_TMP_DIR} +export XDG_PICTURES_DIR=${TEST_TMP_DIR} +export XDG_PUBLICSHARE_DIR=${TEST_TMP_DIR} +export XDG_TEMPLATES_DIR=${TEST_TMP_DIR} +export XDG_VIDEOS_DIR=${TEST_TMP_DIR} +export GIO_USE_VFS=local # needed to ensure GVFS shuts down cleanly after the test is over + +export G_MESSAGES_DEBUG=all +export G_DBUS_DEBUG=messages + +echo HOMEDIR=${HOME} +rm -rf ${XDG_DATA_HOME} + +# if there's a specific db file to test, copy it +if [ -e "${DB_FILE}" ]; then + echo "copying ${DB_FILE} into $HOME" + mkdir -p ${XDG_DATA_HOME}/system/privileged/Calendar/mkcal/ + cp --verbose --archive "${DB_FILE}" ${XDG_DATA_HOME}/system/privileged/Calendar/mkcal/db +fi + +# prepare online accounts database +if [ -e "${ACCOUNTS_DB}" ]; then + echo "copying ${ACCOUNTS_DB} into $HOME" + mkdir -p ${XDG_CONFIG_HOME}/libaccounts-glib/ + cp --verbose --archive "${ACCOUNTS_DB}" ${XDG_CONFIG_HOME}/libaccounts-glib/accounts.db +fi + +# run the test +${TEST_RUNNER} --keep-env --max-wait=90 --task "${TEST_EXEC}" --task-name ${TEST_NAME} --wait-until-complete +rv=$? + +# if the test passed, blow away the tmpdir +if [ $rv -eq 0 ]; then + sleep 5 + rm -rf $TEST_TMP_DIR +fi + +# pass the test's return code to the caller. +exit "$rv" diff --git a/tests/test-eds-ics-alarm-custom-sound.db b/tests/test-eds-ics-alarm-custom-sound.db Binary files differnew file mode 100755 index 0000000..f5ba86d --- /dev/null +++ b/tests/test-eds-ics-alarm-custom-sound.db diff --git a/tests/test-eds-ics-all-day-events.cpp b/tests/test-eds-ics-all-day-events.cpp index 0fa40fd..e38c7c7 100644 --- a/tests/test-eds-ics-all-day-events.cpp +++ b/tests/test-eds-ics-all-day-events.cpp @@ -80,7 +80,11 @@ TEST_F(VAlarmFixture, MultipleAppointments) // what we expect to get... Appointment expected_appt; +#ifndef LOMIRI_FEATURES_ENABLED expected_appt.uid = "20150521T111538Z-7449-1000-3572-0@ghidorah"; +#else + expected_appt.uid = "51340540-a924-468e-b3ee-0c0f222cd0f8"; +#endif expected_appt.summary = "Memorial Day"; expected_appt.begin = DateTime{gtz,2015,5,25,0,0,0}; expected_appt.end = DateTime{gtz,2015,5,26,0,0,0}; @@ -98,7 +102,11 @@ TEST_F(VAlarmFixture, MultipleAppointments) EXPECT_PRED3([](auto sColourIn, auto sColourExpected1, auto sColourExpected2) { return sColourIn == sColourExpected1 || sColourIn == sColourExpected2; +#ifndef LOMIRI_FEATURES_ENABLED }, appt.color, "#becedd", "#62a0ea"); +#else + }, appt.color, "#0000FF", ""); +#endif // cleanup g_time_zone_unref(gtz); diff --git a/tests/test-eds-ics-all-day-events.db b/tests/test-eds-ics-all-day-events.db Binary files differnew file mode 100644 index 0000000..f297366 --- /dev/null +++ b/tests/test-eds-ics-all-day-events.db diff --git a/tests/test-eds-ics-missing-trigger.cpp b/tests/test-eds-ics-missing-trigger.cpp index 4030999..69ca109 100644 --- a/tests/test-eds-ics-missing-trigger.cpp +++ b/tests/test-eds-ics-missing-trigger.cpp @@ -1,6 +1,6 @@ /* * Copyright 2015 Canonical Ltd. - * Copyright 2021-2024 Robert Tari + * Copyright 2021-2025 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -82,8 +82,13 @@ TEST_F(VAlarmFixture, MissingTriggers) std::vector<Appointment> expected1; Appointment a1; a1.type = Appointment::ALARM; +#ifndef LOMIRI_FEATURES_ENABLED a1.uid = "20150617T211838Z-6217-32011-2036-1@lomiri-phablet"; a1.color = "#becedd"; +#else + a1.uid = "a0121159-8810-434f-9066-cc3b71e3793f"; + a1.color = "#0000FF"; +#endif a1.summary = "One Time Alarm"; a1.begin = DateTime { gtz, 2015, 6, 18, 10, 0, 0}; a1.end = a1.begin; @@ -94,7 +99,11 @@ TEST_F(VAlarmFixture, MissingTriggers) expected1.push_back(a1); // build expected: recurring alarm 1 +#ifndef LOMIRI_FEATURES_ENABLED a1.uid = "20150617T211913Z-6217-32011-2036-5@lomiri-phablet"; +#else + a1.uid = "3b45cbc9-d5c3-49a4-ad29-acc776818259"; +#endif a1.summary = "Recurring Alarm"; a1.alarms[0].text = a1.summary; std::array<DateTime,13> recurrences { @@ -121,8 +130,13 @@ TEST_F(VAlarmFixture, MissingTriggers) std::vector<Appointment> expected2; Appointment a2; a2.type = Appointment::ALARM; +#ifndef LOMIRI_FEATURES_ENABLED a2.uid = "20150617T211838Z-6217-32011-2036-1@lomiri-phablet"; a2.color = "#62a0ea"; +#else + a2.uid = "a0121159-8810-434f-9066-cc3b71e3793f"; + a2.color = ""; +#endif a2.summary = "One Time Alarm"; a2.begin = DateTime { gtz, 2015, 6, 18, 10, 0, 0}; a2.end = a2.begin; @@ -133,7 +147,11 @@ TEST_F(VAlarmFixture, MissingTriggers) expected2.push_back(a2); // build expected: recurring alarm 2 +#ifndef LOMIRI_FEATURES_ENABLED a2.uid = "20150617T211913Z-6217-32011-2036-5@lomiri-phablet"; +#else + a2.uid = "3b45cbc9-d5c3-49a4-ad29-acc776818259"; +#endif a2.summary = "Recurring Alarm"; a2.alarms[0].text = a2.summary; for (const auto& time : recurrences) { diff --git a/tests/test-eds-ics-missing-trigger.db b/tests/test-eds-ics-missing-trigger.db Binary files differnew file mode 100755 index 0000000..0be974d --- /dev/null +++ b/tests/test-eds-ics-missing-trigger.db diff --git a/tests/test-eds-ics-non-attending-alarms.db b/tests/test-eds-ics-non-attending-alarms.db Binary files differnew file mode 100644 index 0000000..fae3aaf --- /dev/null +++ b/tests/test-eds-ics-non-attending-alarms.db diff --git a/tests/test-eds-ics-nonrepeating-events.cpp b/tests/test-eds-ics-nonrepeating-events.cpp index 49fc9be..c126dba 100644 --- a/tests/test-eds-ics-nonrepeating-events.cpp +++ b/tests/test-eds-ics-nonrepeating-events.cpp @@ -1,6 +1,6 @@ /* * Copyright 2015 Canonical Ltd. - * Copyright 2021-2024 Robert Tari + * Copyright 2021-2025 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -80,7 +80,11 @@ TEST_F(VAlarmFixture, MultipleAppointments) // what we expect to get... Appointment expected_appt; +#ifndef LOMIRI_FEATURES_ENABLED expected_appt.uid = "20150520T000726Z-3878-32011-1770-81@lomiri-phablet"; +#else + expected_appt.uid = "d7aeb192-8b2c-4427-834f-f30388e9e73c"; +#endif expected_appt.summary = "Alarm"; std::array<Alarm,1> expected_alarms = { Alarm({"Alarm", "file://" ALARM_DEFAULT_SOUND, DateTime(gtz,2015,5,20,20,00,0)}) @@ -99,7 +103,11 @@ TEST_F(VAlarmFixture, MultipleAppointments) EXPECT_PRED3([](auto sColourIn, auto sColourExpected1, auto sColourExpected2) { return sColourIn == sColourExpected1 || sColourIn == sColourExpected2; + #ifndef LOMIRI_FEATURES_ENABLED }, appt.color, "#becedd", "#62a0ea"); + #else + }, appt.color, "#0000FF", ""); + #endif } // cleanup diff --git a/tests/test-eds-ics-nonrepeating-events.db b/tests/test-eds-ics-nonrepeating-events.db Binary files differnew file mode 100644 index 0000000..4170aff --- /dev/null +++ b/tests/test-eds-ics-nonrepeating-events.db diff --git a/tests/test-eds-ics-repeating-events-with-individual-change.db b/tests/test-eds-ics-repeating-events-with-individual-change.db Binary files differnew file mode 100755 index 0000000..6ca01a7 --- /dev/null +++ b/tests/test-eds-ics-repeating-events-with-individual-change.db diff --git a/tests/test-eds-ics-repeating-events.cpp b/tests/test-eds-ics-repeating-events.cpp index a570d0f..701f8da 100644 --- a/tests/test-eds-ics-repeating-events.cpp +++ b/tests/test-eds-ics-repeating-events.cpp @@ -1,6 +1,6 @@ /* * Copyright 2015 Canonical Ltd. - * Copyright 2021-2024 Robert Tari + * Copyright 2021-2025 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -80,7 +80,11 @@ TEST_F(VAlarmFixture, MultipleAppointments) // what we expect to get... Appointment expected_appt; +#ifndef LOMIRI_FEATURES_ENABLED expected_appt.uid = "20150507T211449Z-4262-32011-1418-1@lomiri-phablet"; +#else + expected_appt.uid = "840ab899-1b0e-4697-9514-dcd336a5e125"; +#endif expected_appt.summary = "Alarm"; std::array<Alarm,8> expected_alarms = { Alarm({"Alarm", "file://" ALARM_DEFAULT_SOUND, DateTime(gtz,2015,5, 8,16,40,0)}), @@ -106,7 +110,11 @@ TEST_F(VAlarmFixture, MultipleAppointments) EXPECT_PRED3([](auto sColourIn, auto sColourExpected1, auto sColourExpected2) { return sColourIn == sColourExpected1 || sColourIn == sColourExpected2; + #ifndef LOMIRI_FEATURES_ENABLED }, appt.color, "#becedd", "#62a0ea"); + #else + }, appt.color, "#0000FF", ""); + #endif } // cleanup diff --git a/tests/test-eds-ics-repeating-events.db b/tests/test-eds-ics-repeating-events.db Binary files differnew file mode 100644 index 0000000..ac9a0ea --- /dev/null +++ b/tests/test-eds-ics-repeating-events.db diff --git a/tests/test-eds-ics-repeating-valarms.db b/tests/test-eds-ics-repeating-valarms.db Binary files differnew file mode 100644 index 0000000..361fffc --- /dev/null +++ b/tests/test-eds-ics-repeating-valarms.db diff --git a/tests/test-eds-ics-tzids-2.cpp b/tests/test-eds-ics-tzids-2.cpp index 1bef68b..aff9de7 100644 --- a/tests/test-eds-ics-tzids-2.cpp +++ b/tests/test-eds-ics-tzids-2.cpp @@ -1,6 +1,6 @@ /* * Copyright 2015 Canonical Ltd. - * Copyright 2021-2024 Robert Tari + * Copyright 2021-2025 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -81,8 +81,13 @@ TEST_F(VAlarmFixture, MultipleAppointments) // what we expect to get... std::array<Appointment,1> expected_appts1; auto appt1 = &expected_appts1[0]; +#ifndef LOMIRI_FEATURES_ENABLED appt1->uid = "109264742"; appt1->color = "#becedd"; +#else + appt1->uid = "4eade898-ffd4-49d6-a43a-c6ca9c20aace"; + appt1->color = "#0000FF"; +#endif appt1->summary = "National Incubator Initiative for Clean Energy (NIICE) FOA: Pre-Concept Paper Informational Webinar"; appt1->begin = DateTime{gtz,2014,1,21,11,0,0}; appt1->end = DateTime{gtz,2014,1,21,13,0,0}; @@ -90,8 +95,13 @@ TEST_F(VAlarmFixture, MultipleAppointments) std::array<Appointment,1> expected_appts2; auto appt2 = &expected_appts2[0]; +#ifndef LOMIRI_FEATURES_ENABLED appt2->uid = "109264742"; appt2->color = "#62a0ea"; +#else + appt2->uid = "4eade898-ffd4-49d6-a43a-c6ca9c20aace"; + appt2->color = ""; +#endif appt2->summary = "National Incubator Initiative for Clean Energy (NIICE) FOA: Pre-Concept Paper Informational Webinar"; appt2->begin = DateTime{gtz,2014,1,21,11,0,0}; appt2->end = DateTime{gtz,2014,1,21,13,0,0}; diff --git a/tests/test-eds-ics-tzids-2.db b/tests/test-eds-ics-tzids-2.db Binary files differnew file mode 100644 index 0000000..5e2b62d --- /dev/null +++ b/tests/test-eds-ics-tzids-2.db diff --git a/tests/test-eds-ics-tzids-utc.cpp b/tests/test-eds-ics-tzids-utc.cpp index d88e95d..8226061 100644 --- a/tests/test-eds-ics-tzids-utc.cpp +++ b/tests/test-eds-ics-tzids-utc.cpp @@ -1,6 +1,6 @@ /* * Copyright 2015 Canonical Ltd. - * Copyright 2021-2024 Robert Tari + * Copyright 2021-2025 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -82,16 +82,26 @@ TEST_F(VAlarmFixture, UTCAppointments) // what we expect to get... std::array<Appointment,1> expected_appts1; auto appt1 = &expected_appts1[0]; +#ifndef LOMIRI_FEATURES_ENABLED appt1->uid = "20160322T132738Z"; appt1->color = "#becedd"; +#else + appt1->uid = "17ea8f73-4965-4a9c-9add-4a026a86ec60"; + appt1->color = "#0000FF"; +#endif appt1->summary = "UTC event"; appt1->begin = DateTime{gtz,2016,3,22,15,0,0}; appt1->end = DateTime{gtz,2016,3,22,16,0,0}; std::array<Appointment,1> expected_appts2; auto appt2 = &expected_appts2[0]; +#ifndef LOMIRI_FEATURES_ENABLED appt2->uid = "20160322T132738Z"; appt2->color = "#62a0ea"; +#else + appt2->uid = "17ea8f73-4965-4a9c-9add-4a026a86ec60"; + appt2->color = ""; +#endif appt2->summary = "UTC event"; appt2->begin = DateTime{gtz,2016,3,22,15,0,0}; appt2->end = DateTime{gtz,2016,3,22,16,0,0}; diff --git a/tests/test-eds-ics-tzids-utc.db b/tests/test-eds-ics-tzids-utc.db Binary files differnew file mode 100644 index 0000000..5bc6bad --- /dev/null +++ b/tests/test-eds-ics-tzids-utc.db diff --git a/tests/test-eds-ics-tzids.cpp b/tests/test-eds-ics-tzids.cpp index 4999e66..e676001 100644 --- a/tests/test-eds-ics-tzids.cpp +++ b/tests/test-eds-ics-tzids.cpp @@ -1,6 +1,6 @@ /* * Copyright 2015 Canonical Ltd. - * Copyright 2021-2024 Robert Tari + * Copyright 2021-2025 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -81,16 +81,26 @@ TEST_F(VAlarmFixture, MultipleAppointments) // what we expect to get... std::array<Appointment,1> expected_appts1; auto appt1 = &expected_appts1[0]; +#ifndef LOMIRI_FEATURES_ENABLED appt1->uid = "8ggc30kh89qql8vjumgtug7l14@google.com"; appt1->color = "#becedd"; +#else + appt1->uid = "01fd35a6-8fbb-4c31-97e1-71d920190f18"; + appt1->color = "#0000FF"; +#endif appt1->summary = "Hello"; appt1->begin = DateTime{gtz,2015,7,1,20,0,0}; appt1->end = DateTime{gtz,2015,7,1,22,0,0}; std::array<Appointment,1> expected_appts2; auto appt2 = &expected_appts2[0]; +#ifndef LOMIRI_FEATURES_ENABLED appt2->uid = "8ggc30kh89qql8vjumgtug7l14@google.com"; appt2->color = "#62a0ea"; +#else + appt2->uid = "01fd35a6-8fbb-4c31-97e1-71d920190f18"; + appt2->color = ""; +#endif appt2->summary = "Hello"; appt2->begin = DateTime{gtz,2015,7,1,20,0,0}; appt2->end = DateTime{gtz,2015,7,1,22,0,0}; diff --git a/tests/test-eds-ics-tzids.db b/tests/test-eds-ics-tzids.db Binary files differnew file mode 100644 index 0000000..cf18ab3 --- /dev/null +++ b/tests/test-eds-ics-tzids.db diff --git a/tests/test-timezones.cpp b/tests/test-timezones.cpp index 7144aaf..1cbab16 100644 --- a/tests/test-timezones.cpp +++ b/tests/test-timezones.cpp @@ -1,5 +1,6 @@ /* * Copyright 2013 Canonical Ltd. + * Copyright 2025 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -15,6 +16,7 @@ * * Authors: * Charles Kerr <charles.kerr@canonical.com> + * Robert Tari <robert@tari.in> */ #include "geoclue-fixture.h" @@ -39,9 +41,13 @@ namespace void set_file(const std::string& text) { auto fp = fopen(TIMEZONE_FILE, "w+"); - fprintf(fp, "%s\n", text.c_str()); - fclose(fp); - sync(); + + if (fp) + { + fprintf(fp, "%s\n", text.c_str()); + fclose(fp); + sync(); + } } } |