stuff-from-scratch/test/graphics/TestD2dOffScreenRendering.cpp
2023-01-11 11:02:03 +00:00

37 lines
No EOL
840 B
C++

#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());
drawing_context->paint();
auto image = surface->getImage();
PngWriter writer;
writer.setPath(TestUtils::getTestOutputDir(__FILE__) / "out.png");
//writer.write(image);
};