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

29 lines
No EOL
879 B
C++

#include "TestFramework.h"
#include "TestUtils.h"
#include "TestRenderUtils.h"
#include "StringUtils.h"
#include "EquationNode.h"
#include "LatexMathExpression.h"
TEST_CASE(TestLatexConverter, "publishing")
{
auto expression = std::make_unique<LatexMathExpression>("\\psi = \\frac{\\alpha + \\beta}{c}");
auto equation_node = std::make_unique<EquationNode>(Point(10, 10));
equation_node->setContent(expression.get());
auto psi = LatexSymbolLookup::getSymbolUtf8("psi");
auto alpha = LatexSymbolLookup::getSymbolUtf8("alpha");
auto beta = LatexSymbolLookup::getSymbolUtf8("beta");
auto content = *psi + " " + *alpha + " " + *beta + " ";
TestRenderer renderer(800, 800);
renderer.getScene()->addNode(equation_node.get());
renderer.writeSvg(TestUtils::getTestOutputDir(__FILE__) / "out.svg");
renderer.write(TestUtils::getTestOutputDir(__FILE__) / "out.png");
};