wasm: Fix conflict usage for tst_qwasmwindow_harness.html

There is a default tst_qwasmwindow_harness.html created, and we have
our own in addition. This creates problems if one runs configure
and do not perform a clean build afterwards as we would be
left with the autogenerated file.

The solution is to rename our custom file so that there is
no conflict.

Change-Id: I1f0436eea752059d4dcf22407c760339eed46c09
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
This commit is contained in:
Even Oscar Andersen 2024-06-24 11:41:45 +02:00
parent 00ce86a908
commit cd78cf27a1
5 changed files with 42 additions and 31 deletions

View File

@ -217,6 +217,7 @@ function(qt_internal_get_test_arg_definitions optional_args single_value_args mu
NO_BATCH
NO_INSTALL
BUNDLE_ANDROID_OPENSSL_LIBS
NO_WASM_DEFAULT_FILES
PARENT_SCOPE
)
set(${single_value_args}
@ -587,6 +588,13 @@ function(qt_internal_add_test name)
endif()
endif()
if (arg_NO_WASM_DEFAULT_FILES)
set_target_properties(
${name}
PROPERTIES
NO_WASM_DEFAULT_FILES True)
endif()
foreach(path IN LISTS arg_QML_IMPORTPATH)
list(APPEND extra_test_args "-import" "${path}")
endforeach()

View File

@ -56,41 +56,43 @@ function(_qt_internal_wasm_add_target_helpers target)
configure_file("${WASM_BUILD_DIR}/libexec/util.js"
"${target_output_directory}/util.js" COPYONLY)
else()
get_target_property(no_wasm_files ${target} NO_WASM_DEFAULT_FILES)
if(target_output_directory)
set(_target_directory "${target_output_directory}")
else()
set(_target_directory "${CMAKE_CURRENT_BINARY_DIR}")
endif()
configure_file("${WASM_BUILD_DIR}/plugins/platforms/wasm_shell.html"
"${_target_directory}/${_target_output_name}.html" @ONLY)
if(CMAKE_CONFIGURATION_TYPES) # if multiconfig generator
add_custom_command(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${_target_directory}/${_target_output_name}.html"
${_target_directory}/$<CONFIG>/${_target_output_name}.html
)
add_custom_command(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${WASM_BUILD_DIR}/plugins/platforms/qtloader.js"
${_target_directory}/$<CONFIG>/qtloader.js
)
add_custom_command(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${WASM_BUILD_DIR}/plugins/platforms/qtlogo.svg"
${_target_directory}/$<CONFIG>/qtlogo.svg
)
else()
configure_file("${WASM_BUILD_DIR}/plugins/platforms/qtloader.js"
${_target_directory}/qtloader.js COPYONLY)
configure_file("${WASM_BUILD_DIR}/plugins/platforms/qtlogo.svg"
${_target_directory}/qtlogo.svg COPYONLY)
if (NOT no_wasm_files)
configure_file("${WASM_BUILD_DIR}/plugins/platforms/wasm_shell.html"
"${_target_directory}/${_target_output_name}.html" @ONLY)
if(CMAKE_CONFIGURATION_TYPES) # if multiconfig generator
add_custom_command(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${_target_directory}/${_target_output_name}.html"
${_target_directory}/$<CONFIG>/${_target_output_name}.html
)
add_custom_command(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${WASM_BUILD_DIR}/plugins/platforms/qtloader.js"
${_target_directory}/$<CONFIG>/qtloader.js
)
add_custom_command(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${WASM_BUILD_DIR}/plugins/platforms/qtlogo.svg"
${_target_directory}/$<CONFIG>/qtlogo.svg
)
else()
configure_file("${WASM_BUILD_DIR}/plugins/platforms/qtloader.js"
${_target_directory}/qtloader.js COPYONLY)
configure_file("${WASM_BUILD_DIR}/plugins/platforms/qtlogo.svg"
${_target_directory}/qtlogo.svg COPYONLY)
endif()
endif()
endif()
if(QT_FEATURE_thread)

View File

@ -9,6 +9,7 @@ endif()
qt_internal_add_test(tst_qwasmwindow_harness
MANUAL
NO_BATCH
NO_WASM_DEFAULT_FILES
SOURCES
tst_qwasmwindow_harness.cpp
LIBRARIES
@ -50,8 +51,8 @@ qt_internal_create_test_script(NAME tst_qwasmwindow_harness
add_custom_command(
TARGET tst_qwasmwindow_harness POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/tst_qwasmwindow_harness.html
${CMAKE_CURRENT_BINARY_DIR}/tst_qwasmwindow_harness.html
${CMAKE_CURRENT_SOURCE_DIR}/tst_qwasmwindow_harness_run.html
${CMAKE_CURRENT_BINARY_DIR}/tst_qwasmwindow_harness_run.html
)
add_custom_command(

View File

@ -21,7 +21,7 @@ class WidgetTestCase(unittest.TestCase):
def setUp(self):
self._driver = Chrome(service=ChromeService(ChromeDriverManager().install()))
self._driver.get(
'http://localhost:8001/tst_qwasmwindow_harness.html')
'http://localhost:8001/tst_qwasmwindow_harness_run.html')
self._test_sandbox_element = WebDriverWait(self._driver, 30).until(
presence_of_element_located((By.ID, 'test-sandbox'))
)