2015-05-19 04:24:07 +00:00
|
|
|
#include "UnitTestPCH.h"
|
|
|
|
|
|
|
|
#include <assimp/scene.h>
|
|
|
|
#include <BaseProcess.h>
|
|
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace Assimp;
|
|
|
|
|
|
|
|
class SharedPPDataTest : public ::testing::Test
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2015-05-19 04:26:05 +00:00
|
|
|
virtual void SetUp();
|
|
|
|
virtual void TearDown();
|
2015-05-19 04:24:07 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2015-05-19 04:26:05 +00:00
|
|
|
SharedPostProcessInfo* shared;
|
2015-05-19 04:24:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static bool destructed;
|
|
|
|
|
|
|
|
struct TestType
|
|
|
|
{
|
2015-05-19 04:26:05 +00:00
|
|
|
~TestType()
|
|
|
|
{
|
|
|
|
destructed = true;
|
|
|
|
}
|
2015-05-19 04:24:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void SharedPPDataTest::SetUp()
|
|
|
|
{
|
2015-05-19 04:26:05 +00:00
|
|
|
shared = new SharedPostProcessInfo();
|
|
|
|
destructed = false;
|
2015-05-19 04:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void SharedPPDataTest::TearDown()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
TEST_F(SharedPPDataTest, testPODProperty)
|
|
|
|
{
|
2015-05-19 04:26:05 +00:00
|
|
|
int i = 5;
|
|
|
|
shared->AddProperty("test",i);
|
|
|
|
int o;
|
|
|
|
EXPECT_TRUE(shared->GetProperty("test",o));
|
|
|
|
EXPECT_EQ(5, o);
|
|
|
|
EXPECT_FALSE(shared->GetProperty("test2",o));
|
|
|
|
EXPECT_EQ(5, o);
|
|
|
|
|
|
|
|
float f = 12.f, m;
|
|
|
|
shared->AddProperty("test",f);
|
|
|
|
EXPECT_TRUE(shared->GetProperty("test",m));
|
|
|
|
EXPECT_EQ(12.f, m);
|
2015-05-19 04:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
TEST_F(SharedPPDataTest, testPropertyPointer)
|
|
|
|
{
|
2015-05-19 04:26:05 +00:00
|
|
|
int *i = new int[35];
|
|
|
|
shared->AddProperty("test16",i);
|
|
|
|
int* o;
|
|
|
|
EXPECT_TRUE(shared->GetProperty("test16",o));
|
|
|
|
EXPECT_EQ(i, o);
|
|
|
|
shared->RemoveProperty("test16");
|
|
|
|
EXPECT_FALSE(shared->GetProperty("test16",o));
|
2015-05-19 04:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
TEST_F(SharedPPDataTest, testPropertyDeallocation)
|
|
|
|
{
|
2015-05-19 04:26:05 +00:00
|
|
|
TestType *out, * pip = new TestType();
|
|
|
|
shared->AddProperty("quak",pip);
|
|
|
|
EXPECT_TRUE(shared->GetProperty("quak",out));
|
|
|
|
EXPECT_EQ(pip, out);
|
2015-05-19 04:24:07 +00:00
|
|
|
|
2015-05-19 04:26:05 +00:00
|
|
|
delete shared;
|
|
|
|
EXPECT_TRUE(destructed);
|
2015-05-19 04:24:07 +00:00
|
|
|
}
|