From 68d33a99a17b5de2e069d4facbdbbbea95effd09 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 23 Sep 2016 10:10:00 +0200 Subject: [PATCH] ModelDiffer: update material testser + create material for unittests. --- test/unit/ModelDiffer.cpp | 8 ++++++++ test/unit/utObjImportExport.cpp | 1 + 2 files changed, 9 insertions(+) diff --git a/test/unit/ModelDiffer.cpp b/test/unit/ModelDiffer.cpp index f443b322d..8858ce8c5 100644 --- a/test/unit/ModelDiffer.cpp +++ b/test/unit/ModelDiffer.cpp @@ -94,6 +94,14 @@ bool ModelDiffer::isEqual( const aiScene *expected, const aiScene *toCompare ) { addDiff( stream.str() ); return false; } + + if ( expected->mNumMaterials > 0 ) { + if ( nullptr == expected->mMaterials || nullptr == toCompare->mMaterials ) { + addDiff( "Number of materials > 0 and mat pointer is nullptr" ); + return false; + } + } + for ( unsigned int i = 0; i < expected->mNumMaterials; i++ ) { aiMaterial *expectedMat( expected->mMaterials[ i ] ); aiMaterial *toCompareMat( expected->mMaterials[ i ] ); diff --git a/test/unit/utObjImportExport.cpp b/test/unit/utObjImportExport.cpp index 6e54dcdba..63d2c4ee5 100644 --- a/test/unit/utObjImportExport.cpp +++ b/test/unit/utObjImportExport.cpp @@ -124,6 +124,7 @@ protected: expScene->mMeshes[ 0 ] = mesh; expScene->mNumMaterials = 1; + expScene->mMaterials = new aiMaterial*[ expScene->mNumMaterials ]; return expScene; }