mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-04 06:00:30 +00:00
quadblitter/dualblitter unit test bases
This commit is contained in:
parent
7c1e9fe3d2
commit
ab4243d9be
@ -9,6 +9,8 @@ TEST_CASE("Visual") {
|
||||
}
|
||||
ncplane* ncp_ = notcurses_stdplane(nc_);
|
||||
REQUIRE(ncp_);
|
||||
auto n_ = notcurses_stdplane(nc_);
|
||||
REQUIRE(n_);
|
||||
|
||||
#ifndef USE_MULTIMEDIA
|
||||
SUBCASE("VisualDisabled"){
|
||||
@ -163,5 +165,55 @@ TEST_CASE("Visual") {
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
}
|
||||
|
||||
// write a checkerboard pattern and verify the NCBLIT_2x1 output
|
||||
SUBCASE("Dualblitter") {
|
||||
constexpr int DIMY = 10;
|
||||
constexpr int DIMX = 11; // odd number to get checkerboard effect
|
||||
auto rgba = new uint32_t[DIMY * DIMX];
|
||||
for(int i = 0 ; i < DIMY * DIMX ; ++i){
|
||||
CHECK(0 == ncpixel_set_a(&rgba[i], 0xff));
|
||||
if(i % 2){
|
||||
CHECK(0 == ncpixel_set_g(&rgba[i], 0xff));
|
||||
}else{
|
||||
CHECK(0 == ncpixel_set_r(&rgba[i], 0xff));
|
||||
}
|
||||
}
|
||||
auto ncv = ncvisual_from_rgba(rgba, DIMY, DIMX * sizeof(uint32_t), DIMX);
|
||||
REQUIRE(nullptr != ncv);
|
||||
struct ncvisual_options vopts{};
|
||||
vopts.n = n_;
|
||||
vopts.blitter = NCBLIT_2x1;
|
||||
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
|
||||
CHECK(n_ == ncvisual_render(nc_, ncv, &vopts));
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
// FIXME check output
|
||||
delete[] rgba;
|
||||
}
|
||||
|
||||
// write a checkerboard pattern and verify the NCBLIT_2x2 output
|
||||
SUBCASE("Quadblitter") {
|
||||
constexpr int DIMY = 10;
|
||||
constexpr int DIMX = 11; // odd number to get checkerboard effect
|
||||
auto rgba = new uint32_t[DIMY * DIMX];
|
||||
for(int i = 0 ; i < DIMY * DIMX ; ++i){
|
||||
CHECK(0 == ncpixel_set_a(&rgba[i], 0xff));
|
||||
if(i % 2){
|
||||
CHECK(0 == ncpixel_set_g(&rgba[i], 0xff));
|
||||
}else{
|
||||
CHECK(0 == ncpixel_set_r(&rgba[i], 0xff));
|
||||
}
|
||||
}
|
||||
auto ncv = ncvisual_from_rgba(rgba, DIMY, DIMX * sizeof(uint32_t), DIMX);
|
||||
REQUIRE(nullptr != ncv);
|
||||
struct ncvisual_options vopts{};
|
||||
vopts.n = n_;
|
||||
vopts.blitter = NCBLIT_2x2;
|
||||
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
|
||||
CHECK(n_ == ncvisual_render(nc_, ncv, &vopts));
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
// FIXME check output
|
||||
delete[] rgba;
|
||||
}
|
||||
|
||||
CHECK(!notcurses_stop(nc_));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user