stuff-from-scratch/test/publishing/TestSvgConverter.cpp

34 lines
786 B
C++
Raw Normal View History

2022-12-08 08:48:18 +00:00
#include "SvgWriter.h"
#include "SvgDocument.h"
2023-01-17 17:41:27 +00:00
#include "SvgPainter.h"
2022-12-08 08:48:18 +00:00
#include "Scene.h"
#include "CircleNode.h"
2022-12-08 13:52:37 +00:00
#include "RectangleNode.h"
2022-12-08 08:48:18 +00:00
#include "File.h"
#include "TestFramework.h"
#include "TestUtils.h"
TEST_CASE(TestSvgConverter, "[publishing]")
{
Scene scene;
2022-12-11 19:50:34 +00:00
//scene.setShowMeshOutline(true);
2022-12-08 08:48:18 +00:00
2023-02-26 18:23:21 +00:00
CircleNode circle(Point2{40, 40}, 20);
2022-12-08 13:52:37 +00:00
circle.setFillColor({255, 0, 0});
2022-12-08 08:48:18 +00:00
scene.addNode(&circle);
2022-12-08 13:52:37 +00:00
//RectangleNode rectangle({10, 10}, 20, 20);
//rectangle.setFillColor({255, 0, 0});
//scene.addNode(&rectangle);
2023-01-17 17:41:27 +00:00
SvgPainter painter;
auto svg_document = painter.paint(&scene);
2022-12-11 19:50:34 +00:00
svg_document->setViewBox(0, 0, 200, 200);
2022-12-08 08:48:18 +00:00
SvgWriter writer;
2023-01-17 17:41:27 +00:00
writer.toFile(TestUtils::getTestOutputDir(__FILE__) / "scene.svg", svg_document.get());
2022-12-08 08:48:18 +00:00
}