Add test for issue 1970: STL with empty solid

pull/1972/head
Alexandre Avenel 2018-05-19 22:03:59 +02:00
parent 6c0553d810
commit 4b5c49b087
2 changed files with 21 additions and 0 deletions

View File

@ -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

View File

@ -73,6 +73,16 @@ TEST_F( utSTLImporterExporter, test_with_two_solids ) {
EXPECT_NE( nullptr, scene ); 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 #ifndef ASSIMP_BUILD_NO_EXPORT
TEST_F(utSTLImporterExporter, exporterTest) { TEST_F(utSTLImporterExporter, exporterTest) {