[visual] guard quadblitter tests with check

pull/1520/head
nick black 4 years ago
parent 7488a84121
commit 17a27427ec
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -106,6 +106,7 @@ TEST_CASE("Visual") {
// write a checkerboard pattern and verify the NCBLIT_2x2 output
SUBCASE("Quadblitter") {
if(notcurses_canutf8(nc_)){
if(nc_->tcache.quadrants){
constexpr int DIMY = 10;
constexpr int DIMX = 11; // odd number to get checkerboard effect
auto rgba = new uint32_t[DIMY * DIMX];
@ -142,10 +143,12 @@ TEST_CASE("Visual") {
delete[] rgba;
}
}
}
// close-in verification of each quadblitter output EGC
SUBCASE("QuadblitterEGCs") {
if(notcurses_canutf8(nc_)){
if(nc_->tcache.quadrants){
// there are 16 configurations, each mapping four (2x2) pixels
int DIMX = 32;
int DIMY = 2;
@ -216,10 +219,12 @@ TEST_CASE("Visual") {
delete[] rgba;
}
}
}
// quadblitter with all 4 colors equal ought generate space
SUBCASE("Quadblitter4Same") {
if(notcurses_canutf8(nc_)){
if(nc_->tcache.quadrants){
const uint32_t pixels[4] = { htole(0xff605040), htole(0xff605040), htole(0xff605040), htole(0xff605040) };
auto ncv = ncvisual_from_rgba(pixels, 2, 2 * sizeof(*pixels), 2);
REQUIRE(nullptr != ncv);
@ -252,10 +257,12 @@ TEST_CASE("Visual") {
ncvisual_destroy(ncv);
}
}
}
// quadblitter with three pixels equal ought generate three-quarter block
SUBCASE("Quadblitter3Same") {
if(notcurses_canutf8(nc_)){
if(nc_->tcache.quadrants){
const uint32_t pixels[4][4] = {
{ htole(0xffcccccc), htole(0xff605040), htole(0xff605040), htole(0xff605040) },
{ htole(0xff605040), htole(0xffcccccc), htole(0xff605040), htole(0xff605040) },
@ -295,10 +302,12 @@ TEST_CASE("Visual") {
}
}
}
}
// quadblitter with two sets of two equal pixels
SUBCASE("Quadblitter2Pairs") {
if(notcurses_canutf8(nc_)){
if(nc_->tcache.quadrants){
const uint32_t pixels[6][4] = {
{ htole(0xffcccccc), htole(0xffcccccc), htole(0xff605040), htole(0xff605040) },
{ htole(0xffcccccc), htole(0xff605040), htole(0xffcccccc), htole(0xff605040) },
@ -345,10 +354,12 @@ TEST_CASE("Visual") {
}
}
}
}
// quadblitter with one pair plus two split
SUBCASE("Quadblitter1Pair") {
if(notcurses_canutf8(nc_)){
if(nc_->tcache.quadrants){
const uint32_t pixels[6][4] = {
{ htole(0xffcccccc), htole(0xff444444), htole(0xff605040), htole(0xff605040) },
{ htole(0xff444444), htole(0xff605040), htole(0xffcccccc), htole(0xff605040) },
@ -395,10 +406,12 @@ TEST_CASE("Visual") {
}
}
}
}
// quadblitter with one pair plus two split
SUBCASE("QuadblitterAllDifferent") {
if(notcurses_canutf8(nc_)){
if(nc_->tcache.quadrants){
const uint32_t pixels[6][4] = {
{ htole(0xffdddddd), htole(0xff000000), htole(0xff111111), htole(0xff222222) },
{ htole(0xff000000), htole(0xff111111), htole(0xffdddddd), htole(0xff222222) },
@ -439,6 +452,7 @@ TEST_CASE("Visual") {
}
}
}
}
#ifndef NOTCURSES_USE_MULTIMEDIA
SUBCASE("VisualDisabled"){

Loading…
Cancel
Save