From ec69e2bf59014e60f4297d86ff6cb27f90420e97 Mon Sep 17 00:00:00 2001 From: Max Vollmer Date: Wed, 11 Mar 2020 15:32:28 +0000 Subject: [PATCH] Added unit test for recursive references in GLTF2 file --- .../glTF2/RecursiveNodes/RecursiveNodes.gltf | 25 +++++++++++++++++++ test/unit/utglTF2ImportExport.cpp | 6 +++++ 2 files changed, 31 insertions(+) create mode 100644 test/models/glTF2/RecursiveNodes/RecursiveNodes.gltf diff --git a/test/models/glTF2/RecursiveNodes/RecursiveNodes.gltf b/test/models/glTF2/RecursiveNodes/RecursiveNodes.gltf new file mode 100644 index 000000000..11cf04166 --- /dev/null +++ b/test/models/glTF2/RecursiveNodes/RecursiveNodes.gltf @@ -0,0 +1,25 @@ +{ + "asset": { + "version": "2.0" + }, + "scene": 0, + "scenes": [ + { + "nodes": [ + 0 + ] + } + ], + "nodes": [ + { + "children": [ + 1 + ] + }, + { + "children": [ + 0 + ] + } + ] +} diff --git a/test/unit/utglTF2ImportExport.cpp b/test/unit/utglTF2ImportExport.cpp index 8b91577f6..07996306a 100644 --- a/test/unit/utglTF2ImportExport.cpp +++ b/test/unit/utglTF2ImportExport.cpp @@ -493,3 +493,9 @@ TEST_F(utglTF2ImportExport, texcoords) { EXPECT_EQ(aiGetMaterialInteger(material, AI_MATKEY_GLTF_TEXTURE_TEXCOORD(aiTextureType_UNKNOWN, 0), &uvIndex), aiReturn_SUCCESS); EXPECT_EQ(uvIndex, 1); } + +TEST_F(utglTF2ImportExport, recursive_nodes) { + Assimp::Importer importer; + const aiScene* scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/RecursiveNodes/RecursiveNodes.gltf", aiProcess_ValidateDataStructure); + EXPECT_EQ(nullptr, scene); +}