Clean up gaussian splat test runtime roots
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include <vector>
|
||||
|
||||
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";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user