#include "GUIXMLPositionTest.hpp"

#include "../UTest/UTest.hpp"

/*** TrooperEngine DLL Header Files ***/
#include "TrooperEngine.hpp"

void GUIXMLPositionTest()
{
	UTest u("GUI XML Position");

	GUIEngine::cGUI::Inst().Delete();

	GUIEngine::cGUI::Inst().Initialize("GUIXMLPositionTest.xml", "xml/");
	printf("\nUsing GUIXMLPositionTest.xml file.\n");

	GUIEngine::cGUI::Inst().Display();

	std::vector<GUIEngine::cWindow*> objects = GUIEngine::cGUI::Inst().GetObjects();

	

	GUIEngine::cPanel* panel = (GUIEngine::cPanel*)objects[0];

	//cWinTest(u, panel, GUIHelpers::Position{ 20, 20 }, GUIHelpers::Size{ 200, 200 }, GUIHelpers::Padding{ 5, 5, 5, 5 }, GUIHelpers::Position{ 120, 120 });


	GUIEngine::cLayout* layout = (GUIEngine::cLayout*)panel->getChildren()[0];

	u.test("cLayout Position", layout->getPosition(false) == GUIHelpers::Position{ 25, 25 });

	u.test("cLayout Size", layout->getSize(false) == GUIHelpers::Size{ 190, 190 });

	u.test("cLayout Padding", layout->getPadding() == GUIHelpers::Padding{ 5, 5, 5, 5 });

	u.test("cLayout Center", layout->getCenter() == GUIHelpers::Position{ 120, 120 });

	GUIEngine::cLabel* label = (GUIEngine::cLabel*)layout->getChildren()[0];

	u.test("cLabel Position", label->getPosition(false) == GUIHelpers::Position{ 76, 116 });

	u.test("cLabel Size", label->getSize(false) == GUIHelpers::Size{ 88, 8 });

	u.test("cLabel Padding", label->getPadding() == GUIHelpers::Padding{ 5, 5, 5, 5 });

	u.test("cLabel Center", label->getCenter() == GUIHelpers::Position{ 120, 120 });

	u.report();

	GUIEngine::cGUI::Inst().Delete();
}