From b3a1bd5e61621246837277899c53749f523201a5 Mon Sep 17 00:00:00 2001 From: elser Date: Tue, 17 Oct 2023 16:16:40 -0400 Subject: [PATCH] WIP more usd util tests --- tests/src/UsdUtilTests.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/tests/src/UsdUtilTests.cpp b/tests/src/UsdUtilTests.cpp index 755af1aeb..2110560f4 100644 --- a/tests/src/UsdUtilTests.cpp +++ b/tests/src/UsdUtilTests.cpp @@ -11,6 +11,7 @@ namespace cesium::omniverse::UsdUtil { TEST_SUITE("UsdUtil tests") { + TEST_CASE("Check expected initial state") { auto cesiumObjPath = pxr::SdfPath("/Cesium"); CHECK(hasStage()); @@ -52,8 +53,30 @@ TEST_SUITE("UsdUtil tests") { CHECK(usdToGlmMatrix(cubeXform) == computeUsdLocalToWorldTransform(cubePath)); - // stage->RemovePrim(primPath); - // stage->RemovePrim(cubePath); + stage->RemovePrim(primPath); + stage->RemovePrim(cubePath); + } + + TEST_CASE("Test UTF-8 path names") { + auto stage = getUsdStage(); + + for (int i = 0; i < 32; i++) { + std::string randomUTF8String = "safe_name_test"; + + randomUTF8String.reserve(64); + + for (long unsigned int ii = 0; ii < randomUTF8String.capacity() - randomUTF8String.size(); ii++) { + char randChar = (char)(rand() % 0xE007F); + randomUTF8String.append(&randChar); + } + + auto safeUniquePath = getPathUnique(getRootPath(), getSafeName(randomUTF8String)); + + stage->DefinePrim(safeUniquePath); + CHECK(primExists(safeUniquePath)); + stage->RemovePrim(safeUniquePath); + CHECK_FALSE(primExists(safeUniquePath)); + } } } } // namespace cesium::omniverse::UsdUtil