Skip to content

Commit 53fc5ba

Browse files
ply asset
1 parent a01cab4 commit 53fc5ba

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

1020 KB
Binary file not shown.

Tests/UnitTests/CMakeLists.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ set(SCRIPTS
55
set(TYPE_SCRIPTS
66
"Scripts/tests.ts")
77

8+
file(GLOB ASSETS "${CMAKE_CURRENT_SOURCE_DIR}/Assets/*")
9+
810
set(SOURCES
911
"Shared/Shared.cpp"
1012
"Shared/Shared.h")
@@ -25,6 +27,10 @@ if(APPLE)
2527
${SCRIPTS}
2628
${TYPE_SCRIPTS}
2729
PROPERTIES MACOSX_PACKAGE_LOCATION "Scripts")
30+
31+
set_source_files_properties(
32+
${ASSETS}
33+
PROPERTIES MACOSX_PACKAGE_LOCATION "Assets")
2834
else()
2935
set(SOURCES ${SOURCES}
3036
macOS/App.mm)
@@ -37,7 +43,7 @@ elseif(UNIX AND NOT ANDROID)
3743
Linux/App.cpp)
3844
endif()
3945

40-
add_executable(UnitTests ${SOURCES} ${SCRIPTS} ${TYPE_SCRIPTS})
46+
add_executable(UnitTests ${SOURCES} ${SCRIPTS} ${TYPE_SCRIPTS} ${ASSETS})
4147
target_compile_definitions(UnitTests PRIVATE JSRUNTIMEHOST_PLATFORM="${JSRUNTIMEHOST_PLATFORM}")
4248

4349
target_link_libraries(UnitTests
@@ -87,9 +93,17 @@ else()
8793
COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Scripts/symlink_target.js" "${CMAKE_CFG_INTDIR}/Scripts/symlink_1.js")
8894
add_custom_command(TARGET UnitTests POST_BUILD
8995
COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Scripts/symlink_1.js" "${CMAKE_CFG_INTDIR}/Scripts/symlink_2.js")
96+
97+
foreach(ASSET ${ASSETS})
98+
get_filename_component(ASSET_NAME "${ASSET}" NAME)
99+
add_custom_command(TARGET UnitTests POST_BUILD
100+
COMMAND "${CMAKE_COMMAND}" -E copy "${ASSET}" "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Assets/${ASSET_NAME}"
101+
COMMENT "Copying ${ASSET_NAME}")
102+
endforeach()
90103
endif()
91104

92105
set_property(TARGET UnitTests PROPERTY FOLDER Tests)
93106

94107
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES} ${SCRIPTS})
95108
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Scripts PREFIX scripts FILES ${TYPE_SCRIPTS})
109+
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Assets PREFIX assets FILES ${ASSETS})

Tests/UnitTests/Scripts/tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ describe("XMLHTTPRequest", function () {
199199

200200
it("should load a PLY file and parse vertex count from header using TextDecoder", async function () {
201201
this.timeout(30000);
202-
const xhr = await createRequest("GET", "https://assets.babylonjs.com/splats/Halo_Believe.ply", undefined, "arraybuffer");
202+
const xhr = await createRequest("GET", "app:///Assets/Halo_Believe.ply", undefined, "arraybuffer");
203203
expect(xhr.status).to.equal(200);
204204

205205
const ubuf = new Uint8Array(xhr.response);
@@ -209,7 +209,7 @@ describe("XMLHTTPRequest", function () {
209209
expect(headerEndIndex).to.be.greaterThan(0);
210210

211211
const vertexCount = parseInt(/element vertex (\d+)\n/.exec(header)![1]);
212-
expect(vertexCount).to.equal(345217);
212+
expect(vertexCount).to.equal(18713);
213213
});
214214
});
215215

0 commit comments

Comments
 (0)