mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
quadblitter all different unit test #1080
This commit is contained in:
parent
8548cdc780
commit
fd29cab463
BIN
doc/sexblitter-perfection.png
Normal file
BIN
doc/sexblitter-perfection.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 269 KiB |
BIN
doc/worldmap-sexblitter.png
Normal file
BIN
doc/worldmap-sexblitter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 175 KiB |
@ -465,7 +465,7 @@ TEST_CASE("Visual") {
|
|||||||
{ 0xff605040, 0xffcccccc, 0xff605040, 0xff605040 },
|
{ 0xff605040, 0xffcccccc, 0xff605040, 0xff605040 },
|
||||||
{ 0xff605040, 0xff605040, 0xffcccccc, 0xff605040 },
|
{ 0xff605040, 0xff605040, 0xffcccccc, 0xff605040 },
|
||||||
{ 0xff605040, 0xff605040, 0xff605040, 0xffcccccc } };
|
{ 0xff605040, 0xff605040, 0xff605040, 0xffcccccc } };
|
||||||
const char* egcs[4] = { "▟", "▙", "▜", "▛" };
|
const char* egcs[] = { "▟", "▙", "▜", "▛" };
|
||||||
for(int i = 0 ; i < 4 ; ++i){
|
for(int i = 0 ; i < 4 ; ++i){
|
||||||
auto ncv = ncvisual_from_rgba(pixels[i], 2, 2 * sizeof(**pixels), 2);
|
auto ncv = ncvisual_from_rgba(pixels[i], 2, 2 * sizeof(**pixels), 2);
|
||||||
REQUIRE(nullptr != ncv);
|
REQUIRE(nullptr != ncv);
|
||||||
@ -508,7 +508,7 @@ TEST_CASE("Visual") {
|
|||||||
{ 0xff605040, 0xffcccccc, 0xffcccccc, 0xff605040 },
|
{ 0xff605040, 0xffcccccc, 0xffcccccc, 0xff605040 },
|
||||||
{ 0xff605040, 0xffcccccc, 0xff605040, 0xffcccccc },
|
{ 0xff605040, 0xffcccccc, 0xff605040, 0xffcccccc },
|
||||||
{ 0xff605040, 0xff605040, 0xffcccccc, 0xffcccccc } };
|
{ 0xff605040, 0xff605040, 0xffcccccc, 0xffcccccc } };
|
||||||
const char* egcs[6] = { "▀", "▌", "▚", "▚", "▌", "▀" };
|
const char* egcs[] = { "▀", "▌", "▚", "▚", "▌", "▀" };
|
||||||
for(size_t i = 0 ; i < sizeof(egcs) / sizeof(*egcs) ; ++i){
|
for(size_t i = 0 ; i < sizeof(egcs) / sizeof(*egcs) ; ++i){
|
||||||
auto ncv = ncvisual_from_rgba(pixels[i], 2, 2 * sizeof(**pixels), 2);
|
auto ncv = ncvisual_from_rgba(pixels[i], 2, 2 * sizeof(**pixels), 2);
|
||||||
REQUIRE(nullptr != ncv);
|
REQUIRE(nullptr != ncv);
|
||||||
@ -556,7 +556,7 @@ TEST_CASE("Visual") {
|
|||||||
{ 0xff605040, 0xffcccccc, 0xff444444, 0xff605040 },
|
{ 0xff605040, 0xffcccccc, 0xff444444, 0xff605040 },
|
||||||
{ 0xff605040, 0xffeeeeee, 0xff605040, 0xffcccccc },
|
{ 0xff605040, 0xffeeeeee, 0xff605040, 0xffcccccc },
|
||||||
{ 0xff605040, 0xff605040, 0xffeeeeee, 0xffcccccc } };
|
{ 0xff605040, 0xff605040, 0xffeeeeee, 0xffcccccc } };
|
||||||
const char* egcs[6] = { "▟", "▜", "▟", "▙", "▌", "▀" };
|
const char* egcs[] = { "▟", "▜", "▟", "▙", "▌", "▀" };
|
||||||
for(size_t i = 0 ; i < sizeof(egcs) / sizeof(*egcs) ; ++i){
|
for(size_t i = 0 ; i < sizeof(egcs) / sizeof(*egcs) ; ++i){
|
||||||
auto ncv = ncvisual_from_rgba(pixels[i], 2, 2 * sizeof(**pixels), 2);
|
auto ncv = ncvisual_from_rgba(pixels[i], 2, 2 * sizeof(**pixels), 2);
|
||||||
REQUIRE(nullptr != ncv);
|
REQUIRE(nullptr != ncv);
|
||||||
@ -594,5 +594,47 @@ TEST_CASE("Visual") {
|
|||||||
ncvisual_destroy(ncv);
|
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_));
|
CHECK(!notcurses_stop(nc_));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user