From 4b5c49b0872e76eb1bd41af63bb3081236c5bb9f Mon Sep 17 00:00:00 2001 From: Alexandre Avenel Date: Sat, 19 May 2018 22:03:59 +0200 Subject: [PATCH] Add test for issue 1970: STL with empty solid --- test/models/STL/triangle_with_empty_solid.stl | 11 +++++++++++ test/unit/utSTLImportExport.cpp | 10 ++++++++++ 2 files changed, 21 insertions(+) create mode 100644 test/models/STL/triangle_with_empty_solid.stl diff --git a/test/models/STL/triangle_with_empty_solid.stl b/test/models/STL/triangle_with_empty_solid.stl new file mode 100644 index 000000000..2364b792f --- /dev/null +++ b/test/models/STL/triangle_with_empty_solid.stl @@ -0,0 +1,11 @@ +solid testTriangle + facet normal 0.0 0.0 1.0 + outer loop + vertex 1.0 1.0 0.0 + vertex -1.0 1.0 0.0 + vertex 0.0 -1.0 0.0 + endloop + endfacet +endsolid +solid emptySolid +endsolid diff --git a/test/unit/utSTLImportExport.cpp b/test/unit/utSTLImportExport.cpp index 181862560..de1e78a26 100644 --- a/test/unit/utSTLImportExport.cpp +++ b/test/unit/utSTLImportExport.cpp @@ -73,6 +73,16 @@ TEST_F( utSTLImporterExporter, test_with_two_solids ) { EXPECT_NE( nullptr, scene ); } +TEST_F(utSTLImporterExporter, test_with_empty_solid) { + Assimp::Importer importer; + //STL File with empty mesh. We should still be able to import other meshes in this file. ValidateDataStructure should fail. + const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/STL/triangle_with_empty_solid.stl", 0); + EXPECT_NE(nullptr, scene); + + const aiScene *scene2 = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/STL/triangle_with_empty_solid.stl", aiProcess_ValidateDataStructure); + EXPECT_EQ(nullptr, scene2); +} + #ifndef ASSIMP_BUILD_NO_EXPORT TEST_F(utSTLImporterExporter, exporterTest) {