test(locale): test that languages are properly defined (#4220)

This commit is contained in:
ReenigneArcher 2025-08-31 12:56:05 -04:00 committed by GitHub
commit 2e8f1d4773
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 377 additions and 1 deletions

View file

@ -60,6 +60,7 @@ set(CONFIG_TEST_FILES
"src_assets/common/assets/web/config.html"
"docs/configuration.md"
"src_assets/common/assets/web/public/assets/locale/en.json"
"src_assets/common/assets/web/configs/tabs/General.vue"
)
foreach(file ${CONFIG_TEST_FILES})
@ -70,10 +71,25 @@ foreach(file ${CONFIG_TEST_FILES})
)
endforeach()
# Copy all locale files for locale consistency tests
# Use a custom command to properly handle both adding and removing files
set(LOCALE_SRC_DIR "${CMAKE_SOURCE_DIR}/src_assets/common/assets/web/public/assets/locale")
set(LOCALE_DST_DIR "${CMAKE_CURRENT_BINARY_DIR}/src_assets/common/assets/web/public/assets/locale")
add_custom_target(sync_locale_files ALL
COMMAND ${CMAKE_COMMAND} -E rm -rf "${LOCALE_DST_DIR}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${LOCALE_DST_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${LOCALE_SRC_DIR}" "${LOCALE_DST_DIR}"
COMMENT "Synchronizing locale files for tests"
VERBATIM
)
foreach(dep ${SUNSHINE_TARGET_DEPENDENCIES})
add_dependencies(${PROJECT_NAME} ${dep}) # compile these before sunshine
endforeach()
# Ensure locale files are synchronized before building the test executable
add_dependencies(${PROJECT_NAME} sync_locale_files)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 23)
target_link_libraries(${PROJECT_NAME}
${SUNSHINE_EXTERNAL_LIBRARIES}