Skip to content

Commit

Permalink
Clean up memory in ColladaLoader_TEST
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll committed Jan 16, 2024
1 parent 263cdd4 commit b593816
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions graphics/src/ColladaLoader_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ TEST_F(ColladaLoader, LoadBox)

// Make sure we can read a submesh name
EXPECT_STREQ("Cube", mesh->SubMeshByIndex(0).lock()->Name().c_str());
delete mesh;
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -100,6 +101,7 @@ TEST_F(ColladaLoader, ShareVertices)
}
}
}
delete mesh;
}

/////////////////////////////////////////////////
Expand All @@ -124,6 +126,7 @@ TEST_F(ColladaLoader, LoadZeroCount)
EXPECT_NE(log.find("Normal source has a float_array with a count of zero"),
std::string::npos);
#endif
delete mesh;
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -179,6 +182,9 @@ TEST_F(ColladaLoader, Material)
matOpaque->BlendFactors(srcFactor, dstFactor);
EXPECT_DOUBLE_EQ(1.0, srcFactor);
EXPECT_DOUBLE_EQ(0.0, dstFactor);

delete mesh;
delete meshOpaque;
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -266,6 +272,7 @@ TEST_F(ColladaLoader, TexCoordSets)

subMeshB->SetTexCoordBySet(2u, math::Vector2d(0.1, 0.2), 1u);
EXPECT_EQ(math::Vector2d(0.1, 0.2), subMeshB->TexCoordBySet(2u, 1u));
delete mesh;
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -302,6 +309,7 @@ TEST_F(ColladaLoader, LoadBoxWithAnimationOutsideSkeleton)
0, 0, 1, 0,
0, 0, 0, 1);
EXPECT_EQ(expectedTrans, poseEnd.at("Armature"));
delete mesh;
}

/////////////////////////////////////////////////
Expand All @@ -320,6 +328,7 @@ TEST_F(ColladaLoader, LoadBoxInstControllerWithoutSkeleton)
common::SkeletonPtr skeleton = mesh->MeshSkeleton();
EXPECT_LT(0u, skeleton->NodeCount());
EXPECT_NE(nullptr, skeleton->NodeById("Armature_Bone"));
delete mesh;
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -347,6 +356,7 @@ TEST_F(ColladaLoader, LoadBoxMultipleInstControllers)
common::SkeletonPtr skeleton = mesh->MeshSkeleton();
EXPECT_NE(nullptr, skeleton->NodeById("Armature_Bone"));
EXPECT_NE(nullptr, skeleton->NodeById("Armature_Bone2"));
delete mesh;
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -383,6 +393,7 @@ TEST_F(ColladaLoader, LoadBoxNestedAnimation)
0, 0, 1, 0,
0, 0, 0, 1);
EXPECT_EQ(expectedTrans, poseEnd.at("Bone"));
delete mesh;
}

/////////////////////////////////////////////////
Expand All @@ -398,6 +409,7 @@ TEST_F(ColladaLoader, LoadBoxWithDefaultStride)
EXPECT_EQ(1u, mesh->MaterialCount());
EXPECT_EQ(35u, mesh->TexCoordCount());
ASSERT_EQ(1u, mesh->MeshSkeleton()->AnimationCount());
delete mesh;
}

/////////////////////////////////////////////////
Expand All @@ -415,6 +427,7 @@ TEST_F(ColladaLoader, LoadBoxWithMultipleGeoms)
ASSERT_EQ(2u, mesh->SubMeshCount());
EXPECT_EQ(24u, mesh->SubMeshByIndex(0).lock()->NodeAssignmentsCount());
EXPECT_EQ(0u, mesh->SubMeshByIndex(1).lock()->NodeAssignmentsCount());
delete mesh;
}

/////////////////////////////////////////////////
Expand All @@ -440,6 +453,7 @@ TEST_F(ColladaLoader, LoadBoxWithHierarchicalNodes)

// Parent of nested node with name
EXPECT_EQ("StaticCubeParent2", mesh->SubMeshByIndex(4).lock()->Name());
delete mesh;
}

/////////////////////////////////////////////////
Expand All @@ -453,6 +467,7 @@ TEST_F(ColladaLoader, MergeBoxWithDoubleSkeleton)
// The two skeletons have been joined and their root is the
// animation root, called Armature
EXPECT_EQ(skeleton_ptr->RootNode()->Name(), std::string("Armature"));
delete mesh;
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -488,4 +503,5 @@ TEST_F(ColladaLoader, LoadCylinderAnimatedFrom3dsMax)
EXPECT_EQ("Bone02", anim->Name());
EXPECT_EQ(1u, anim->NodeCount());
EXPECT_TRUE(anim->HasNode("Bone02"));
delete mesh;
}

0 comments on commit b593816

Please sign in to comment.