Unit: fix more compiler warnings.

pull/2552/head
kimkulling 2019-07-19 11:26:48 +02:00
parent a8019cf8d8
commit 3416c04ad9
2 changed files with 35 additions and 37 deletions

View File

@ -185,7 +185,7 @@ TEST_F(utFBXImporterExporter, importCubesComplexTransform) {
ASSERT_STREQ(node->mName.C_Str(), chainStr[i]); ASSERT_STREQ(node->mName.C_Str(), chainStr[i]);
parent = node; parent = node;
} }
ASSERT_EQ(0, parent->mNumChildren) << "Leaf node"; ASSERT_EQ(0u, parent->mNumChildren) << "Leaf node";
} }
TEST_F( utFBXImporterExporter, importPhongMaterial ) { TEST_F( utFBXImporterExporter, importPhongMaterial ) {
@ -244,7 +244,7 @@ TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) {
EXPECT_EQ(aiReturn_SUCCESS, mat->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes)); EXPECT_EQ(aiReturn_SUCCESS, mat->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes));
ASSERT_STREQ(path.C_Str(), "..\\..\\..\\Desktop\\uv_test.png"); ASSERT_STREQ(path.C_Str(), "..\\..\\..\\Desktop\\uv_test.png");
ASSERT_EQ(1, scene->mNumTextures); ASSERT_EQ(1u, scene->mNumTextures);
ASSERT_TRUE(scene->mTextures[0]->pcData); ASSERT_TRUE(scene->mTextures[0]->pcData);
ASSERT_EQ(439176u, scene->mTextures[0]->mWidth) << "FBX ASCII base64 compression splits data by 512Kb, it should be two parts for this texture"; ASSERT_EQ(439176u, scene->mTextures[0]->mWidth) << "FBX ASCII base64 compression splits data by 512Kb, it should be two parts for this texture";
} }
@ -255,7 +255,7 @@ TEST_F(utFBXImporterExporter, importEmbeddedFragmentedAsciiTest) {
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/FBX/embedded_ascii/box_embedded_texture_fragmented.fbx", aiProcess_ValidateDataStructure); const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/FBX/embedded_ascii/box_embedded_texture_fragmented.fbx", aiProcess_ValidateDataStructure);
EXPECT_NE(nullptr, scene); EXPECT_NE(nullptr, scene);
EXPECT_EQ(1, scene->mNumMaterials); EXPECT_EQ(1u, scene->mNumMaterials);
aiMaterial *mat = scene->mMaterials[0]; aiMaterial *mat = scene->mMaterials[0];
ASSERT_NE(nullptr, mat); ASSERT_NE(nullptr, mat);
@ -264,7 +264,7 @@ TEST_F(utFBXImporterExporter, importEmbeddedFragmentedAsciiTest) {
ASSERT_EQ(aiReturn_SUCCESS, mat->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes)); ASSERT_EQ(aiReturn_SUCCESS, mat->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes));
ASSERT_STREQ(path.C_Str(), "paper.png"); ASSERT_STREQ(path.C_Str(), "paper.png");
ASSERT_EQ(1, scene->mNumTextures); ASSERT_EQ(1u, scene->mNumTextures);
ASSERT_TRUE(scene->mTextures[0]->pcData); ASSERT_TRUE(scene->mTextures[0]->pcData);
ASSERT_EQ(968029u, scene->mTextures[0]->mWidth) << "FBX ASCII base64 compression splits data by 512Kb, it should be two parts for this texture"; ASSERT_EQ(968029u, scene->mTextures[0]->mWidth) << "FBX ASCII base64 compression splits data by 512Kb, it should be two parts for this texture";
} }

View File

