|
|
@ -453,5 +453,52 @@ TEST_CASE("Visual") {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// quadblitter with one pair plus two split
|
|
|
|
|
|
|
|
SUBCASE("Quadblitter1Pair") {
|
|
|
|
|
|
|
|
const uint32_t pixels[6][4] = {
|
|
|
|
|
|
|
|
{ 0xffcccccc, 0xff444444, 0xff605040, 0xff605040 },
|
|
|
|
|
|
|
|
{ 0xff444444, 0xff605040, 0xffcccccc, 0xff605040 },
|
|
|
|
|
|
|
|
{ 0xffcccccc, 0xff605040, 0xff605040, 0xff444444 },
|
|
|
|
|
|
|
|
{ 0xff605040, 0xffcccccc, 0xff444444, 0xff605040 },
|
|
|
|
|
|
|
|
{ 0xff605040, 0xffeeeeee, 0xff605040, 0xffcccccc },
|
|
|
|
|
|
|
|
{ 0xff605040, 0xff605040, 0xffeeeeee, 0xffcccccc } };
|
|
|
|
|
|
|
|
const char* egcs[6] = { "▟", "▜", "▟", "▙", "▌", "▀" };
|
|
|
|
|
|
|
|
for(size_t i = 0 ; i < sizeof(egcs) / sizeof(*egcs) ; ++i){
|
|
|
|
|
|
|
|
auto ncv = ncvisual_from_rgba(pixels[i], 2, 2 * sizeof(**pixels), 2);
|
|
|
|
|
|
|
|
REQUIRE(nullptr != ncv);
|
|
|
|
|
|
|
|
struct ncvisual_options vopts = {
|
|
|
|
|
|
|
|
.n = nullptr,
|
|
|
|
|
|
|
|
.scaling = NCSCALE_NONE,
|
|
|
|
|
|
|
|
.y = 0,
|
|
|
|
|
|
|
|
.x = 0,
|
|
|
|
|
|
|
|
.begy = 0,
|
|
|
|
|
|
|
|
.begx = 0,
|
|
|
|
|
|
|
|
.leny = 0,
|
|
|
|
|
|
|
|
.lenx = 0,
|
|
|
|
|
|
|
|
.blitter = NCBLIT_2x2,
|
|
|
|
|
|
|
|
.flags = 0,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
auto ncvp = ncvisual_render(nc_, ncv, &vopts);
|
|
|
|
|
|
|
|
REQUIRE(nullptr != ncvp);
|
|
|
|
|
|
|
|
int dimy, dimx;
|
|
|
|
|
|
|
|
ncplane_dim_yx(ncvp, &dimy, &dimx);
|
|
|
|
|
|
|
|
CHECK(1 == dimy);
|
|
|
|
|
|
|
|
CHECK(1 == dimx);
|
|
|
|
|
|
|
|
uint16_t stylemask;
|
|
|
|
|
|
|
|
uint64_t channels;
|
|
|
|
|
|
|
|
auto egc = ncplane_at_yx(ncvp, 0, 0, &stylemask, &channels);
|
|
|
|
|
|
|
|
CHECK(0 == strcmp(egcs[i], egc));
|
|
|
|
|
|
|
|
CHECK(0 == stylemask);
|
|
|
|
|
|
|
|
if(i > 3){
|
|
|
|
|
|
|
|
CHECK(0x405060 == channels_fg_rgb(channels));
|
|
|
|
|
|
|
|
CHECK(0xdddddd == channels_bg_rgb(channels));
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
CHECK(0x424c57 == channels_fg_rgb(channels));
|
|
|
|
|
|
|
|
CHECK(0xcccccc == channels_bg_rgb(channels));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
free(egc);
|
|
|
|
|
|
|
|
ncvisual_destroy(ncv);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
CHECK(!notcurses_stop(nc_));
|
|
|
|
CHECK(!notcurses_stop(nc_));
|
|
|
|
}
|
|
|
|
}
|
|
|
|