Add win32 mouse button events.
This commit is contained in:
parent
2bc53186bc
commit
78a4fa99ff
20 changed files with 141 additions and 53 deletions
|
@ -1,9 +1,14 @@
|
|||
#include "TestUiApplication.h"
|
||||
#include "TestFramework.h"
|
||||
#include "TestRenderUtils.h"
|
||||
#include "TestUtils.h"
|
||||
|
||||
#include "RectangleNode.h"
|
||||
#include "TextNode.h"
|
||||
|
||||
#include "Button.h"
|
||||
#include "TransformNode.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
@ -20,5 +25,31 @@ TEST_CASE(TestD2dRendering, "graphics")
|
|||
scene->addNode(text_node.get());
|
||||
|
||||
scene->update();
|
||||
gui_app->run();
|
||||
};
|
||||
|
||||
TEST_CASE(TestD2dWidgetRendering, "graphics")
|
||||
{
|
||||
auto gui_app = TestCaseRunner::getInstance().getTestApplication();
|
||||
auto scene = gui_app->getMainWindowScene();
|
||||
|
||||
Widget widget;
|
||||
widget.setBackgroundColor({ 0, 200, 0 });
|
||||
widget.setBounds(300, 300);
|
||||
|
||||
auto button = Button::Create();
|
||||
button->setBackgroundColor({ 200, 0, 0 });
|
||||
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);
|
||||
|
||||
gui_app->run();
|
||||
};
|
|
@ -41,9 +41,14 @@ public:
|
|||
}
|
||||
|
||||
void writeSvg(const Path& path)
|
||||
{
|
||||
writeSvg(path, mSurface->getScene());
|
||||
}
|
||||
|
||||
static void writeSvg(const Path& path, Scene* scene)
|
||||
{
|
||||
SvgConverter converter;
|
||||
auto svg_document = converter.convert(mSurface->getScene());
|
||||
auto svg_document = converter.convert(scene);
|
||||
|
||||
SvgWriter writer;
|
||||
auto svg_content = writer.toString(svg_document.get());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue