stuff-from-scratch/test/publishing/TestSvgConverter.cpp
2023-01-17 17:41:27 +00:00

33 lines
780 B
C++

#include "SvgWriter.h"
#include "SvgDocument.h"
#include "SvgPainter.h"
#include "Scene.h"
#include "CircleNode.h"
#include "RectangleNode.h"
#include "File.h"
#include "TestFramework.h"
#include "TestUtils.h"
TEST_CASE(TestSvgConverter, "[publishing]")
{
Scene scene;
//scene.setShowMeshOutline(true);
CircleNode circle({40, 40}, 20);
circle.setFillColor({255, 0, 0});
scene.addNode(&circle);
//RectangleNode rectangle({10, 10}, 20, 20);
//rectangle.setFillColor({255, 0, 0});
//scene.addNode(&rectangle);
SvgPainter painter;
auto svg_document = painter.paint(&scene);
svg_document->setViewBox(0, 0, 200, 200);
SvgWriter writer;
writer.toFile(TestUtils::getTestOutputDir(__FILE__) / "scene.svg", svg_document.get());
}