From 15c2a96d25055a46a738834e14609fd030886cfe Mon Sep 17 00:00:00 2001 From: Alexandre Avenel Date: Thu, 2 Aug 2018 19:07:51 +0200 Subject: [PATCH] Add test for glTF2 points --- test/unit/utglTF2ImportExport.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/test/unit/utglTF2ImportExport.cpp b/test/unit/utglTF2ImportExport.cpp index 35b6030da..e7d214ebd 100644 --- a/test/unit/utglTF2ImportExport.cpp +++ b/test/unit/utglTF2ImportExport.cpp @@ -145,6 +145,19 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesStrip) { } } +TEST_F(utglTF2ImportExport, importglTF2PrimitiveModePoints) { + Assimp::Importer importer; + //Line loop + const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_07.gltf", aiProcess_ValidateDataStructure); + EXPECT_NE(nullptr, scene); + EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 1024); + for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) + { + EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 1); + EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i); + } +} + TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineLoop) { Assimp::Importer importer; //Line loop @@ -153,7 +166,7 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineLoop) { EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); std::array l1 = { 0, 3, 2, 1, 0}; EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2); - for (int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) + for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i+1]); @@ -168,7 +181,7 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLines) { EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); std::array l1 = { 0, 3, 2, 1, 0 }; EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2); - for (int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) + for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i + 1]); @@ -183,7 +196,7 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineStrip) { EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); std::array l1 = { 0, 3, 2, 1, 0 }; EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2); - for (int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) + for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i + 1]);