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

29 lines
721 B
C++
Raw Normal View History

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-12 10:58:43 +00:00
#include "FontItem.h"
#include "TextNode.h"
#include "LatexSymbols.h"
2023-01-12 09:18:16 +00:00
TEST_CASE(TestLatexConverter, "publishing")
{
2023-01-12 10:58:43 +00:00
FontItem font("Cambria Math", 14);
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-12 10:58:43 +00:00
auto text = std::make_unique<TextNode>(content, Point(10, 10));
text->setFont(font);
2023-01-12 09:18:16 +00:00
2023-01-12 10:58:43 +00:00
renderer.getScene()->addNode(text.get());
2023-01-12 09:18:16 +00:00
2023-01-12 10:58:43 +00:00
renderer.write(TestUtils::getTestOutputDir(__FILE__) / "out.png");
2023-01-12 09:18:16 +00:00
};