Files
MuditaOS/module-gui/test/test-catch-text/test-gui-TextParse.cpp
pholat fb586cb4e9 EGD-3229 (#497)
* EGD-3229 text helper classes added with tests - used in tests, plus misc utils needed

No major actual functionality changed - TextClasses added with this PR
are used in tests only in this commit.
* classes needed to rewrite gui::Text added
* some utilities needed to rewrite gui::Text added
* tests added
2020-07-06 16:19:41 +02:00

31 lines
695 B
C++

#include <catch2/catch.hpp>
#include <limits>
#include <module-gui/gui/widgets/TextParse.hpp>
#include <sstream>
#include <mock/multi-line-string.hpp>
TEST_CASE("TextParse")
{
using namespace gui;
SECTION("empty")
{
auto res = textToTextBlocks("", nullptr);
REQUIRE(res.size() == 0);
}
SECTION("oneline")
{
auto res = textToTextBlocks("this is text", nullptr);
REQUIRE(res.size() == 1);
}
SECTION("multi-line")
{
const auto no_lines = 3;
auto text = mockup::multiLineString(no_lines);
auto res = textToTextBlocks(text, nullptr);
REQUIRE(res.size() == no_lines);
}
}