@ -157,9 +157,9 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLinesLoopWithoutIndices) {
//Lines loop without indices //Lines loop without indices
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_02.gltf", aiProcess_ValidateDataStructure); const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_02.gltf", aiProcess_ValidateDataStructure);
EXPECT_NE(nullptr, scene); EXPECT_NE(nullptr, scene);
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
std::array<unsigned int, 5> l1 = {{ 0, 1, 2, 3, 0 }}; std::array<unsigned int, 5> l1 = {{ 0u, 1u, 2u, 3u, 0u }};
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u); EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u);
for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) {
EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2u); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2u);
@ -173,9 +173,9 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLinesStripWithoutIndices) {
//Lines strip without indices //Lines strip without indices
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_03.gltf", aiProcess_ValidateDataStructure); const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_03.gltf", aiProcess_ValidateDataStructure);
EXPECT_NE(nullptr, scene); EXPECT_NE(nullptr, scene);
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 5); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 5u);
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2); EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u);
for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) { for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) {
EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2u); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mNumIndices, 2u);
EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], i);
@ -190,7 +190,7 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesStripWithoutIndices
EXPECT_NE(nullptr, scene); EXPECT_NE(nullptr, scene);
EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u); EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u);
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
std::array<unsigned int, 3> f1 = {{ 0, 1, 2 }}; std::array<unsigned int, 3> f1 = {{ 0u, 1u, 2u }};
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u); EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u);
for (unsigned int i = 0; i < 3; ++i) { for (unsigned int i = 0; i < 3; ++i) {
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]);
@ -210,13 +210,13 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFanWithoutIndices)
EXPECT_NE(nullptr, scene); EXPECT_NE(nullptr, scene);
EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u); EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u);
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
std::array<int, 3> f1 = {{ 0, 1, 2 }}; std::array<int, 3> f1 = {{ 0u, 1u, 2u }};
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u); EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u);
for (size_t i = 0; i < 3; ++i) { for (size_t i = 0; i < 3; ++i) {
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]);
} }
std::array<unsigned int, 3> f2 = {{ 0, 2, 3 }}; std::array<unsigned int, 3> f2 = {{ 0u, 2u, 3u }};
EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u); EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u);
for (size_t i = 0; i < 3; ++i) { for (size_t i = 0; i < 3; ++i) {
EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]); EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]);
@ -260,8 +260,8 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLines) {
//Lines //Lines
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_08.gltf", aiProcess_ValidateDataStructure); const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_08.gltf", aiProcess_ValidateDataStructure);
EXPECT_NE(nullptr, scene); EXPECT_NE(nullptr, scene);
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
std::array<unsigned int, 5> l1 = {{ 0, 3, 2, 1, 0 }}; std::array<unsigned int, 5> l1 = {{ 0u, 3u, 2u, 1u, 0u }};
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u); EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u);
for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
{ {
@ -275,9 +275,9 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineLoop) {
//Line loop //Line loop
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_09.gltf", aiProcess_ValidateDataStructure); const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_09.gltf", aiProcess_ValidateDataStructure);
EXPECT_NE(nullptr, scene); EXPECT_NE(nullptr, scene);
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
std::array<int, 5> l1 = {{ 0, 3, 2, 1, 0 }}; std::array<int, 5> l1 = {{ 0, 3u, 2u, 1u, 0u }};
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2); EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u);
for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i)
{ {
EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]);
@ -290,11 +290,10 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeLineStrip) {
//Lines Strip //Lines Strip
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_10.gltf", aiProcess_ValidateDataStructure); const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_10.gltf", aiProcess_ValidateDataStructure);
EXPECT_NE(nullptr, scene); EXPECT_NE(nullptr, scene);
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
std::array<int, 5> l1 = {{ 0, 3, 2, 1, 0 }}; std::array<int, 5> l1 = {{ 0u, 3u, 2u, 1u, 0u }};
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2); EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 2u);
for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) for (unsigned int i = 0; i < scene->mMeshes[0]->mNumFaces; ++i) {
{
EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[0], l1[i]);
EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i + 1]); EXPECT_EQ(scene->mMeshes[0]->mFaces[i].mIndices[1], l1[i + 1]);
} }
@ -305,19 +304,17 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesStrip) {
//Triangles strip //Triangles strip
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_11.gltf", aiProcess_ValidateDataStructure); const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_11.gltf", aiProcess_ValidateDataStructure);
EXPECT_NE(nullptr, scene); EXPECT_NE(nullptr, scene);
EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2); EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u);
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
std::array<int, 3> f1 = {{ 0, 3, 1 }}; std::array<int, 3> f1 = {{ 0u, 3u, 1u }};
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3); EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3u);
for (int i = 0; i < 3; ++i) for (size_t i = 0; i < 3; ++i) {
{
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]);
} }
std::array<int, 3> f2 = {{ 1, 3, 2 }}; std::array<int, 3> f2 = {{ 1u, 3u, 2u }};
EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3); EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u);
for (int i = 0; i < 3; ++i) for (size_t i = 0; i < 3; ++i) {
{
EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]); EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]);
} }
} }
@ -327,16 +324,16 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFan) {
//Triangles fan //Triangles fan
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_12.gltf", aiProcess_ValidateDataStructure); const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/glTF-Asset-Generator/Mesh_PrimitiveMode/Mesh_PrimitiveMode_12.gltf", aiProcess_ValidateDataStructure);
EXPECT_NE(nullptr, scene); EXPECT_NE(nullptr, scene);
EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4); EXPECT_EQ(scene->mMeshes[0]->mNumVertices, 4u);
EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2); EXPECT_EQ(scene->mMeshes[0]->mNumFaces, 2u);
std::array<int, 3> f1 = {{ 0, 3, 2 }}; std::array<int, 3> f1 = {{ 0u, 3u, 2u }};
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3); EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mNumIndices, 3);
for (size_t i = 0; i < 3; ++i) { for (size_t i = 0; i < 3; ++i) {
EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]); EXPECT_EQ(scene->mMeshes[0]->mFaces[0].mIndices[i], f1[i]);
} }
std::array<unsigned int, 3> f2 = {{ 0, 2, 1 }}; std::array<unsigned int, 3> f2 = {{ 0u, 2u, 1u }};
EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3); EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mNumIndices, 3u );
for (size_t i = 0; i < 3; ++i) { for (size_t i = 0; i < 3; ++i) {
EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]); EXPECT_EQ(scene->mMeshes[0]->mFaces[1].mIndices[i], f2[i]);
} }
@ -373,7 +370,8 @@ TEST_F(utglTF2ImportExport, importglTF2FromMemory) {
TEST_F( utglTF2ImportExport, bug_import_simple_skin ) { TEST_F( utglTF2ImportExport, bug_import_simple_skin ) {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/simple_skin/simple_skin.gltf", aiProcess_ValidateDataStructure ); const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/glTF2/simple_skin/simple_skin.gltf",
aiProcess_ValidateDataStructure );
EXPECT_NE( nullptr, scene ); EXPECT_NE( nullptr, scene );
} }