add unit test for emitting NUL cell #2002

This commit is contained in:
nick black 2021-07-30 19:14:54 -04:00
parent 1a97b49ac8
commit 6ad09dd30c
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -103,6 +103,26 @@ TEST_CASE("Plane") {
CHECK(0 > ncplane_set_fg_rgb8(n_, 256, 256, 256));
}
// Verify we can emit a NUL character, and it advances the cursor after
// wiping out whatever we printed it atop.
SUBCASE("EmitNULCell") {
nccell c = CELL_CHAR_INITIALIZER('a');
CHECK(0 < ncplane_putc_yx(n_, 0, 0, &c));
CHECK(0 == strcmp("a", ncplane_at_yx(n_, 0, 0, nullptr, nullptr)));
int y, x;
ncplane_cursor_yx(n_, &y, &x);
CHECK(0 == y);
CHECK(1 == x);
CHECK(0 == notcurses_render(nc_));
c = CELL_TRIVIAL_INITIALIZER;
CHECK(0 < ncplane_putc_yx(n_, 0, 0, &c));
CHECK(0 == strcmp("", ncplane_at_yx(n_, 0, 0, nullptr, nullptr)));
ncplane_cursor_yx(n_, &y, &x);
CHECK(0 == y);
CHECK(1 == x);
CHECK(0 == notcurses_render(nc_));
}
// Verify we can emit a multibyte character, and it advances the cursor
SUBCASE("EmitCell") {
const char cchar[] = "";