Unit test for Issue #1923: OBJ Exporter can't correctly export vertex colors

pull/1931/head
Korbinian Würl 2018-04-30 15:51:48 +02:00
parent 410e9d4b3f
commit 9e484daa65
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,30 @@
g cube
v 0.0 0.0 0.0 0.0 0.0 0.0
v 0.0 0.0 1.0 1.0 0.6 0.3
v 0.0 1.0 0.0 0.0 0.0 0.0
v 0.0 1.0 1.0 0.3 0.6 1.0
v 1.0 0.0 0.0 0.0 0.0 0.0
v 1.0 0.0 1.0 1.0 0.6 0.3
v 1.0 1.0 0.0 0.0 0.0 0.0
v 1.0 1.0 1.0 0.3 0.6 1.0
vn 0.0 0.0 1.0
vn 0.0 0.0 -1.0
vn 0.0 1.0 0.0
vn 0.0 -1.0 0.0
vn 1.0 0.0 0.0
vn -1.0 0.0 0.0
f 1//2 7//2 5//2
f 1//2 3//2 7//2
f 1//6 4//6 3//6
f 1//6 2//6 4//6
f 3//3 8//3 7//3
f 3//3 4//3 8//3
f 5//5 7//5 8//5
f 5//5 8//5 6//5
f 1//4 5//4 6//4
f 1//4 6//4 2//4
f 2//1 6//1 8//1
f 2//1 8//1 4//1

View File

@ -267,6 +267,24 @@ TEST_F( utObjImportExport, issue809_vertex_color_Test ) {
#endif // ASSIMP_BUILD_NO_EXPORT
}
TEST_F( utObjImportExport, issue1923_vertex_color_Test ) {
::Assimp::Importer importer;
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/cube_with_vertexcolors_uni.obj", aiProcess_ValidateDataStructure );
EXPECT_NE( nullptr, scene );
#ifndef ASSIMP_BUILD_NO_EXPORT
::Assimp::Exporter exporter;
const aiExportDataBlob* blob = exporter.ExportToBlob( scene, "obj");
EXPECT_NE( nullptr, blob );
const aiScene *sceneReImport = importer.ReadFileFromMemory( blob->data, blob->size, aiProcess_ValidateDataStructure );
EXPECT_NE( nullptr, scene );
SceneDiffer differ;
EXPECT_TRUE( differ.isEqual( scene, sceneReImport ) );
#endif // ASSIMP_BUILD_NO_EXPORT
}
TEST_F( utObjImportExport, issue1453_segfault ) {
static const std::string ObjModel =
"v 0.0 0.0 0.0\n"