From 74af43f6559af645c9f79c7e6e9cc149bdbb57cc Mon Sep 17 00:00:00 2001 From: Andre Schulz Date: Sun, 3 Dec 2023 13:06:45 +0100 Subject: [PATCH] Add unit test for X3D IndexedLineSet Unit test for issue #3101 Thanks to @mvidiassov for the X3D test file! --- test/models/X3D/IndexedLineSet.x3d | 19 +++++++++++++++++++ test/unit/utX3DImportExport.cpp | 14 ++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 test/models/X3D/IndexedLineSet.x3d diff --git a/test/models/X3D/IndexedLineSet.x3d b/test/models/X3D/IndexedLineSet.x3d new file mode 100644 index 000000000..ed865ebb7 --- /dev/null +++ b/test/models/X3D/IndexedLineSet.x3d @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/test/unit/utX3DImportExport.cpp b/test/unit/utX3DImportExport.cpp index f2df81ac2..a654765de 100644 --- a/test/unit/utX3DImportExport.cpp +++ b/test/unit/utX3DImportExport.cpp @@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#include using namespace Assimp; @@ -59,3 +60,16 @@ public: TEST_F(utX3DImportExport, importX3DFromFileTest) { EXPECT_TRUE(importerTest()); } + +TEST_F(utX3DImportExport, importX3DIndexedLineSet) { + Assimp::Importer importer; + const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/X3D/IndexedLineSet.x3d", aiProcess_ValidateDataStructure); + ASSERT_NE(nullptr, scene); + ASSERT_EQ(scene->mNumMeshes, 1u); + ASSERT_EQ(scene->mMeshes[0]->mNumFaces, 4u); + ASSERT_EQ(scene->mMeshes[0]->mPrimitiveTypes, aiPrimitiveType_LINE); + ASSERT_EQ(scene->mMeshes[0]->mNumVertices, 4u); + for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; i++) { + ASSERT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2u); + } +}