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_BATCH
NO_INSTALL NO_INSTALL
BUNDLE_ANDROID_OPENSSL_LIBS BUNDLE_ANDROID_OPENSSL_LIBS
NO_WASM_DEFAULT_FILES
PARENT_SCOPE PARENT_SCOPE
) )
set(${single_value_args} set(${single_value_args}
@ -587,6 +588,13 @@ function(qt_internal_add_test name)
endif() endif()
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) foreach(path IN LISTS arg_QML_IMPORTPATH)
list(APPEND extra_test_args "-import" "${path}") list(APPEND extra_test_args "-import" "${path}")
endforeach() endforeach()

View File

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

View File

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

View File

@ -21,7 +21,7 @@ class WidgetTestCase(unittest.TestCase):
def setUp(self): def setUp(self):
self._driver = Chrome(service=ChromeService(ChromeDriverManager().install())) self._driver = Chrome(service=ChromeService(ChromeDriverManager().install()))
self._driver.get( 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( self._test_sandbox_element = WebDriverWait(self._driver, 30).until(
presence_of_element_located((By.ID, 'test-sandbox')) presence_of_element_located((By.ID, 'test-sandbox'))
) )