From 88e440bb1689063c6d47ac7a4965eb597a8ec9cb Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Thu, 11 Nov 2021 00:10:38 +0100 Subject: Clean up schema detection and conditional code --- tests/CMakeLists.txt | 8 +++++--- tests/dbus-types/CMakeLists.txt | 4 ++-- tests/integration/indicator-sound-test-base.cpp | 2 +- tests/service-mocks/CMakeLists.txt | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d0c0ac6..3e03a20 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -33,9 +33,11 @@ add_custom_target ( # and help the tests to find that file by setting -DSCHEMA_DIR set (XDG_DATA_DIRS "${CMAKE_CURRENT_BINARY_DIR}/gsettings-schemas") set (SCHEMA_DIR "${XDG_DATA_DIRS}/glib-2.0/schemas") -if (EXISTS /usr/share/glib-2.0/schemas/com.lomiri.sound.gschema.xml) - add_definitions ( -DHAS_LOMIRI_SOUND_SCHEMA ) + +if(LOMIRI_SCHEMAS_FOUND) + add_definitions ( -DHAS_LOMIRI_SCHEMAS ) endif() + add_definitions(-DSCHEMA_DIR="${SCHEMA_DIR}") execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE COMPILE_SCHEMA_EXECUTABLE @@ -322,7 +324,7 @@ add_test(indicator-test indicator-test ) -if (LOMIRI_API_FOUND AND EXISTS "/usr/share/glib-2.0/schemas/com.lomiri.sound.gschema.xml") +if (LOMIRI_API_FOUND AND LOMIRI_SCHEMAS_FOUND) add_subdirectory(integration) endif() add_subdirectory(dbus-types) diff --git a/tests/dbus-types/CMakeLists.txt b/tests/dbus-types/CMakeLists.txt index 1b6faed..9d7d3a2 100644 --- a/tests/dbus-types/CMakeLists.txt +++ b/tests/dbus-types/CMakeLists.txt @@ -14,7 +14,7 @@ set(dbusinterface_accounts_xml "org.freedesktop.Accounts.xml") set_source_files_properties(${dbusinterface_accounts_xml} PROPERTIES CLASSNAME AccountsInterface) -if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml") +if(LOMIRI_SCHEMAS_FOUND) set_source_files_properties("com.lomiri.AccountsService.Sound.xml" PROPERTIES CLASSNAME AccountsSoundInterface) endif() @@ -38,7 +38,7 @@ qt5_add_dbus_interface(interface_files ${dbusinterface_streamrestore_xml} stream qt5_add_dbus_interface(interface_files ${dbusinterface_properties_xml} dbus_properties_interface) qt5_add_dbus_interface(interface_files ${dbusinterface_accounts_xml} dbus_accounts_interface) -if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml") +if(LOMIRI_SCHEMAS_FOUND) qt5_add_dbus_interface("com.lomiri.AccountsService.Sound.xml" dbus_accountssound_interface) endif() diff --git a/tests/integration/indicator-sound-test-base.cpp b/tests/integration/indicator-sound-test-base.cpp index 3217764..f46d57f 100644 --- a/tests/integration/indicator-sound-test-base.cpp +++ b/tests/integration/indicator-sound-test-base.cpp @@ -179,7 +179,7 @@ bool IndicatorSoundTestBase::clearGSettingsPlayers() bool IndicatorSoundTestBase::resetAllowAmplifiedVolume() { -#if HAS_LOMIRI_SOUND_SCHEMA +#if HAS_LOMIRI_SCHEMAS QProcess proc; proc.start("gsettings", QStringList() diff --git a/tests/service-mocks/CMakeLists.txt b/tests/service-mocks/CMakeLists.txt index f604986..87221da 100644 --- a/tests/service-mocks/CMakeLists.txt +++ b/tests/service-mocks/CMakeLists.txt @@ -1,4 +1,4 @@ -if(EXISTS "/usr/share/accountsservice/interfaces/com.lomiri.AccountsService.Sound.xml") +if(LOMIRI_SCHEMAS_FOUND) add_subdirectory(accounts-mock) endif() add_subdirectory(media-player-mpris-mock) -- cgit v1.2.3