quadblitter all different unit test #1080

pull/1097/head
nick black 4 years ago
parent 8548cdc780
commit fd29cab463
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

@ -465,7 +465,7 @@ TEST_CASE("Visual") {
{ 0xff605040, 0xffcccccc, 0xff605040, 0xff605040 },
{ 0xff605040, 0xff605040, 0xffcccccc, 0xff605040 },
{ 0xff605040, 0xff605040, 0xff605040, 0xffcccccc } };
const char* egcs[4] = { "", "", "", "" };
const char* egcs[] = { "", "", "", "" };
for(int i = 0 ; i < 4 ; ++i){
auto ncv = ncvisual_from_rgba(pixels[i], 2, 2 * sizeof(**pixels), 2);
REQUIRE(nullptr != ncv);
@ -508,7 +508,7 @@ TEST_CASE("Visual") {
{ 0xff605040, 0xffcccccc, 0xffcccccc, 0xff605040 },
{ 0xff605040, 0xffcccccc, 0xff605040, 0xffcccccc },
{ 0xff605040, 0xff605040, 0xffcccccc, 0xffcccccc } };
const char* egcs[6] = { "", "", "", "", "", "" };
const char* egcs[] = { "", "", "", "", "", "" };
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);
@ -556,7 +556,7 @@ TEST_CASE("Visual") {
{ 0xff605040, 0xffcccccc, 0xff444444, 0xff605040 },
{ 0xff605040, 0xffeeeeee, 0xff605040, 0xffcccccc },
{ 0xff605040, 0xff605040, 0xffeeeeee, 0xffcccccc } };
const char* egcs[6] = { "", "", "", "", "", "" };
const char* egcs[] = { "", "", "", "", "", "" };
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);
@ -594,5 +594,47 @@ TEST_CASE("Visual") {
ncvisual_destroy(ncv);
}
}
// quadblitter with one pair plus two split
SUBCASE("QuadblitterAllDifferent") {
const uint32_t pixels[6][4] = {
{ 0xffdddddd, 0xff000000, 0xff111111, 0xff222222 },
{ 0xff000000, 0xff111111, 0xffdddddd, 0xff222222 },
{ 0xff111111, 0xffdddddd, 0xff000000, 0xff222222 },
{ 0xff000000, 0xffcccccc, 0xff222222, 0xffeeeeee },
{ 0xff222222, 0xff000000, 0xffeeeeee, 0xffcccccc, } };
const char* egcs[] = { "", "", "", "", "" };
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);
CHECK(0x111111 == channels_fg_rgb(channels));
CHECK(0xdddddd == channels_bg_rgb(channels));
free(egc);
ncvisual_destroy(ncv);
}
}
CHECK(!notcurses_stop(nc_));
}

Loading…
Cancel
Save