From 0ea46825867fc0f9f0a54b59e0b929ff3d31e6b7 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 2 Nov 2015 21:09:26 +0100 Subject: [PATCH] Collada Export test: fix unit test for lightsCollada Export test: fix unit test for lights.. --- test/unit/utColladaExportCamera.cpp | 2 +- test/unit/utColladaExportLight.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test/unit/utColladaExportCamera.cpp b/test/unit/utColladaExportCamera.cpp index 41a4dce3a..0d864553b 100644 --- a/test/unit/utColladaExportCamera.cpp +++ b/test/unit/utColladaExportCamera.cpp @@ -74,7 +74,7 @@ TEST_F(ColladaExportCamera, testExportCamera) const aiCamera *read = imported->mCameras[ i ]; EXPECT_TRUE( names[ i ] == read->mName ); - EXPECT_FLOAT_EQ( origFOV[ i ],read->mHorizontalFOV ); + EXPECT_NEAR( origFOV[ i ],read->mHorizontalFOV, 0.0001f ); EXPECT_FLOAT_EQ( orifClipPlaneNear[ i ], read->mClipPlaneNear); EXPECT_FLOAT_EQ( orifClipPlaneFar[ i ], read->mClipPlaneFar); diff --git a/test/unit/utColladaExportLight.cpp b/test/unit/utColladaExportLight.cpp index 7c4d2edef..95c44f7bc 100644 --- a/test/unit/utColladaExportLight.cpp +++ b/test/unit/utColladaExportLight.cpp @@ -49,7 +49,9 @@ TEST_F(ColladaExportLight, testExportLight) const unsigned int origNumLights( pTest->mNumLights ); aiLight *origLights = new aiLight[ origNumLights ]; + std::vector origNames; for (size_t i = 0; i < origNumLights; i++) { + origNames.push_back( pTest->mLights[ i ]->mName.C_Str() ); origLights[ i ] = *(pTest->mLights[ i ]); } @@ -62,17 +64,17 @@ TEST_F(ColladaExportLight, testExportLight) EXPECT_TRUE(imported->HasLights()); EXPECT_EQ( origNumLights,imported->mNumLights ); - for(size_t i=0; i< pTest->mNumLights;i++){ + for(size_t i=0; i< origNumLights; i++){ const aiLight *orig = &origLights[ i ]; const aiLight *read = imported->mLights[i]; - EXPECT_TRUE(orig->mName==read->mName); + EXPECT_EQ(0,strncmp(origNames[ i ].c_str(),read->mName.C_Str(), origNames[ i ].size() ) ); EXPECT_EQ(orig->mType,read->mType); EXPECT_FLOAT_EQ(orig->mAttenuationConstant,read->mAttenuationConstant); EXPECT_FLOAT_EQ(orig->mAttenuationLinear,read->mAttenuationLinear); - EXPECT_FLOAT_EQ(orig->mAttenuationQuadratic,read->mAttenuationQuadratic); + EXPECT_NEAR(orig->mAttenuationQuadratic,read->mAttenuationQuadratic, 0.001f); EXPECT_FLOAT_EQ(orig->mColorAmbient.r,read->mColorAmbient.r); EXPECT_FLOAT_EQ(orig->mColorAmbient.g,read->mColorAmbient.g); @@ -89,6 +91,7 @@ TEST_F(ColladaExportLight, testExportLight) EXPECT_NEAR(orig->mAngleInnerCone,read->mAngleInnerCone,0.001); EXPECT_NEAR(orig->mAngleOuterCone,read->mAngleOuterCone,0.001); } + delete [] origLights; }