Skip to content

Commit 2e8f1d4

Browse files
test(locale): test that languages are properly defined (#4220)
1 parent 14fc19d commit 2e8f1d4

File tree

3 files changed

+377
-1
lines changed

3 files changed

+377
-1
lines changed

.github/copilot-instructions.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ You need to prefix commands with `C:\msys64\msys2_shell.cmd -defterm -here -no-s
33

44
Prefix build directories with `cmake-build-`.
55

6-
The test executable is named `test_sunshine`
6+
The test executable is named `test_sunshine` and will be located inside the `tests` directory within
7+
the build directory.
8+
9+
The project uses gtest as a test framework.
710

811
Always follow the style guidelines defined in .clang-format for c/c++ code.

tests/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ set(CONFIG_TEST_FILES
6060
"src_assets/common/assets/web/config.html"
6161
"docs/configuration.md"
6262
"src_assets/common/assets/web/public/assets/locale/en.json"
63+
"src_assets/common/assets/web/configs/tabs/General.vue"
6364
)
6465

6566
foreach(file ${CONFIG_TEST_FILES})
@@ -70,10 +71,25 @@ foreach(file ${CONFIG_TEST_FILES})
7071
)
7172
endforeach()
7273

74+
# Copy all locale files for locale consistency tests
75+
# Use a custom command to properly handle both adding and removing files
76+
set(LOCALE_SRC_DIR "${CMAKE_SOURCE_DIR}/src_assets/common/assets/web/public/assets/locale")
77+
set(LOCALE_DST_DIR "${CMAKE_CURRENT_BINARY_DIR}/src_assets/common/assets/web/public/assets/locale")
78+
add_custom_target(sync_locale_files ALL
79+
COMMAND ${CMAKE_COMMAND} -E rm -rf "${LOCALE_DST_DIR}"
80+
COMMAND ${CMAKE_COMMAND} -E make_directory "${LOCALE_DST_DIR}"
81+
COMMAND ${CMAKE_COMMAND} -E copy_directory "${LOCALE_SRC_DIR}" "${LOCALE_DST_DIR}"
82+
COMMENT "Synchronizing locale files for tests"
83+
VERBATIM
84+
)
85+
7386
foreach(dep ${SUNSHINE_TARGET_DEPENDENCIES})
7487
add_dependencies(${PROJECT_NAME} ${dep}) # compile these before sunshine
7588
endforeach()
7689

90+
# Ensure locale files are synchronized before building the test executable
91+
add_dependencies(${PROJECT_NAME} sync_locale_files)
92+
7793
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 23)
7894
target_link_libraries(${PROJECT_NAME}
7995
${SUNSHINE_EXTERNAL_LIBRARIES}

0 commit comments

Comments
 (0)