new VisualCellGeometryNoScaling unit test

pull/2320/head
nick black 3 years ago committed by nick black
parent 1cc597698a
commit d65dd43670

@ -113,6 +113,28 @@ TEST_CASE("Visual") {
CHECK(NCBLIT_DEFAULT != g.blitter); // we must not revolve to default
}
// build a simple ncvisual and check the calculated geometries for various
// cell blitters in the absence of scaling
SUBCASE("VisualCellGeometryNoScaling") {
std::vector v(80, 0xfffffffflu);
auto ncv = ncvisual_from_rgba(v.data(), 8, 10 * sizeof(decltype(v)::value_type), 10);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
ncvgeom g{};
vopts.blitter = NCBLIT_1x1;
CHECK(0 == ncvisual_geom(nullptr, ncv, &vopts, &g));
ncvisual_destroy(ncv);
CHECK(8 == g.pixy);
CHECK(10 == g.pixx);
CHECK(1 == g.scaley);
CHECK(1 == g.scalex);
CHECK(8 == g.rpixy);
CHECK(10 == g.rpixx);
CHECK(8 == g.rcelly);
CHECK(10 == g.rcellx);
CHECK(NCBLIT_DEFAULT == g.blitter);
}
// check that we properly populate RGB + A -> RGBA from 35x4 (see #1806)
SUBCASE("VisualFromRGBPacked35x4") {
unsigned char rgb[4 * 35 * 3] = "";

Loading…
Cancel
Save