Strip down OverWide unit test

pull/472/head
nick black 5 years ago committed by Nick Black
parent d26b111f35
commit e6a80ab98d

@ -963,20 +963,17 @@ TEST_CASE("NCPlane") {
CHECK(!(c.channels & 0x8000000080000000ull)); CHECK(!(c.channels & 0x8000000080000000ull));
} }
// Render a translucent plane atop a wide glyph, and check that the colors // Render a translucent plane atop a wide glyph, and check the colors on both
// are right on both cells. // cells. See https://github.com/dankamongmen/notcurses/issues/362.
SUBCASE("OverWide") { SUBCASE("OverWide") {
struct ncplane* p = ncplane_new(nc_, 3, 4, 0, 0, nullptr); struct ncplane* p = ncplane_new(nc_, 3, 4, 0, 0, nullptr);
REQUIRE(nullptr != p); REQUIRE(nullptr != p);
cell c = CELL_SIMPLE_INITIALIZER('X'); cell c = CELL_SIMPLE_INITIALIZER('X');
CHECK(0 == ncplane_perimeter(p, &c, &c, &c, &c, &c, &c, 0)); CHECK(0 == ncplane_perimeter(p, &c, &c, &c, &c, &c, &c, 0));
int sbytes;
ncplane_set_fg_rgb(n_, 0xa0, 0xf0, 0xa0);
ncplane_set_bg_rgb(n_, 0x20, 0x20, 0x20); ncplane_set_bg_rgb(n_, 0x20, 0x20, 0x20);
int sbytes;
CHECK(2 == ncplane_putegc_yx(n_, 1, 1, "", &sbytes)); CHECK(2 == ncplane_putegc_yx(n_, 1, 1, "", &sbytes));
uint64_t channels = 0; uint64_t channels = 0;
channels_set_fg_alpha(&channels, CELL_ALPHA_BLEND);
channels_set_fg_rgb(&channels, 0x80, 0xf0, 0x10);
channels_set_bg_alpha(&channels, CELL_ALPHA_BLEND); channels_set_bg_alpha(&channels, CELL_ALPHA_BLEND);
channels_set_bg_rgb(&channels, 0x80, 0xf0, 0x10); channels_set_bg_rgb(&channels, 0x80, 0xf0, 0x10);
CHECK(1 == ncplane_set_base(p, channels, 0, " ")); CHECK(1 == ncplane_set_base(p, channels, 0, " "));
@ -991,6 +988,15 @@ TEST_CASE("NCPlane") {
REQUIRE(nullptr != egc); REQUIRE(nullptr != egc);
CHECK(0 == strcmp(" ", egc)); CHECK(0 == strcmp(" ", egc));
free(egc); free(egc);
cell cl = CELL_TRIVIAL_INITIALIZER, cr = CELL_TRIVIAL_INITIALIZER;
CHECK(3 == ncplane_at_yx(n_, 1, 1, &cl));
REQUIRE(cell_extended_gcluster(n_, &cl));
CHECK(0 == strcmp("", extended_gcluster(n_, &cl)));
CHECK(0 == ncplane_at_yx(n_, 1, 2, &cr));
REQUIRE(cell_simple_p(&cr));
CHECK(0 == cr.gcluster);
cell_release(n_, &cl);
cell_release(n_, &cr);
CHECK(chanright == chanleft); CHECK(chanright == chanleft);
ncplane_destroy(p); ncplane_destroy(p);
} }

@ -103,30 +103,30 @@ TEST_CASE("RenderTest") {
// should be nothing, having been stomped // should be nothing, having been stomped
egc = notcurses_at_yx(nc_, 0, 0, &c.attrword, &c.channels); egc = notcurses_at_yx(nc_, 0, 0, &c.attrword, &c.channels);
REQUIRE(egc); REQUIRE(egc);
CHECK(!strcmp(" ", egc)); CHECK(0 == strcmp("", egc));
free(egc); free(egc);
cell_init(&c); cell_init(&c);
// should be character from higher plane // should be character from higher plane
egc = notcurses_at_yx(nc_, 0, 1, &c.attrword, &c.channels); egc = notcurses_at_yx(nc_, 0, 1, &c.attrword, &c.channels);
REQUIRE(egc); REQUIRE(egc);
CHECK(!strcmp("A", egc)); CHECK(0 == strcmp("A", egc));
free(egc); free(egc);
cell_init(&c); cell_init(&c);
egc = notcurses_at_yx(nc_, 0, 2, &c.attrword, &c.channels); egc = notcurses_at_yx(nc_, 0, 2, &c.attrword, &c.channels);
REQUIRE(egc); REQUIRE(egc);
CHECK(!strcmp("B", egc)); CHECK(0 == strcmp("B", egc));
free(egc); free(egc);
cell_init(&c); cell_init(&c);
// should be nothing, having been stomped // should be nothing, having been stomped
egc = notcurses_at_yx(nc_, 0, 3, &c.attrword, &c.channels); egc = notcurses_at_yx(nc_, 0, 3, &c.attrword, &c.channels);
REQUIRE(egc); REQUIRE(egc);
CHECK(!strcmp(" ", egc)); CHECK(0 == strcmp("", egc));
free(egc); free(egc);
cell_init(&c); cell_init(&c);
CHECK(!ncplane_destroy(n)); CHECK(0 == ncplane_destroy(n));
} }

Loading…
Cancel
Save