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