add LayoutTransPlanarWide unit test #815

This commit is contained in:
nick black 2020-07-23 21:17:04 -04:00 committed by Nick Black
parent 357cba3843
commit b9ad7b9bd5

View File

@ -118,6 +118,23 @@ TEST_CASE("TextLayout") {
ncplane_destroy(sp); ncplane_destroy(sp);
} }
// a long word (one requiring a split no matter what) ought not force the
// next line, but instead be printed where it starts
SUBCASE("LayoutTransPlanarWide") {
auto sp = ncplane_new(nc_, 2, 8, 0, 0, nullptr);
REQUIRE(sp);
size_t bytes;
const char boundstr[] = "1 我能吞下玻璃";
CHECK(0 < ncplane_puttext(sp, 0, NCALIGN_CENTER, boundstr, &bytes));
CHECK(0 == notcurses_render(nc_));
CHECK(bytes == strlen(boundstr));
char* line = ncplane_contents(sp, 0, 0, -1, -1);
REQUIRE(line);
CHECK(0 == strcmp(line, "1 我能吞下玻璃"));
free(line);
ncplane_destroy(sp);
}
SUBCASE("LayoutLeadingSpaces") { SUBCASE("LayoutLeadingSpaces") {
auto sp = ncplane_new(nc_, 3, 10, 0, 0, nullptr); auto sp = ncplane_new(nc_, 3, 10, 0, 0, nullptr);
REQUIRE(sp); REQUIRE(sp);