[tests] use universal initialization for ncvisual_options #1682

pull/2250/head
nick black 3 years ago committed by nick black
parent a8b3634ca7
commit 5f9d88fa89

@ -103,33 +103,14 @@ draw_block(struct ncplane* nn, uint32_t blockstart){
for(chunk = 0 ; chunk < BLOCKSIZE / CHUNKSIZE ; ++chunk){
int z;
for(z = 0 ; z < CHUNKSIZE ; ++z){
wchar_t w = blockstart + chunk * CHUNKSIZE + z;
char utf8arr[MB_CUR_MAX * 3 + 5];
uint32_t w = blockstart + chunk * CHUNKSIZE + z;
// problematic characters FIXME (see TERMINALS.md)
if(w == 0x070f || w == 0x08e2 || w == 0x06dd){
strcpy(utf8arr, " ");
}else if(wcwidth(w) >= 1 && iswgraph(w)){
mbstate_t ps;
memset(&ps, 0, sizeof(ps));
int bwc = wcrtomb(utf8arr, w, &ps);
if(bwc < 0){
fprintf(stderr, "Couldn't convert %u (%x) (%lc) (%s)\n",
blockstart + chunk * CHUNKSIZE + z,
blockstart + chunk * CHUNKSIZE + z,
(wint_t)w, strerror(errno));
if(w != 0x070f && w != 0x08e2 && w != 0x06dd){
ncplane_set_fg_rgb8(nn, 0xad + z * 2, 0xff, 0x2f - z * 2);
ncplane_set_bg_rgb8(nn, 8 * chunk, 8 * chunk, 8 * chunk);
if(ncplane_putwc_yx(nn, chunk + 1, z * 2 + 1, w) < 0){
return -1;
}
if(wcwidth(w) < 2){
utf8arr[bwc++] = ' ';
}
utf8arr[bwc++] = '\0';
}else{ // don't dump non-printing codepoints
strcpy(utf8arr, " ");
}
ncplane_set_fg_rgb8(nn, 0xad + z * 2, 0xff, 0x2f - z * 2);
ncplane_set_bg_rgb8(nn, 8 * chunk, 8 * chunk, 8 * chunk);
if(ncplane_putstr_yx(nn, chunk + 1, z * 2 + 1, utf8arr) < 0){
return -1;
}
}
}

@ -27,16 +27,9 @@ TEST_CASE("Bitmaps") {
std::vector<uint32_t> v(x * y, htole(0xe61c28ff));
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
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_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
CHECK(0 == ncvisual_resize(ncv, 1, 1));
auto n = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
@ -54,16 +47,10 @@ TEST_CASE("Bitmaps") {
REQUIRE(nullptr != ncv);
auto nn = ncplane_dup(n_, nullptr);
REQUIRE(nullptr != nn);
struct ncvisual_options vopts = {
.n = nn,
.scaling = NCSCALE_NONE,
.y = 0, .x = 0,
.begy = 0, .begx = 0,
.leny = 0, .lenx = 0,
.blitter = NCBLIT_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.n = nn;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
int maxy, maxx;
ncplane_pixelgeom(n_, nullptr, nullptr, nullptr, nullptr, &maxy, &maxx);
CHECK(0 == ncvisual_resize(ncv, maxy, maxx));
@ -90,17 +77,10 @@ TEST_CASE("Bitmaps") {
.flags = 0, .margin_b = 0, .margin_r = 0,
};
auto n = ncplane_create(n_, &nopts);
struct ncvisual_options vopts = {
.n = n,
.scaling = NCSCALE_NONE,
.y = 0,
.x = 0,
.begy = 0, .begx = 0,
.leny = 0, .lenx = 0,
.blitter = NCBLIT_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.n = n;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
CHECK(nullptr == ncvisual_render(nc_, ncv, &vopts));
CHECK(0 == notcurses_render(nc_));
ncvisual_destroy(ncv);
@ -120,17 +100,10 @@ TEST_CASE("Bitmaps") {
.flags = 0, .margin_b = 0, .margin_r = 0,
};
auto n = ncplane_create(n_, &nopts);
struct ncvisual_options vopts = {
.n = n,
.scaling = NCSCALE_NONE,
.y = 0,
.x = 0,
.begy = 0, .begx = 0,
.leny = 0, .lenx = 0,
.blitter = NCBLIT_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.n = n;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
CHECK(nullptr == ncvisual_render(nc_, ncv, &vopts));
CHECK(0 == notcurses_render(nc_));
ncvisual_destroy(ncv);
@ -152,17 +125,9 @@ TEST_CASE("Bitmaps") {
.flags = 0, .margin_b = 0, .margin_r = 0,
};
auto n = ncplane_create(n_, &nopts);
struct ncvisual_options vopts = {
.n = n,
.scaling = NCSCALE_NONE,
.y = 0,
.x = 0,
.begy = 0, .begx = 0,
.leny = 0, .lenx = 0,
.blitter = NCBLIT_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
CHECK(nullptr != ncvisual_render(nc_, ncv, &vopts));
CHECK(0 > ncplane_putchar_yx(n, ' ', 0, 0));
CHECK(0 == notcurses_render(nc_));
@ -177,16 +142,9 @@ TEST_CASE("Bitmaps") {
std::vector<uint32_t> v(x * y, htole(0xe61c28ff));
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
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_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto botn = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != botn);
// should just have a red plane
@ -240,16 +198,9 @@ TEST_CASE("Bitmaps") {
std::vector<uint32_t> v(x * y, htole(0xffffffff));
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
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_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
auto s = n->sprite;
@ -320,16 +271,9 @@ TEST_CASE("Bitmaps") {
std::vector<uint32_t> v(x * y, htole(0xff7799dd));
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
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_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
struct ncplane_options nopts = {
@ -388,6 +332,7 @@ TEST_CASE("Bitmaps") {
NCVISUAL_OPTION_HORALIGNED |
NCVISUAL_OPTION_VERALIGNED,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto y = nc_->tcache.cellpixy * 6;
auto x = nc_->tcache.cellpixx;
@ -430,6 +375,7 @@ TEST_CASE("Bitmaps") {
NCVISUAL_OPTION_HORALIGNED |
NCVISUAL_OPTION_VERALIGNED,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto y = nc_->tcache.cellpixy * 6;
auto x = nc_->tcache.cellpixx;
@ -454,16 +400,9 @@ TEST_CASE("Bitmaps") {
std::vector<uint32_t> v(x * y, htole(0xffffffff));
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts = {
.n = nullptr,
.scaling = NCSCALE_NONE,
.y = 0, .x = 0,
.begy = 0, .begx = 0,
.leny = y, .lenx = x,
.blitter = NCBLIT_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
auto s = n->sprite;
@ -492,16 +431,9 @@ TEST_CASE("Bitmaps") {
}
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts = {
.n = nullptr,
.scaling = NCSCALE_NONE,
.y = 0, .x = 0,
.begy = 0, .begx = 0,
.leny = y, .lenx = x,
.blitter = NCBLIT_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
auto s = n->sprite;
@ -530,16 +462,9 @@ TEST_CASE("Bitmaps") {
}
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts = {
.n = nullptr,
.scaling = NCSCALE_NONE,
.y = 0, .x = 0,
.begy = 0, .begx = 0,
.leny = y, .lenx = x,
.blitter = NCBLIT_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
auto s = n->sprite;
@ -576,16 +501,9 @@ TEST_CASE("Bitmaps") {
}
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts = {
.n = nullptr,
.scaling = NCSCALE_NONE,
.y = 2, .x = 2,
.begy = 0, .begx = 0,
.leny = y, .lenx = x,
.blitter = NCBLIT_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
ncvisual_destroy(ncv);
@ -673,16 +591,9 @@ TEST_CASE("Bitmaps") {
std::vector<uint32_t> v(x * y * 4, htole(0xffccccff));
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
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_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
for(int i = 0 ; i <= ncplane_dim_x(n_) ; ++i){
CHECK(0 == ncplane_move_yx(n, 0, i));
@ -698,16 +609,10 @@ TEST_CASE("Bitmaps") {
std::vector<uint32_t> v(x * y * 4, htole(0xffccccff));
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts = {
.n = nullptr,
.scaling = NCSCALE_NONE,
.y = 0, .x = ncplane_dim_x(n_) - 3,
.begy = 0, .begx = 0,
.leny = 0, .lenx = 0,
.blitter = NCBLIT_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
vopts.x = ncplane_dim_x(n_) - 3;
auto n = ncvisual_render(nc_, ncv, &vopts);
for(int i = ncplane_dim_x(n_) - 3 ; i >= 0 ; --i){
CHECK(0 == ncplane_move_yx(n, 0, i));
@ -723,16 +628,9 @@ TEST_CASE("Bitmaps") {
std::vector<uint32_t> v(x * y * 4, htole(0xffccccff));
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
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_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
for(int i = 0 ; i <= ncplane_dim_y(n_) ; ++i){
CHECK(0 == ncplane_move_yx(n, i, 0));
@ -748,16 +646,10 @@ TEST_CASE("Bitmaps") {
std::vector<uint32_t> v(x * y * 4, htole(0xffccccff));
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts = {
.n = nullptr,
.scaling = NCSCALE_NONE,
.y = ncplane_dim_y(n_) - 3, .x = 0,
.begy = 0, .begx = 0,
.leny = 0, .lenx = 0,
.blitter = NCBLIT_PIXEL,
.flags = NCVISUAL_OPTION_NODEGRADE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
vopts.y = ncplane_dim_y(n_) - 3;
auto n = ncvisual_render(nc_, ncv, &vopts);
for(int i = ncplane_dim_y(n_) - 3 ; i >= 0 ; --i){
CHECK(0 == ncplane_move_yx(n, i, 0));

@ -27,19 +27,11 @@ TEST_CASE("Blit") {
};
auto ncp = ncplane_create(n_, &nopts);
REQUIRE(nullptr != ncp);
struct ncvisual_options vopts = {
.n = ncp,
.scaling = NCSCALE_NONE,
.y = 0,
.x = 0,
.begy = 0,
.begx = 0,
.leny = 2,
.lenx = 4,
.blitter = NCBLIT_1x1,
.flags = 0,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.n = ncp;
vopts.leny = 2;
vopts.lenx = 4;
vopts.blitter = NCBLIT_1x1;
ncblit_bgrx(data, 16, &vopts);
for(int y = 0 ; y < 2 ; ++y){
for(int x = 0 ; x < 4 ; ++x){
@ -77,19 +69,11 @@ TEST_CASE("Blit") {
};
auto ncp = ncplane_create(n_, &nopts);
REQUIRE(nullptr != ncp);
struct ncvisual_options vopts = {
.n = ncp,
.scaling = NCSCALE_NONE,
.y = 0,
.x = 0,
.begy = 0,
.begx = 0,
.leny = 2,
.lenx = 4,
.blitter = NCBLIT_1x1,
.flags = 0,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.n = ncp;
vopts.leny = 2;
vopts.lenx = 4;
vopts.blitter = NCBLIT_1x1;
ncblit_bgrx(data, 20, &vopts);
for(int y = 0 ; y < 2 ; ++y){
for(int x = 0 ; x < 4 ; ++x){
@ -137,12 +121,8 @@ TEST_CASE("Blit") {
ncpixel_set_b(pbr, 0x95);
auto ncv = ncvisual_from_rgba(p2x2, 2, 8, 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,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_2x2;
auto ncp = ncvisual_render(nc_, ncv, &vopts);
ncvisual_destroy(ncv);
REQUIRE(nullptr != ncp);
@ -167,16 +147,8 @@ TEST_CASE("Blit") {
};
auto ncv = ncvisual_from_rgba(data, 1, 8, 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_1x1,
.flags = 0,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_1x1;
auto p = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != p);
CHECK(0 == notcurses_render(nc_));
@ -201,16 +173,8 @@ TEST_CASE("Blit") {
};
auto ncv = ncvisual_from_rgba(data, 2, 16, 4);
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_2x1,
.flags = 0,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_2x1;
auto p = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != p);
CHECK(1 == ncplane_dim_y(p));
@ -252,16 +216,8 @@ TEST_CASE("Blit") {
};
auto ncv = ncvisual_from_rgba(data, 2, 128, 32);
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,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_2x2;
auto p = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != p);
CHECK(1 == ncplane_dim_y(p));

@ -356,16 +356,11 @@ TEST_CASE("Media") {
};
auto parent = ncplane_create(n_, &opts);
REQUIRE(parent);
struct ncvisual_options vopts = {
.n = parent,
.scaling = NCSCALE_STRETCH,
.y = 0, .x = 0,
.begy = 0, .begx = 0,
.leny = 0, .lenx = 0,
.blitter = NCBLIT_1x1,
.flags = NCVISUAL_OPTION_CHILDPLANE,
.transcolor = 0,
};
struct ncvisual_options vopts{};
vopts.scaling = NCSCALE_STRETCH;
vopts.n = parent;
vopts.blitter = NCBLIT_1x1;
vopts.flags = NCVISUAL_OPTION_CHILDPLANE;
auto ncv = ncvisual_from_file(find_data("onedot.png").get());
REQUIRE(ncv);
auto child = ncvisual_render(nc_, ncv, &vopts);

@ -43,7 +43,7 @@ TEST_CASE("Stacking") {
struct ncvisual_options vopts = {
.n = top, .scaling = NCSCALE_NONE, .y = 0, .x = 0, .begy = 0, .begx = 0,
.leny = 2, .lenx = 1, .blitter = NCBLIT_2x1, .flags = 0,
.transcolor = 0,
.transcolor = 0, .pxoffy = 0, .pxoffx = 0,
};
CHECK(top == ncvisual_render(nc_, ncv, &vopts));
ncvisual_destroy(ncv);
@ -81,7 +81,7 @@ TEST_CASE("Stacking") {
struct ncvisual_options vopts = {
.n = top, .scaling = NCSCALE_NONE, .y = 0, .x = 0, .begy = 0, .begx = 0,
.leny = 2, .lenx = 1, .blitter = NCBLIT_2x1, .flags = 0,
.transcolor = 0,
.transcolor = 0, .pxoffy = 0, .pxoffx = 0,
};
CHECK(top == ncvisual_render(nc_, ncv, &vopts));
ncvisual_destroy(ncv);
@ -120,7 +120,7 @@ TEST_CASE("Stacking") {
struct ncvisual_options vopts = {
.n = top, .scaling = NCSCALE_NONE, .y = 0, .x = 0, .begy = 0, .begx = 0,
.leny = 2, .lenx = 2, .blitter = NCBLIT_2x2, .flags = 0,
.transcolor = 0,
.transcolor = 0, .pxoffy = 0, .pxoffx = 0,
};
CHECK(top == ncvisual_render(nc_, ncv, &vopts));
ncvisual_destroy(ncv);
@ -162,7 +162,7 @@ TEST_CASE("Stacking") {
struct ncvisual_options vopts = {
.n = top, .scaling = NCSCALE_NONE, .y = 0, .x = 0, .begy = 0, .begx = 0,
.leny = 2, .lenx = 2, .blitter = NCBLIT_2x2, .flags = 0,
.transcolor = 0,
.transcolor = 0, .pxoffy = 0, .pxoffx = 0,
};
CHECK(top == ncvisual_render(nc_, ncv, &vopts));
ncvisual_destroy(ncv);

@ -107,6 +107,7 @@ TEST_CASE("Visual") {
.blitter = NCBLIT_1x1,
.flags = NCVISUAL_OPTION_HORALIGNED,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto ncv = ncvisual_from_rgba(pixels, 2, 2 * sizeof(*pixels), 2);
REQUIRE(nullptr != ncv);
@ -132,6 +133,7 @@ TEST_CASE("Visual") {
.leny = 5, .lenx = 8,
.blitter = NCBLIT_1x1,
.flags = 0, .transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto n = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
@ -157,6 +159,7 @@ TEST_CASE("Visual") {
.leny = 0, .lenx = 0,
.blitter = NCBLIT_1x1,
.flags = 0, .transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto n = ncvisual_render(nc_, ncv, &vopts);
CHECK(0 == notcurses_render(nc_));
@ -193,6 +196,7 @@ TEST_CASE("Visual") {
.leny = 5, .lenx = 8,
.blitter = NCBLIT_1x1,
.flags = 0, .transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto n = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
@ -216,6 +220,7 @@ TEST_CASE("Visual") {
.leny = 0, .lenx = 0,
.blitter = NCBLIT_1x1,
.flags = 0, .transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto newn = ncvisual_render(nc_, ncv, &vopts);
CHECK(0 == notcurses_render(nc_));
@ -477,6 +482,7 @@ TEST_CASE("Visual") {
.blitter = NCBLIT_2x2,
.flags = 0,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto ncvp = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != ncvp);
@ -521,6 +527,7 @@ TEST_CASE("Visual") {
.blitter = NCBLIT_2x2,
.flags = 0,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto ncvp = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != ncvp);
@ -568,6 +575,7 @@ TEST_CASE("Visual") {
.blitter = NCBLIT_2x2,
.flags = 0,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto ncvp = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != ncvp);
@ -620,6 +628,7 @@ TEST_CASE("Visual") {
.blitter = NCBLIT_2x2,
.flags = 0,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto ncvp = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != ncvp);
@ -671,6 +680,7 @@ TEST_CASE("Visual") {
.blitter = NCBLIT_2x2,
.flags = 0,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto ncvp = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != ncvp);
@ -716,6 +726,7 @@ TEST_CASE("Visual") {
.blitter = NCBLIT_1x1,
.flags = 0,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
const uint32_t pixels[16] = {
htole(0xffffffff), htole(0xffffffff), htole(0xffc0ffff), htole(0xffffc0ff),
@ -771,6 +782,7 @@ TEST_CASE("Visual") {
NCVISUAL_OPTION_HORALIGNED |
NCVISUAL_OPTION_VERALIGNED,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
const uint32_t pixels[1] = { htole(0xffffffff) };
auto ncv = ncvisual_from_rgba(pixels, 1, 4, 1);

Loading…
Cancel
Save