#include "TestFramework.h"
#include "TestUtils.h"
#include "TestRenderUtils.h"

#include "ThemeManager.h"
#include "PaintEvent.h"
#include "MouseEvent.h"

#include "VerticalSpacer.h"
#include "MediaResources.h"

#include "Button.h"

TEST_CASE(TestButton_Elevated, "ui_controls")
{
	auto theme_manager = std::make_unique<ThemeManager>();

	VerticalSpacer spacer;
	spacer.setWidth(300);
	spacer.setHeight(200);

	auto enabled_button = Button::Create(ButtonData::Component::Elevated);
	enabled_button->setLabel("Enabled");
	enabled_button->setSvgIcon(Resource::Icon::Svg::HOME_MEDIUM);


	auto disabled_button = Button::Create(ButtonData::Component::Elevated);
	disabled_button->setEnabled(false);
	disabled_button->setLabel("Disabled");
	disabled_button->setSvgIcon(Resource::Icon::Svg::HOME_MEDIUM);

	/*
	auto pressed_button = Button::Create(ButtonData::Component::Elevated);
	pressed_button->setLabel("Pressed");

	*/

	spacer.addWidget(std::move(enabled_button));
	spacer.addWidget(std::move(disabled_button));
	//spacer.addWidget(std::move(pressed_button));

	auto node = spacer.getRootNode();

	TestRenderer renderer;
	renderer.getScene()->addNode(node);

	auto mouse_event = MouseEvent::Create();
	mouse_event->setAction(MouseEvent::Action::Pressed);
	mouse_event->setClientLocation({ 250, 20 });
	//spacer.onMouseEvent(mouse_event.get());

	auto paint_event = PaintEvent::Create(theme_manager.get(), nullptr);
	spacer.onPaintEvent(paint_event.get());

	renderer.writeSvg(TestUtils::getTestOutputDir(__FILE__) / "Elevated.svg");
	renderer.write(TestUtils::getTestOutputDir(__FILE__) / "Elevated.png");

};
