Initial scene to svg conversion.
This commit is contained in:
parent
65ac927929
commit
1fc730d413
15 changed files with 164 additions and 28 deletions
|
@ -1,6 +1,7 @@
|
|||
set(PUBLISHING_UNIT_TEST_FILES
|
||||
publishing/TestPdfWriter.cpp
|
||||
publishing/TestDocumentConverter.cpp
|
||||
publishing/TestSvgConverter.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
|
|
28
test/publishing/TestSvgConverter.cpp
Normal file
28
test/publishing/TestSvgConverter.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#include "SvgWriter.h"
|
||||
#include "SvgDocument.h"
|
||||
#include "SvgConverter.h"
|
||||
#include "Scene.h"
|
||||
|
||||
#include "CircleNode.h"
|
||||
|
||||
#include "File.h"
|
||||
|
||||
#include "TestFramework.h"
|
||||
#include "TestUtils.h"
|
||||
|
||||
TEST_CASE(TestSvgConverter, "[publishing]")
|
||||
{
|
||||
Scene scene;
|
||||
|
||||
CircleNode circle({10, 10}, 20);
|
||||
scene.addNode(&circle);
|
||||
|
||||
SvgConverter converter;
|
||||
auto svg_document = converter.convert(&scene);
|
||||
|
||||
SvgWriter writer;
|
||||
auto content = writer.toString(svg_document.get());
|
||||
|
||||
auto outFile = std::make_unique<File>(TestUtils::getTestOutputDir(__FILE__) / "scene.svg");
|
||||
outFile->writeText(content);
|
||||
}
|
|
@ -25,6 +25,11 @@ TEST_CASE(TestSvgWriter, "web")
|
|||
rectangle->setFill({0, 0, 255});
|
||||
document->getRoot()->addChild(std::move(rectangle));
|
||||
|
||||
auto triangle = std::make_unique<SvgPolygon>();
|
||||
triangle->setPoints({{10, 10}, {50, 10}, {30, 20}});
|
||||
triangle->setFill({0, 255, 0});
|
||||
document->getRoot()->addChild(std::move(triangle));
|
||||
|
||||
SvgWriter writer;
|
||||
auto content = writer.toString(document.get());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue