feat(scripting): add mesh component script wrappers
This commit is contained in:
@@ -66,6 +66,19 @@ TEST(MeshFilterComponent_Test, SerializeAndDeserializePreservesPath) {
|
||||
delete mesh;
|
||||
}
|
||||
|
||||
TEST(MeshFilterComponent_Test, SetMeshPathPreservesPathWithoutLoadedResource) {
|
||||
MeshFilterComponent component;
|
||||
|
||||
component.SetMeshPath("Meshes/runtime.mesh");
|
||||
|
||||
EXPECT_EQ(component.GetMeshPath(), "Meshes/runtime.mesh");
|
||||
EXPECT_EQ(component.GetMesh(), nullptr);
|
||||
|
||||
component.SetMeshPath("");
|
||||
EXPECT_EQ(component.GetMeshPath(), "");
|
||||
EXPECT_EQ(component.GetMesh(), nullptr);
|
||||
}
|
||||
|
||||
TEST(MeshRendererComponent_Test, SetMaterialsKeepsSlotsAndFlags) {
|
||||
GameObject gameObject("RendererHolder");
|
||||
auto* component = gameObject.AddComponent<MeshRendererComponent>();
|
||||
@@ -122,4 +135,20 @@ TEST(MeshRendererComponent_Test, SerializeAndDeserializePreservesMaterialPathsAn
|
||||
delete material1;
|
||||
}
|
||||
|
||||
TEST(MeshRendererComponent_Test, SetMaterialPathPreservesPathWithoutLoadedResource) {
|
||||
MeshRendererComponent component;
|
||||
|
||||
component.SetMaterialPath(1, "Materials/runtime.mat");
|
||||
|
||||
ASSERT_EQ(component.GetMaterialCount(), 2u);
|
||||
EXPECT_EQ(component.GetMaterial(0), nullptr);
|
||||
EXPECT_EQ(component.GetMaterial(1), nullptr);
|
||||
EXPECT_EQ(component.GetMaterialPath(0), "");
|
||||
EXPECT_EQ(component.GetMaterialPath(1), "Materials/runtime.mat");
|
||||
|
||||
component.SetMaterialPath(1, "");
|
||||
EXPECT_EQ(component.GetMaterialPath(1), "");
|
||||
EXPECT_EQ(component.GetMaterial(1), nullptr);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user