From 0a830ab17d5bec44dbef27565d702c6cdbf33b68 Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Mon, 27 Apr 2026 19:38:27 +0800 Subject: [PATCH] Clean up gaussian splat test runtime roots --- ...本科生毕业论文(设计)参考模板(2024315).doc | Bin 162 -> 0 bytes .../unit/test_render_resource_cache.cpp | 29 +++++++++++++--- .../test_gaussian_splat_loader.cpp | 32 +++++++++++++++--- 3 files changed, 52 insertions(+), 9 deletions(-) delete mode 100644 docs/毕设/~$大学本科生毕业论文(设计)参考模板(2024315).doc diff --git a/docs/毕设/~$大学本科生毕业论文(设计)参考模板(2024315).doc b/docs/毕设/~$大学本科生毕业论文(设计)参考模板(2024315).doc deleted file mode 100644 index c0459ad2b2bc9614709423ed5bf4cda7abafd87c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 162 ccmZRzFf%kaV;~W*GFUK}F&HwK14&u~02e$0BLDyZ diff --git a/tests/Rendering/unit/test_render_resource_cache.cpp b/tests/Rendering/unit/test_render_resource_cache.cpp index e624abfa..a3d78532 100644 --- a/tests/Rendering/unit/test_render_resource_cache.cpp +++ b/tests/Rendering/unit/test_render_resource_cache.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include using namespace XCEngine::Math; @@ -402,9 +403,28 @@ GaussianSplat BuildSampleGaussianSplat(const char* artifactPath) { return gaussianSplat; } -std::filesystem::path CreateTestProjectRoot(const char* folderName) { - return std::filesystem::current_path() / "__xc_gaussian_splat_cache_test_runtime" / folderName; -} +class ScopedTestProjectRoot final { +public: + explicit ScopedTestProjectRoot(const char* folderName) + : m_runtimeRoot(std::filesystem::temp_directory_path() / "xcengine_gaussian_splat_cache_test_runtime") + , m_projectRoot(m_runtimeRoot / folderName) { + std::error_code ec; + std::filesystem::remove_all(m_projectRoot, ec); + } + + ~ScopedTestProjectRoot() { + std::error_code ec; + std::filesystem::remove_all(m_runtimeRoot, ec); + } + + const std::filesystem::path& GetPath() const { + return m_projectRoot; + } + +private: + std::filesystem::path m_runtimeRoot; + std::filesystem::path m_projectRoot; +}; TEST(RenderResourceCacheTest, GetOrCreateGaussianSplatUploadsStructuredSectionsAndReusesEntry) { GaussianSplat gaussianSplat = BuildSampleGaussianSplat("sample.xcgsplat"); @@ -507,7 +527,8 @@ TEST(RenderResourceCacheTest, GetOrCreateGaussianSplatSupportsArtifactRuntimeLoa TEST(RenderResourceCacheTest, GetOrCreateGaussianSplatSupportsSourceAssetImportPath) { namespace fs = std::filesystem; - const fs::path projectRoot = CreateTestProjectRoot("source_asset_import"); + const ScopedTestProjectRoot testProjectRoot("source_asset_import"); + const fs::path projectRoot = testProjectRoot.GetPath(); const fs::path assetsDir = projectRoot / "Assets"; const fs::path sourcePath = assetsDir / "sample.ply"; diff --git a/tests/Resources/GaussianSplat/test_gaussian_splat_loader.cpp b/tests/Resources/GaussianSplat/test_gaussian_splat_loader.cpp index baf05627..dfa683fa 100644 --- a/tests/Resources/GaussianSplat/test_gaussian_splat_loader.cpp +++ b/tests/Resources/GaussianSplat/test_gaussian_splat_loader.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -273,9 +274,28 @@ GaussianSplat BuildSampleGaussianSplat(const char* artifactPath) { return gaussianSplat; } -std::filesystem::path CreateTestProjectRoot(const char* folderName) { - return std::filesystem::current_path() / "__xc_gaussian_splat_test_runtime" / folderName; -} +class ScopedTestProjectRoot final { +public: + explicit ScopedTestProjectRoot(const char* folderName) + : m_runtimeRoot(std::filesystem::temp_directory_path() / "xcengine_gaussian_splat_test_runtime") + , m_projectRoot(m_runtimeRoot / folderName) { + std::error_code ec; + std::filesystem::remove_all(m_projectRoot, ec); + } + + ~ScopedTestProjectRoot() { + std::error_code ec; + std::filesystem::remove_all(m_runtimeRoot, ec); + } + + const std::filesystem::path& GetPath() const { + return m_projectRoot; + } + +private: + std::filesystem::path m_runtimeRoot; + std::filesystem::path m_projectRoot; +}; void LinkOrCopyFixture(const std::filesystem::path& sourcePath, const std::filesystem::path& destinationPath) { std::error_code ec; @@ -407,7 +427,8 @@ TEST(GaussianSplatLoader, ResourceManagerLoadsArtifactByPath) { TEST(GaussianSplatLoader, AssetDatabaseImportsSyntheticPlyAndLinearizesData) { namespace fs = std::filesystem; - const fs::path projectRoot = CreateTestProjectRoot("gaussian_splat_synthetic_import"); + const ScopedTestProjectRoot testProjectRoot("gaussian_splat_synthetic_import"); + const fs::path projectRoot = testProjectRoot.GetPath(); const fs::path assetsDir = projectRoot / "Assets"; const fs::path sourcePath = assetsDir / "sample.ply"; @@ -520,7 +541,8 @@ TEST(GaussianSplatLoader, RoomPlyBuildsArtifactAndLoadsThroughResourceManager) { const XCEngine::Core::uint32 expectedChunkCount = (expectedVertexCount + kGaussianSplatChunkSize - 1u) / kGaussianSplatChunkSize; - const fs::path projectRoot = CreateTestProjectRoot("gaussian_splat_room_import"); + const ScopedTestProjectRoot testProjectRoot("gaussian_splat_room_import"); + const fs::path projectRoot = testProjectRoot.GetPath(); const fs::path assetsDir = projectRoot / "Assets"; const fs::path roomPath = assetsDir / "room.ply";