//------------------------------------------------------------------------------
// Lamp : Open source game middleware
// Copyright (C) 2004  Junpei Ohtani ( Email : junpee@users.sourceforge.jp )
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//------------------------------------------------------------------------------

/** @file
 * フォグのテスト実装
 * @author Junpee
 */

#include "Test/stdafx.h"
#include "Graphics/Fog/FogTest.h"
#include "Graphics/System/LampGraphics.h"
#include "Graphics/Fog/Fog.h"

//------------------------------------------------------------------------------
// テストスィートの取得
Test* FogTest::suite(){
	TestSuite* suite = new TestSuite("FogTest");
	suite->addTest(new TestCaller(FogTest, testData));
	return suite;
}
//------------------------------------------------------------------------------
// データテスト
void FogTest::testData(){
//	TestEquals(96, (int)sizeof(Fog));
	Scene* scene = LampGraphics::createScene("test");
	Fog* fog0 = scene->getFog();
	// 有効、無効フラグ
	TestAssert(!fog0->isEnabled());
	fog0->setEnabled(true);
	TestAssert(fog0->isEnabled());
	// カラー
	TestAssert(fog0->getColor() == Color4c(128, 128, 128, 0));
	fog0->setColor(Color4c(1, 2, 3, 0));
	TestAssert(fog0->getColor() == Color4c(1, 2, 3, 0));
	// モード
	TestAssert(fog0->getMode() == Fog::modeLinear);
	fog0->setMode(Fog::modeExponent);
	TestAssert(fog0->getMode() == Fog::modeExponent);
	// 濃度
	TestEquals(0.5f, fog0->getDensity());
	fog0->setDensity(1.f);
	TestEquals(1.f, fog0->getDensity());
	// ニア
	TestEquals(1.f, fog0->getNear());
	fog0->setNear(10.f);
	TestEquals(10.f, fog0->getNear());
	// ファー
	TestEquals(10000.f, fog0->getFar());
	fog0->setFar(1.f);
	TestEquals(1.f, fog0->getFar());

	// 後始末
	TestEquals(0, scene->clear());
	LampGraphics::destroyScene(scene);
}
//------------------------------------------------------------------------------
