From ebbd41aaf37618f19de6103b7db5d86bde8bf194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 25 Nov 2011 14:49:07 +0000 Subject: [PATCH] Added unittest for simple ply with encoding problems git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@462 fdac6126-5c0c-442c-9429-916003d36597 --- .../TestFiles/pointCloudBadEncoding.ply | 23 +++++++++++++++++++ src/Unittests/unittests_loading.hh | 18 +++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/Unittests/TestFiles/pointCloudBadEncoding.ply diff --git a/src/Unittests/TestFiles/pointCloudBadEncoding.ply b/src/Unittests/TestFiles/pointCloudBadEncoding.ply new file mode 100644 index 00000000..d80ea3b1 --- /dev/null +++ b/src/Unittests/TestFiles/pointCloudBadEncoding.ply @@ -0,0 +1,23 @@ +ply +format ascii 1.0 +element vertex 10 +property float x +property float y +property float z +property float nx +property float ny +property float nz +property uchar diffuse_red +property uchar diffuse_green +property uchar diffuse_blue +end_header +-0.774382 0.446049 -2.05893 0.386853 -0.197849 0.900667 76 52 41 +-0.762621 0.446872 -2.06314 0.0431574 -0.643148 0.764525 77 58 46 +-0.769175 0.436518 -2.0635 0.257818 -0.156835 0.95338 121 97 88 +-1.07959 0.381204 -1.95964 0.948941 -0.303889 0.0846349 126 117 97 +-1.05841 0.398189 -1.98803 0.230719 0.341539 0.911109 103 90 86 +-1.04905 0.388091 -1.97944 -0.0175732 -0.131422 0.991171 72 62 70 +-0.784233 0.428294 -2.06324 -0.0394355 0.268678 0.962422 167 93 80 +-0.773624 0.429338 -2.06101 0.373176 -0.105125 0.921785 172 135 126 +-0.779554 0.433575 -2.06273 -0.0113203 -0.243327 0.969878 165 102 90 +-0.764714 0.428742 -2.06643 0.31292 -0.294884 0.902843 139 119 109 diff --git a/src/Unittests/unittests_loading.hh b/src/Unittests/unittests_loading.hh index 27173927..718ad95f 100644 --- a/src/Unittests/unittests_loading.hh +++ b/src/Unittests/unittests_loading.hh @@ -46,4 +46,22 @@ TEST_F(OpenMeshLoader, LoadSimpleOFFFile) { EXPECT_EQ(15048, mesh_.n_faces()) << "The number of loaded faces is not correct!"; } + +/* + * Just load a point file in ply format and count whether + * the right number of entities has been loaded. + */ +TEST_F(OpenMeshLoader, LoadSimplePointPLYFileWithEncodingProblems) { + + bool ok = OpenMesh::IO::read_mesh(mesh_, "pointCloudBadEncoding.ply"); + + EXPECT_TRUE(ok); + + EXPECT_EQ(10, mesh_.n_vertices()) << "The number of loaded vertices is not correct!"; + EXPECT_EQ(0, mesh_.n_edges()) << "The number of loaded edges is not correct!"; + EXPECT_EQ(0, mesh_.n_faces()) << "The number of loaded faces is not correct!"; +} + + + #endif // INCLUDE GUARD