Skip to content

Commit 5687d89

Browse files
committedOct 29, 2023
[USDC reader] Creat Over prim in default when specifier field is not set.
Add a unit tester for io-util.cc
1 parent ecfacac commit 5687d89

File tree

5 files changed

+26
-3
lines changed

5 files changed

+26
-3
lines changed
 

‎src/usdc-reader.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -2800,9 +2800,8 @@ bool USDCReader::Impl::ReconstructPrimSpecNode(int parent, int current, int leve
28002800
PUSH_ERROR_AND_RETURN_TAG(kTag, "Invalid Specifier.");
28012801
}
28022802
} else {
2803-
PUSH_ERROR_AND_RETURN_TAG(kTag,
2804-
"`specifier` field is missing for FieldSets "
2805-
"with SpecType::Prim.");
2803+
// Default = Over Prim.
2804+
specifier = Specifier::Over;
28062805
}
28072806

28082807
std::string pTyName;
@@ -2981,6 +2980,7 @@ bool USDCReader::Impl::ReconstructPrimSpecNode(int parent, int current, int leve
29812980
} else {
29822981
// Seems Variant is only composed of Properties.
29832982
// Create pseudo `def` Prim
2983+
// FIXME: default is `Over`?
29842984
specifier = Specifier::Def;
29852985
}
29862986

‎tests/unit/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ set(TEST_SOURCES
1212
unit-value-types.cc
1313
unit-xform.cc
1414
unit-math.cc
15+
unit-ioutil.cc
1516
)
1617

1718
if (TINYUSDZ_WITH_PXR_COMPAT_API)

‎tests/unit/unit-ioutil.cc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifdef _MSC_VER
2+
#define NOMINMAX
3+
#endif
4+
5+
#define TEST_NO_MAIN
6+
#include "acutest.h"
7+
8+
#include "unit-ioutil.h"
9+
#include "io-util.hh"
10+
11+
using namespace tinyusdz;
12+
13+
void ioutil_test(void) {
14+
{
15+
TEST_CHECK(io::JoinPath("./", "./dora") == "./dora");
16+
}
17+
}

‎tests/unit/unit-ioutil.h

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
void ioutil_test(void);

‎tests/unit/unit-main.cc

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "unit-customdata.h"
1313
#include "unit-handle-allocator.h"
1414
#include "unit-math.h"
15+
#include "unit-ioutil.h"
1516

1617
#if defined(TINYUSDZ_WITH_PXR_COMPAT_API)
1718
#include "unit-pxr-compat-api.h"
@@ -31,6 +32,7 @@ TEST_LIST = {
3132
{ "math_sin_pi_test", math_sin_pi_test },
3233
{ "math_sin_cos_pi_test", math_sin_cos_pi_test },
3334
{ "pathutil_test", pathutil_test },
35+
{ "ioutil_test", ioutil_test },
3436
#if defined(TINYUSDZ_WITH_PXR_COMPAT_API)
3537
{ "pxr_compat_api_test", pxr_compat_api_test },
3638
#endif

0 commit comments

Comments
 (0)