2009-01-12 22:06:54 +00:00
|
|
|
#include "UnitTestPCH.h"
|
2008-08-06 23:01:38 +00:00
|
|
|
|
2014-09-07 23:52:03 +00:00
|
|
|
#include <GenVertexNormalsProcess.h>
|
|
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace Assimp;
|
|
|
|
|
|
|
|
class GenNormalsTest : public ::testing::Test
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void SetUp();
|
|
|
|
virtual void TearDown();
|
2008-08-06 23:01:38 +00:00
|
|
|
|
2014-09-07 23:52:03 +00:00
|
|
|
protected:
|
|
|
|
aiMesh* pcMesh;
|
|
|
|
GenVertexNormalsProcess* piProcess;
|
|
|
|
};
|
2008-08-06 23:01:38 +00:00
|
|
|
|
2014-09-07 23:52:03 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void GenNormalsTest::SetUp()
|
2008-08-06 23:01:38 +00:00
|
|
|
{
|
2009-01-12 22:06:54 +00:00
|
|
|
piProcess = new GenVertexNormalsProcess();
|
|
|
|
pcMesh = new aiMesh();
|
|
|
|
pcMesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
|
2008-08-06 23:01:38 +00:00
|
|
|
pcMesh->mNumFaces = 1;
|
|
|
|
pcMesh->mFaces = new aiFace[1];
|
|
|
|
pcMesh->mFaces[0].mIndices = new unsigned int[pcMesh->mFaces[0].mNumIndices = 3];
|
|
|
|
pcMesh->mFaces[0].mIndices[0] = 0;
|
|
|
|
pcMesh->mFaces[0].mIndices[1] = 1;
|
|
|
|
pcMesh->mFaces[0].mIndices[2] = 1;
|
|
|
|
pcMesh->mNumVertices = 3;
|
|
|
|
pcMesh->mVertices = new aiVector3D[3];
|
|
|
|
pcMesh->mVertices[0] = aiVector3D(0.0f,1.0f,6.0f);
|
|
|
|
pcMesh->mVertices[1] = aiVector3D(2.0f,3.0f,1.0f);
|
|
|
|
pcMesh->mVertices[2] = aiVector3D(3.0f,2.0f,4.0f);
|
|
|
|
}
|
|
|
|
|
2014-09-07 23:52:03 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void GenNormalsTest::TearDown()
|
2008-08-06 23:01:38 +00:00
|
|
|
{
|
|
|
|
delete this->pcMesh;
|
|
|
|
delete this->piProcess;
|
|
|
|
}
|
|
|
|
|
2014-09-07 23:52:03 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
TEST_F(GenNormalsTest, testSimpleTriangle)
|
2008-08-06 23:01:38 +00:00
|
|
|
{
|
2014-09-07 23:52:03 +00:00
|
|
|
piProcess->GenMeshVertexNormals(pcMesh, 0);
|
|
|
|
EXPECT_TRUE(pcMesh->mNormals != NULL);
|
2008-08-06 23:01:38 +00:00
|
|
|
}
|