Clean up of scene nodes to support 2d and non int positioning.

This commit is contained in:
jmsgrogan 2023-01-11 10:21:18 +00:00
parent 1eeaebd0a9
commit 672b31b603
45 changed files with 341 additions and 200 deletions

View file

@ -8,15 +8,15 @@ set(PLATFORM_UNIT_TEST_FILES
)
endif()
set(GRAPHICS_UNIT_TEST_FILES
graphics/TestRasterizer.cpp
${PLATFORM_UNIT_TEST_FILES}
PARENT_SCOPE
)
if(WIN32)
list(APPEND PLATFORM_UNIT_TEST_FILES
graphics/TestD2DOffScreenRendering.cpp
)
set(GRAPHICS_UI_TEST_FILES
graphics/TestDirectXRendering.cpp
graphics/TestD2DRendering.cpp
PARENT_SCOPE
)
endif()
@ -29,4 +29,10 @@ set(GRAPHICS_UNIT_TEST_DEPENDENCIES
set(GRAPHICS_UI_TEST_DEPENDENCIES
graphics client
PARENT_SCOPE
)
set(GRAPHICS_UNIT_TEST_FILES
graphics/TestRasterizer.cpp
${PLATFORM_UNIT_TEST_FILES}
PARENT_SCOPE
)

View file

@ -0,0 +1,39 @@
#include "TestCase.h"
#include "TestCaseRunner.h"
#include "TestUiApplication.h"
#include "TestFramework.h"
#include "TestUtils.h"
#include "DrawingSurface.h"
#include "DrawingContext.h"
#include "AbstractPainter.h"
#include "Image.h"
#include "PngWriter.h"
#include "RectangleNode.h"
#include "Scene.h"
TEST_CASE(TestD2dOffScreenRendering, "graphics")
{
auto surface = std::make_unique<DrawingSurface>();
surface->setSize(100, 100);
auto drawing_context = std::make_unique<DrawingContext>(surface.get());
auto rect = std::make_unique<RectangleNode>(DiscretePoint(10, 10), 10.0, 20.0);
auto scene = surface->getScene();
scene->addNode(rect.get());
scene->update();
drawing_context->paint();
auto image = surface->getImage();
PngWriter writer;
writer.setPath(TestUtils::getTestOutputDir(__FILE__) / "out.png");
//writer.write(image);
};

View file

@ -0,0 +1,22 @@
#include "TestCase.h"
#include "TestCaseRunner.h"
#include "TestUiApplication.h"
#include "TestFramework.h"
#include "DesktopManager.h"
#include "MeshPrimitives.h"
#include "MeshNode.h"
#include "TextNode.h"
#include "Scene.h"
#include "Widget.h"
#include <memory>
#include <string>
#include <iostream>
TEST_CASE(TestD2dRendering, "graphics")
{
};