2023-01-12 09:18:16 +00:00
|
|
|
#include "TestFramework.h"
|
|
|
|
#include "TestUtils.h"
|
|
|
|
|
2023-01-12 10:58:43 +00:00
|
|
|
#include "TestRenderUtils.h"
|
2023-01-12 09:18:16 +00:00
|
|
|
#include "StringUtils.h"
|
|
|
|
|
2023-01-25 16:51:36 +00:00
|
|
|
#include "EquationNode.h"
|
|
|
|
#include "LatexMathExpression.h"
|
|
|
|
|
2023-01-12 09:18:16 +00:00
|
|
|
|
|
|
|
TEST_CASE(TestLatexConverter, "publishing")
|
|
|
|
{
|
2023-01-26 11:27:35 +00:00
|
|
|
auto expression = std::make_unique<LatexMathExpression>("\\psi = \\frac{\\alpha + \\beta}{c + d} + \\ket{e}");
|
2023-01-25 16:51:36 +00:00
|
|
|
|
|
|
|
auto equation_node = std::make_unique<EquationNode>(Point(10, 10));
|
|
|
|
equation_node->setContent(expression.get());
|
2023-01-12 10:58:43 +00:00
|
|
|
|
|
|
|
auto psi = LatexSymbolLookup::getSymbolUtf8("psi");
|
|
|
|
auto alpha = LatexSymbolLookup::getSymbolUtf8("alpha");
|
|
|
|
auto beta = LatexSymbolLookup::getSymbolUtf8("beta");
|
|
|
|
|
|
|
|
auto content = *psi + " " + *alpha + " " + *beta + " ";
|
2023-01-12 09:18:16 +00:00
|
|
|
|
2023-01-12 10:58:43 +00:00
|
|
|
TestRenderer renderer(800, 800);
|
2023-01-12 09:18:16 +00:00
|
|
|
|
2023-01-25 16:51:36 +00:00
|
|
|
renderer.getScene()->addNode(equation_node.get());
|
|
|
|
renderer.writeSvg(TestUtils::getTestOutputDir(__FILE__) / "out.svg");
|
2023-01-12 10:58:43 +00:00
|
|
|
renderer.write(TestUtils::getTestOutputDir(__FILE__) / "out.png");
|
2023-01-12 09:18:16 +00:00
|
|
|
};
|