diff --git a/src/Unittests/TestFiles/cube-minimal-extra-elements-binary.ply b/src/Unittests/TestFiles/cube-minimal-extra-elements-binary.ply new file mode 100644 index 00000000..b92063d7 Binary files /dev/null and b/src/Unittests/TestFiles/cube-minimal-extra-elements-binary.ply differ diff --git a/src/Unittests/TestFiles/cube-minimal-extra-elements.ply b/src/Unittests/TestFiles/cube-minimal-extra-elements.ply new file mode 100644 index 00000000..65eefe03 --- /dev/null +++ b/src/Unittests/TestFiles/cube-minimal-extra-elements.ply @@ -0,0 +1,38 @@ +ply +format ascii 1.0 +element vertex 8 +property float32 x +property float32 y +property float32 z +element edge 12 +property int32 vertex1 +property int32 vertex2 +element face 6 +property list uint8 int32 vertex_indices +end_header +-1 -1 -1 +1 -1 -1 +1 1 -1 +-1 1 -1 +-1 -1 1 +1 -1 1 +1 1 1 +-1 1 1 +0 1 +1 2 +2 3 +3 0 +4 5 +5 6 +6 7 +7 4 +6 2 +1 5 +3 7 +4 0 +4 0 1 2 3 +4 5 4 7 6 +4 6 2 1 5 +4 3 7 4 0 +4 7 3 2 6 +4 5 1 0 4 diff --git a/src/Unittests/unittests_read_write_PLY.cc b/src/Unittests/unittests_read_write_PLY.cc index 60a5ad47..e92a678e 100644 --- a/src/Unittests/unittests_read_write_PLY.cc +++ b/src/Unittests/unittests_read_write_PLY.cc @@ -691,5 +691,41 @@ TEST_F(OpenMeshReadWritePLY, WriteReadBinaryPLYWithCustomProps) { //remove(outFilename); +} + +/* +* Just load a ply with extra elements +*/ +TEST_F(OpenMeshReadWritePLY, LoadSimplePLYWithExtraElements) { + + mesh_.clear(); + + bool ok = OpenMesh::IO::read_mesh(mesh_, "cube-minimal-extra-elements.ply"); + + EXPECT_TRUE(ok) << "Unable to load cube-minimal-extra-elements.ply"; + + EXPECT_EQ(8u, mesh_.n_vertices()) << "The number of loaded vertices is not correct!"; + EXPECT_EQ(18u, mesh_.n_edges()) << "The number of loaded edges is not correct!"; + EXPECT_EQ(12u, mesh_.n_faces()) << "The number of loaded faces is not correct!"; + +} + +/* +* Just load a binary ply with extra elements +*/ +TEST_F(OpenMeshReadWritePLY, LoadSimpleBinaryPLYWithExtraElements) { + + mesh_.clear(); + + OpenMesh::IO::Options options = OpenMesh::IO::Options::Binary; + + bool ok = OpenMesh::IO::read_mesh(mesh_, "cube-minimal-extra-elements-binary.ply", options); + + EXPECT_TRUE(ok) << "Unable to load cube-minimal-extra-elements-binary.ply"; + + EXPECT_EQ(8u, mesh_.n_vertices()) << "The number of loaded vertices is not correct!"; + EXPECT_EQ(18u, mesh_.n_edges()) << "The number of loaded edges is not correct!"; + EXPECT_EQ(12u, mesh_.n_faces()) << "The number of loaded faces is not correct!"; + } }