Skip to content

Commit

Permalink
WIP more usd util tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattelser committed Oct 17, 2023
1 parent 9364c09 commit b3a1bd5
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions tests/src/UsdUtilTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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

0 comments on commit b3a1bd5

Please sign in to comment.