Add unit tests.
parent
5f8f5c3292
commit
4cde72b4e6
|
@ -204,7 +204,7 @@
|
||||||
"name" : "TruncatedIndexedCube",
|
"name" : "TruncatedIndexedCube",
|
||||||
"primitives" : [ {
|
"primitives" : [ {
|
||||||
"attributes" : {
|
"attributes" : {
|
||||||
"POSITION" : "accessor_1"
|
"POSITION" : "accessor_6"
|
||||||
},
|
},
|
||||||
"mode" : 4,
|
"mode" : 4,
|
||||||
"indices" : "accessor_7"
|
"indices" : "accessor_7"
|
||||||
|
@ -279,15 +279,5 @@
|
||||||
"node_0", "node_1", "node_2", "node_3", "node_4", "node_5", "node_6", "node_7"
|
"node_0", "node_1", "node_2", "node_3", "node_4", "node_5", "node_6", "node_7"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"textures" : [
|
|
||||||
{
|
|
||||||
"sampler" : 0,
|
|
||||||
"source" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"sampler" : 0,
|
|
||||||
"source" : 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@
|
||||||
"name" : "TruncatedIndexedCube",
|
"name" : "TruncatedIndexedCube",
|
||||||
"primitives" : [ {
|
"primitives" : [ {
|
||||||
"attributes" : {
|
"attributes" : {
|
||||||
"POSITION" : 1
|
"POSITION" : 6
|
||||||
},
|
},
|
||||||
"mode" : 4,
|
"mode" : 4,
|
||||||
"indices" : 7
|
"indices" : 7
|
||||||
|
@ -282,15 +282,5 @@
|
||||||
0, 1, 2, 3, 4, 5, 6, 7
|
0, 1, 2, 3, 4, 5, 6, 7
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"textures" : [
|
|
||||||
{
|
|
||||||
"sampler" : 0,
|
|
||||||
"source" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"sampler" : 0,
|
|
||||||
"source" : 1
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -382,6 +382,29 @@ TEST_F(utglTF2ImportExport, import_cameras) {
|
||||||
EXPECT_NE(nullptr, scene);
|
EXPECT_NE(nullptr, scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(utglTF2ImportExport, incorrect_vertex_arrays) {
|
||||||
|
Assimp::Importer importer;
|
||||||
|
const aiScene* scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/IncorrectVertexArrays/Cube.gltf",
|
||||||
|
aiProcess_ValidateDataStructure);
|
||||||
|
EXPECT_NE(nullptr, scene);
|
||||||
|
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 36u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 12u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[1]->mNumVertices, 35u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[1]->mNumFaces, 11u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[2]->mNumVertices, 36u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[2]->mNumFaces, 18u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[3]->mNumVertices, 35u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[3]->mNumFaces, 17u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[4]->mNumVertices, 36u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[4]->mNumFaces, 12u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[5]->mNumVertices, 35u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[5]->mNumFaces, 11u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[6]->mNumVertices, 36u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[6]->mNumFaces, 18u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[7]->mNumVertices, 35u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[7]->mNumFaces, 17u);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||||
TEST_F( utglTF2ImportExport, exportglTF2FromFileTest ) {
|
TEST_F( utglTF2ImportExport, exportglTF2FromFileTest ) {
|
||||||
EXPECT_TRUE( exporterTest() );
|
EXPECT_TRUE( exporterTest() );
|
||||||
|
|
|
@ -46,6 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/postprocess.h>
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
|
#include <assimp/scene.h>
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
class utglTFImportExport : public AbstractImportExportBase {
|
class utglTFImportExport : public AbstractImportExportBase {
|
||||||
|
@ -60,3 +62,26 @@ public:
|
||||||
TEST_F( utglTFImportExport, importglTFFromFileTest ) {
|
TEST_F( utglTFImportExport, importglTFFromFileTest ) {
|
||||||
EXPECT_TRUE( importerTest() );
|
EXPECT_TRUE( importerTest() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(utglTFImportExport, incorrect_vertex_arrays) {
|
||||||
|
Assimp::Importer importer;
|
||||||
|
const aiScene* scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF/IncorrectVertexArrays/Cube_v1.gltf",
|
||||||
|
aiProcess_ValidateDataStructure);
|
||||||
|
EXPECT_NE(nullptr, scene);
|
||||||
|
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 36u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 12u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[1]->mNumVertices, 35u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[1]->mNumFaces, 11u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[2]->mNumVertices, 36u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[2]->mNumFaces, 18u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[3]->mNumVertices, 35u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[3]->mNumFaces, 17u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[4]->mNumVertices, 36u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[4]->mNumFaces, 12u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[5]->mNumVertices, 35u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[5]->mNumFaces, 11u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[6]->mNumVertices, 36u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[6]->mNumFaces, 18u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[7]->mNumVertices, 35u);
|
||||||
|
EXPECT_EQ(scene->mMeshes[7]->mNumFaces, 17u);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue