Changeset View
Changeset View
Standalone View
Standalone View
source/blender/io/common/intern/hierarchy_context_order_test.cc
- This file was moved from tests/gtests/usd/hierarchy_context_order_test.cc.
| Show All 18 Lines | |||||
| #include "IO_abstract_hierarchy_iterator.h" | #include "IO_abstract_hierarchy_iterator.h" | ||||
| #include "testing/testing.h" | #include "testing/testing.h" | ||||
| extern "C" { | extern "C" { | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| } | } | ||||
| using namespace blender::io; | namespace blender::io { | ||||
| class HierarchyContextOrderTest : public testing::Test { | namespace { | ||||
| }; | |||||
| static Object *fake_pointer(int value) | Object *fake_pointer(int value) | ||||
| { | { | ||||
| return static_cast<Object *>(POINTER_FROM_INT(value)); | return static_cast<Object *>(POINTER_FROM_INT(value)); | ||||
| } | } | ||||
| } // namespace | |||||
| class HierarchyContextOrderTest : public testing::Test { | |||||
| }; | |||||
| TEST_F(HierarchyContextOrderTest, ObjectPointerTest) | TEST_F(HierarchyContextOrderTest, ObjectPointerTest) | ||||
| { | { | ||||
| HierarchyContext ctx_a = {0}; | HierarchyContext ctx_a = {0}; | ||||
| ctx_a.object = fake_pointer(1); | ctx_a.object = fake_pointer(1); | ||||
| ctx_a.duplicator = nullptr; | ctx_a.duplicator = nullptr; | ||||
| HierarchyContext ctx_b = {0}; | HierarchyContext ctx_b = {0}; | ||||
| ctx_b.object = fake_pointer(2); | ctx_b.object = fake_pointer(2); | ||||
| ▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | TEST_F(HierarchyContextOrderTest, TransitiveTest) | ||||
| EXPECT_FALSE(ctx_b < ctx_a); | EXPECT_FALSE(ctx_b < ctx_a); | ||||
| EXPECT_FALSE(ctx_c < ctx_a); | EXPECT_FALSE(ctx_c < ctx_a); | ||||
| EXPECT_FALSE(ctx_d < ctx_a); | EXPECT_FALSE(ctx_d < ctx_a); | ||||
| EXPECT_FALSE(ctx_c < ctx_b); | EXPECT_FALSE(ctx_c < ctx_b); | ||||
| EXPECT_FALSE(ctx_d < ctx_b); | EXPECT_FALSE(ctx_d < ctx_b); | ||||
| EXPECT_FALSE(ctx_d < ctx_c); | EXPECT_FALSE(ctx_d < ctx_c); | ||||
| } | } | ||||
| } // namespace blender::io | |||||