Unit tests for bitmap wandering offscreen to the left and right #1646

pull/2122/head
nick black 3 years ago
parent 7ad34fc282
commit c2616c6cbb
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -665,6 +665,56 @@ TEST_CASE("Bitmaps") {
}
#endif
SUBCASE("BitmapMoveOffscreenLeft") {
// first, assemble a visual equivalent to 2x2 cells
auto y = nc_->tcache.cellpixy * 2;
auto x = nc_->tcache.cellpixx * 2;
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,
};
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));
CHECK(0 == notcurses_render(nc_));
}
REQUIRE(nullptr != n);
}
SUBCASE("BitmapMoveOffscreenRight") {
// first, assemble a visual equivalent to 2x2 cells
auto y = nc_->tcache.cellpixy * 2;
auto x = nc_->tcache.cellpixx * 2;
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,
};
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));
CHECK(0 == notcurses_render(nc_));
}
REQUIRE(nullptr != n);
}
SUBCASE("BitmapMoveOffscreenDown") {
// first, assemble a visual equivalent to 2x2 cells
auto y = nc_->tcache.cellpixy * 2;

Loading…
Cancel
Save