#include "TestFramework.h" #include "TestUtils.h" #include "TestRenderUtils.h" #include "Plot.h" #include "PlotNode.h" #include "PlotSeriesNode.h" #include "PlotCaptionNode.h" #include "EquationNode.h" #include "TextNode.h" #include "LineNode.h" TEST_CASE(TestPlotting, "[publishing]") { auto plot = std::make_unique(); plot->setXAxisCaption("X Axis"); plot->setYAxisCaption("Y Axis"); PlotSeries series("Series-1"); Vector data{ {0.0, 0.0}, {10.0, 40.0}, {20.0, 80.0} }; series.setData(data); plot->addSeries(series); Point loc(10, 10); auto plot_node = std::make_unique(Transform(loc)); plot_node->setAxisEndStyle(LineEndNode::Style::CLOSED_ARROW); plot_node->setContent(plot.get()); TestRenderer renderer(800, 800); auto scene = renderer.getScene(); scene->addNode(plot_node.get()); renderer.writeSvg(TestUtils::getTestOutputDir(__FILE__) / "plot.svg"); renderer.write(TestUtils::getTestOutputDir(__FILE__) / "plot.png"); }