mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-07-25 15:28:27 -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
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
#include "multi-line-string.hpp"
|
|
#include <ostream>
|
|
#include <sstream>
|
|
|
|
namespace mockup
|
|
{
|
|
auto multiLineString(unsigned int no_lines) -> std::string
|
|
{
|
|
std::stringstream text;
|
|
for (auto el : lineStrings(no_lines)) {
|
|
text << el;
|
|
}
|
|
return text.str();
|
|
}
|
|
|
|
auto multiWordString(unsigned int no_words) -> std::string
|
|
{
|
|
std::stringstream text;
|
|
for (unsigned int i = 0; i < no_words; ++i) {
|
|
/// pre pend with `-`
|
|
for (unsigned int j = 1; j < no_words; ++j) {
|
|
text << "-";
|
|
}
|
|
/// `word:<no>`
|
|
text << "word:" << i << " ";
|
|
}
|
|
return text.str();
|
|
}
|
|
|
|
auto lineStrings(unsigned int count) -> std::list<std::string>
|
|
{
|
|
std::list<std::string> list;
|
|
for (unsigned int i = 0; i < count; ++i) {
|
|
std::stringstream text;
|
|
text << "line:" << i << std::endl;
|
|
list.push_back(text.str());
|
|
}
|
|
return list;
|
|
}
|
|
}; // namespace mockup
|