#include "GUIXMLDefaultTest.hpp"

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

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

void GUIXMLDefaultTest() 
{
	UTest u("GUI XML Default");

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

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

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

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

	u.test("cPanel Position", panel->getPosition(false) == GUIHelpers::Position{ 0, 0 });

	u.test("cPanel Size", panel->getSize(false) == GUIHelpers::Size{ 200, 200 });

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

	u.test("cPanel Center", panel->getCenter() == GUIHelpers::Position{ 100, 100 });

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

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

	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{ 100, 100 });

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

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

	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{ 100, 100 });

	u.report();

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