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

43 lines
1.3 KiB
C++
Raw Normal View History

2023-01-17 17:41:27 +00:00
#include "TestFramework.h"
#include "TestRenderUtils.h"
#include "TestUtils.h"
#include "SvgReader.h"
#include "SvgWriter.h"
#include "SvgNode.h"
2023-01-19 14:25:58 +00:00
#include "MediaResourceManager.h"
2023-01-17 17:41:27 +00:00
2023-01-19 14:25:58 +00:00
TEST_CASE(TestSvgToNodeConverter_Circles, "publishing")
2023-01-17 17:41:27 +00:00
{
SvgReader svg_reader;
auto svg_doc = svg_reader.read(TestUtils::getTestDataDir() / "circles.svg");
SvgWriter svg_writer;
2023-01-19 14:25:58 +00:00
svg_writer.toFile(TestUtils::getTestOutputDir(__FILE__) / "TestSvgToNodeConverter_Circles.svg", svg_doc.get());
2023-01-17 17:41:27 +00:00
TestRenderer renderer;
auto svg_node = std::make_unique<SvgNode>(Point(0.0, 0.0));
svg_node->setContent(std::move(svg_doc));
renderer.getScene()->addNode(svg_node.get());
2023-01-19 14:25:58 +00:00
renderer.write(TestUtils::getTestOutputDir(__FILE__) / "TestSvgToNodeConverter_Circles.png");
}
TEST_CASE(TestSvgToNodeConverter_Path, "publishing")
{
SvgReader svg_reader;
auto svg_doc = svg_reader.read(MediaResourceManager::getSvgIconPath(Resource::Icon::Svg::HOME_MEDIUM));
auto svg_node = std::make_unique<SvgNode>(Point(0.0, 0.0));
svg_node->setContent(std::move(svg_doc));
TestRenderer renderer;
renderer.getScene()->addNode(svg_node.get());
renderer.writeSvg(TestUtils::getTestOutputDir(__FILE__) / "TestSvgToNodeConverter_Path.svg");
renderer.write(TestUtils::getTestOutputDir(__FILE__) / "TestSvgToNodTestSvgToNodeConverter_PathConverter.png");
2023-01-17 17:41:27 +00:00
}