mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-07-29 09:18:43 -04:00
* 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
31 lines
695 B
C++
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);
|
|
}
|
|
}
|