stuff-from-scratch/test/publishing/TestSvgConverter.cpp
2022-12-11 19:50:34 +00:00

36 lines
884 B
C++

#include "SvgWriter.h"
#include "SvgDocument.h"
#include "SvgConverter.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);
SvgConverter converter;
auto svg_document = converter.convert(&scene);
svg_document->setViewBox(0, 0, 200, 200);
SvgWriter writer;
auto content = writer.toString(svg_document.get());
auto outFile = std::make_unique<File>(TestUtils::getTestOutputDir(__FILE__) / "scene.svg");
outFile->writeText(content);
}