LayoutNewlines unit test #829

pull/938/head
nick black 4 years ago committed by Nick Black
parent 679e2d25f8
commit adab5ba382

@ -85,6 +85,24 @@ TEST_CASE("TextLayout") {
ncplane_destroy(sp);
}
// ensure we're honoring newlines
SUBCASE("LayoutNewlines") {
auto sp = ncplane_new(nc_, 5, 5, 0, 0, nullptr);
REQUIRE(sp);
const char boundstr[] = "a\nb\nc\nd\ne";
size_t bytes;
CHECK(0 < ncplane_puttext(sp, 0, NCALIGN_LEFT, boundstr, &bytes));
CHECK(0 == notcurses_render(nc_));
CHECK(bytes == strlen(boundstr));
char* line = ncplane_contents(sp, 0, 0, -1, -1);
REQUIRE(line);
fprintf(stderr, "LINE: [%s]\n", line);
sleep(5);
CHECK(0 == strcmp(line, "a b c d e"));
free(line);
ncplane_destroy(sp);
}
// lay out text where a wide word crosses the boundary
SUBCASE("LayoutCrossBoundaryWide") {
if(enforce_utf8()){

Loading…
Cancel
Save