2023-01-11 10:21:18 +00:00
|
|
|
#include "TestUiApplication.h"
|
|
|
|
#include "TestFramework.h"
|
2023-01-17 08:34:48 +00:00
|
|
|
#include "TestRenderUtils.h"
|
|
|
|
#include "TestUtils.h"
|
2023-01-11 10:21:18 +00:00
|
|
|
|
2023-01-12 11:54:08 +00:00
|
|
|
#include "RectangleNode.h"
|
2023-01-11 10:21:18 +00:00
|
|
|
#include "TextNode.h"
|
|
|
|
|
2023-01-17 08:34:48 +00:00
|
|
|
#include "Button.h"
|
|
|
|
#include "TransformNode.h"
|
|
|
|
|
2023-12-27 12:20:02 +00:00
|
|
|
#include "Pointer.h"
|
2023-12-21 09:18:44 +00:00
|
|
|
#include "String.h"
|
2023-01-11 10:21:18 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
TEST_CASE(TestD2dRendering, "graphics")
|
|
|
|
{
|
2023-01-12 11:54:08 +00:00
|
|
|
auto gui_app = TestCaseRunner::getInstance().getTestApplication();
|
|
|
|
auto scene = gui_app->getMainWindowScene();
|
|
|
|
|
2023-01-20 08:07:09 +00:00
|
|
|
auto rect = std::make_unique<RectangleNode>(Transform(Point(10, 10)), 200.0, 200.0);
|
2023-01-12 11:54:08 +00:00
|
|
|
scene->addNode(rect.get());
|
|
|
|
|
2023-01-20 08:07:09 +00:00
|
|
|
auto text_node = std::make_unique<TextNode>("Test2", Transform(Point(100, 100)));
|
2023-01-12 11:54:08 +00:00
|
|
|
scene->addNode(text_node.get());
|
2023-01-11 10:21:18 +00:00
|
|
|
|
2023-01-12 11:54:08 +00:00
|
|
|
scene->update();
|
2023-01-17 08:34:48 +00:00
|
|
|
gui_app->run();
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_CASE(TestD2dWidgetRendering, "graphics")
|
|
|
|
{
|
|
|
|
auto gui_app = TestCaseRunner::getInstance().getTestApplication();
|
|
|
|
auto scene = gui_app->getMainWindowScene();
|
|
|
|
|
|
|
|
Widget widget;
|
|
|
|
widget.setBounds(300, 300);
|
|
|
|
|
|
|
|
auto button = Button::Create();
|
|
|
|
button->setLabel("Test Button");
|
|
|
|
button->setMaxWidth(100);
|
|
|
|
|
|
|
|
widget.addWidget(std::move(button));
|
|
|
|
widget.onPaintEvent(nullptr);
|
|
|
|
|
|
|
|
scene->addNode(widget.getRootNode());
|
|
|
|
|
|
|
|
scene->update();
|
|
|
|
|
|
|
|
TestRenderer::writeSvg(TestUtils::getTestOutputDir(__FILE__) / "TestD2dWidgetRendering.svg", scene);
|
|
|
|
|
2023-01-12 11:54:08 +00:00
|
|
|
gui_app->run();
|
2023-01-11 10:21:18 +00:00
|
|
|
};
|