Add unit-test for PLY with UV coordinates

pull/1825/head
Alexandre Avenel 2018-03-04 13:07:40 +01:00
parent 065c264b34
commit cd5881c9c0
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,45 @@
ply
format ascii 1.0
comment Created by Blender 2.77 (sub 0) - www.blender.org, source file: ''
element vertex 24
property float x
property float y
property float z
property float nx
property float ny
property float nz
property float s
property float t
element face 6
property list uchar uint vertex_indices
end_header
1.000000 1.000000 -1.000000 0.000000 0.000000 -1.000000 0.000000 0.000000
1.000000 -1.000000 -1.000000 0.000000 0.000000 -1.000000 1.000000 0.000000
-1.000000 -1.000000 -1.000000 0.000000 0.000000 -1.000000 1.000000 1.000000
-1.000000 1.000000 -1.000000 0.000000 0.000000 -1.000000 0.000000 1.000000
1.000000 0.999999 1.000000 0.000000 -0.000000 1.000000 0.000000 0.000000
-1.000000 1.000000 1.000000 0.000000 -0.000000 1.000000 1.000000 0.000000
-1.000000 -1.000000 1.000000 0.000000 -0.000000 1.000000 1.000000 1.000000
0.999999 -1.000001 1.000000 0.000000 -0.000000 1.000000 0.000000 1.000000
1.000000 1.000000 -1.000000 1.000000 -0.000000 0.000000 0.000000 0.000000
1.000000 0.999999 1.000000 1.000000 -0.000000 0.000000 1.000000 0.000000
0.999999 -1.000001 1.000000 1.000000 -0.000000 0.000000 1.000000 1.000000
1.000000 -1.000000 -1.000000 1.000000 -0.000000 0.000000 0.000000 1.000000
1.000000 -1.000000 -1.000000 -0.000000 -1.000000 -0.000000 0.000000 0.000000
0.999999 -1.000001 1.000000 -0.000000 -1.000000 -0.000000 1.000000 0.000000
-1.000000 -1.000000 1.000000 -0.000000 -1.000000 -0.000000 1.000000 1.000000
-1.000000 -1.000000 -1.000000 -0.000000 -1.000000 -0.000000 0.000000 1.000000
-1.000000 -1.000000 -1.000000 -1.000000 0.000000 -0.000000 0.000000 0.000000
-1.000000 -1.000000 1.000000 -1.000000 0.000000 -0.000000 1.000000 0.000000
-1.000000 1.000000 1.000000 -1.000000 0.000000 -0.000000 1.000000 1.000000
-1.000000 1.000000 -1.000000 -1.000000 0.000000 -0.000000 0.000000 1.000000
1.000000 0.999999 1.000000 0.000000 1.000000 0.000000 0.000000 0.000000
1.000000 1.000000 -1.000000 0.000000 1.000000 0.000000 1.000000 0.000000
-1.000000 1.000000 -1.000000 0.000000 1.000000 0.000000 1.000000 1.000000
-1.000000 1.000000 1.000000 0.000000 1.000000 0.000000 0.000000 1.000000
4 0 1 2 3
4 4 5 6 7
4 8 9 10 11
4 12 13 14 15
4 16 17 18 19
4 20 21 22 23

View File

@ -99,6 +99,18 @@ TEST_F(utPLYImportExport, importerMultipleTest) {
EXPECT_NE(nullptr, scene); EXPECT_NE(nullptr, scene);
} }
TEST_F(utPLYImportExport, importPLYwithUV) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/PLY/cube_uv.ply", aiProcess_ValidateDataStructure);
EXPECT_NE(nullptr, scene);
EXPECT_NE(nullptr, scene->mMeshes[0]);
//This test model is using n-gons, so 6 faces instead of 12 tris
EXPECT_EQ(6u, scene->mMeshes[0]->mNumFaces);
EXPECT_EQ(aiPrimitiveType_POLYGON, scene->mMeshes[0]->mPrimitiveTypes);
EXPECT_EQ(true, scene->mMeshes[0]->HasTextureCoords(0));
}
TEST_F( utPLYImportExport, vertexColorTest ) { TEST_F( utPLYImportExport, vertexColorTest ) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/PLY/float-color.ply", aiProcess_ValidateDataStructure); const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/PLY/float-color.ply", aiProcess_ValidateDataStructure);