From 6f4a9e089cccd36e6ad1b41ce2dc578464471eae Mon Sep 17 00:00:00 2001 From: nick black Date: Thu, 25 Mar 2021 18:41:40 -0400 Subject: [PATCH] [tests] unit test for directmode image rendering --- src/tests/direct.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/tests/direct.cpp b/src/tests/direct.cpp index a5cf04866..b21c33036 100644 --- a/src/tests/direct.cpp +++ b/src/tests/direct.cpp @@ -49,13 +49,27 @@ TEST_CASE("DirectMode") { } } +#ifndef NOTCURSES_USE_MULTIMEDIA + SUBCASE("VisualDisabled"){ + CHECK(!ncdirect_canopen_images(nc_)); + } +#else + SUBCASE("ImagesEnabled"){ + CHECK(ncdirect_canopen_images(nc_)); + } + + SUBCASE("LoadImage") { + CHECK(0 == ncdirect_render_image(nc_, find_data("changes.jpg"), NCALIGN_LEFT, NCBLIT_1x1, NCSCALE_STRETCH)); + } +#endif + CHECK(0 == ncdirect_stop(nc_)); // make sure that we can pass undefined flags and still create the ncdirect SUBCASE("FutureFlags") { - nc_ = ncdirect_init(NULL, stdout, ~0ULL); - REQUIRE(nullptr != nc_); - CHECK(0 == ncdirect_stop(nc_)); + auto fnc = ncdirect_init(NULL, stdout, ~0ULL); + REQUIRE(nullptr != fnc); + CHECK(0 == ncdirect_stop(fnc)); } }