Skip to content

Commit

Permalink
add texcoord2f -> float2 cast test.
Browse files Browse the repository at this point in the history
  • Loading branch information
syoyo committed Jun 14, 2024
1 parent 0f3a436 commit 7f3ae22
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/unit/unit-value-types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "unit-value-types.h"
#include "value-types.hh"
#include "math-util.inc"

using namespace tinyusdz;

Expand All @@ -27,5 +28,16 @@ void value_types_test(void) {

TEST_CHECK(!value::TryGetTypeName(value::TYPE_ID_ALL));

// texCoord2f <-> float2 cast
value::float2 uv{1.0f, 2.0f};
value::Value value(uv);

value::texcoord2f *tex2f = value.as<value::texcoord2f>();
TEST_CHECK(tex2f != nullptr);
if (tex2f) {
TEST_CHECK(math::is_close(tex2f->s, 1.0f));
TEST_CHECK(math::is_close(tex2f->t, 2.0f));
}

}

0 comments on commit 7f3ae22

Please sign in to comment.