2019-11-24 17:36:46 +00:00
|
|
|
#include "main.h"
|
2020-02-18 17:36:16 +00:00
|
|
|
#include "egcpool.h"
|
2019-11-24 17:36:46 +00:00
|
|
|
|
2020-06-03 08:25:31 +00:00
|
|
|
TEST_CASE("Cell") {
|
2020-05-11 08:57:20 +00:00
|
|
|
if(!enforce_utf8()){
|
|
|
|
return;
|
|
|
|
}
|
2020-06-16 03:58:43 +00:00
|
|
|
auto nc_ = testing_notcurses();
|
2020-05-17 11:57:21 +00:00
|
|
|
if(!nc_){
|
|
|
|
return;
|
|
|
|
}
|
2019-12-27 22:20:20 +00:00
|
|
|
struct ncplane* n_ = notcurses_stdplane(nc_);
|
|
|
|
REQUIRE(nullptr != n_);
|
2019-11-24 17:36:46 +00:00
|
|
|
|
2020-09-15 04:29:53 +00:00
|
|
|
SUBCASE("EGCs") {
|
|
|
|
int cols, bytes;
|
|
|
|
bytes = utf8_egc_len("é", &cols);
|
|
|
|
CHECK(2 == bytes);
|
|
|
|
CHECK(1 == cols);
|
|
|
|
bytes = utf8_egc_len("\x41\u0301", &cols);
|
|
|
|
CHECK(3 == bytes);
|
|
|
|
CHECK(1 == cols);
|
|
|
|
bytes = utf8_egc_len(" ி", &cols);
|
|
|
|
CHECK(4 == bytes);
|
|
|
|
CHECK(1 == cols);
|
|
|
|
bytes = utf8_egc_len(" ि", &cols);
|
|
|
|
CHECK(4 == bytes);
|
|
|
|
CHECK(1 == cols);
|
|
|
|
bytes = utf8_egc_len("◌̈", &cols);
|
|
|
|
CHECK(5 == bytes);
|
|
|
|
CHECK(1 == cols);
|
|
|
|
bytes = utf8_egc_len("นี้", &cols);
|
|
|
|
CHECK(9 == bytes);
|
|
|
|
CHECK(1 == cols);
|
|
|
|
}
|
|
|
|
|
2020-08-31 23:39:07 +00:00
|
|
|
SUBCASE("Loadchar") {
|
2019-12-27 22:20:20 +00:00
|
|
|
cell c = CELL_TRIVIAL_INITIALIZER;
|
2020-09-10 07:31:23 +00:00
|
|
|
CHECK(1 == cell_load(n_, &c, " "));
|
2019-12-27 22:20:20 +00:00
|
|
|
CHECK(cell_simple_p(&c));
|
|
|
|
cell_release(n_, &c);
|
|
|
|
}
|
2019-12-14 23:02:58 +00:00
|
|
|
|
2020-06-03 08:25:31 +00:00
|
|
|
SUBCASE("MultibyteWidth") {
|
2020-09-15 05:39:42 +00:00
|
|
|
CHECK(0 == ncstrwidth("")); // zero bytes, zero columns
|
|
|
|
CHECK(0 == ncstrwidth("\x7")); // single byte, non-printable
|
|
|
|
CHECK(1 == ncstrwidth(" ")); // single byte, one column
|
|
|
|
CHECK(5 == ncstrwidth("abcde")); // single byte, one column
|
|
|
|
CHECK(1 == ncstrwidth("µ")); // two bytes, one column
|
|
|
|
CHECK(1 <= ncstrwidth("\xf0\x9f\xa6\xb2")); // four bytes, two columns
|
|
|
|
CHECK(3 <= ncstrwidth("平仮名")); // nine bytes, six columns
|
|
|
|
CHECK(1 == ncstrwidth("\ufdfd")); // three bytes, ? columns, wcwidth() returns 1
|
2020-06-03 08:25:31 +00:00
|
|
|
}
|
|
|
|
|
2020-09-15 04:29:53 +00:00
|
|
|
// test combining characters and ZWJs
|
|
|
|
SUBCASE("MultiglyphWidth") {
|
2020-10-07 06:27:17 +00:00
|
|
|
#ifdef __linux__
|
2020-09-15 05:39:42 +00:00
|
|
|
CHECK(2 == ncstrwidth("\U0001F471"));
|
|
|
|
CHECK(2 == ncstrwidth("\U0001F471\u200D"));
|
|
|
|
CHECK(3 == ncstrwidth("\U0001F471\u200D\u2640")); // *not* a single EGC!
|
2020-10-07 06:27:17 +00:00
|
|
|
#else
|
|
|
|
// FreeBSD doesn't think these wide
|
|
|
|
CHECK(1 == ncstrwidth("\U0001F471"));
|
|
|
|
CHECK(1 == ncstrwidth("\U0001F471\u200D"));
|
|
|
|
CHECK(2 == ncstrwidth("\U0001F471\u200D\u2640")); // *not* a single EGC!
|
|
|
|
#endif
|
2020-09-15 04:29:53 +00:00
|
|
|
}
|
|
|
|
|
2020-06-03 08:25:31 +00:00
|
|
|
SUBCASE("SetItalic") {
|
|
|
|
cell c = CELL_TRIVIAL_INITIALIZER;
|
2019-12-27 22:20:20 +00:00
|
|
|
int dimy, dimx;
|
|
|
|
notcurses_term_dim_yx(nc_, &dimy, &dimx);
|
2020-09-29 16:48:19 +00:00
|
|
|
cell_set_styles(&c, NCSTYLE_ITALIC);
|
2020-09-10 07:31:23 +00:00
|
|
|
CHECK(1 == cell_load(n_, &c, "i"));
|
2020-09-17 19:34:28 +00:00
|
|
|
cell_set_fg_rgb8(&c, 255, 255, 255);
|
2020-01-30 13:55:01 +00:00
|
|
|
ncplane_set_base_cell(n_, &c);
|
2019-12-27 22:20:20 +00:00
|
|
|
cell_release(n_, &c);
|
|
|
|
CHECK(0 == notcurses_render(nc_));
|
2020-09-29 16:48:19 +00:00
|
|
|
cell_off_styles(&c, NCSTYLE_ITALIC);
|
2019-12-27 22:20:20 +00:00
|
|
|
}
|
2019-12-10 13:50:32 +00:00
|
|
|
|
2019-12-27 22:20:20 +00:00
|
|
|
SUBCASE("SetBold") {
|
|
|
|
cell c = CELL_TRIVIAL_INITIALIZER;
|
|
|
|
int dimy, dimx;
|
|
|
|
notcurses_term_dim_yx(nc_, &dimy, &dimx);
|
2020-09-29 16:48:19 +00:00
|
|
|
cell_set_styles(&c, NCSTYLE_BOLD);
|
2020-09-10 07:31:23 +00:00
|
|
|
CHECK(1 == cell_load(n_, &c, "b"));
|
2020-09-17 19:34:28 +00:00
|
|
|
cell_set_fg_rgb8(&c, 255, 255, 255);
|
2020-01-30 13:55:01 +00:00
|
|
|
ncplane_set_base_cell(n_, &c);
|
2019-12-27 22:20:20 +00:00
|
|
|
cell_release(n_, &c);
|
|
|
|
CHECK(0 == notcurses_render(nc_));
|
2020-09-29 16:48:19 +00:00
|
|
|
cell_off_styles(&c, NCSTYLE_BOLD);
|
2019-12-27 22:20:20 +00:00
|
|
|
}
|
2019-12-10 13:50:32 +00:00
|
|
|
|
2019-12-27 22:20:20 +00:00
|
|
|
SUBCASE("SetUnderline") {
|
|
|
|
cell c = CELL_TRIVIAL_INITIALIZER;
|
|
|
|
int dimy, dimx;
|
|
|
|
notcurses_term_dim_yx(nc_, &dimy, &dimx);
|
2020-09-29 16:48:19 +00:00
|
|
|
cell_set_styles(&c, NCSTYLE_UNDERLINE);
|
2020-09-10 07:31:23 +00:00
|
|
|
CHECK(1 == cell_load(n_, &c, "u"));
|
2020-09-17 19:34:28 +00:00
|
|
|
cell_set_fg_rgb8(&c, 255, 255, 255);
|
2020-01-30 13:55:01 +00:00
|
|
|
ncplane_set_base_cell(n_, &c);
|
2019-12-27 22:20:20 +00:00
|
|
|
cell_release(n_, &c);
|
|
|
|
CHECK(0 == notcurses_render(nc_));
|
2020-09-29 16:48:19 +00:00
|
|
|
cell_off_styles(&c, NCSTYLE_UNDERLINE);
|
2019-12-27 22:20:20 +00:00
|
|
|
}
|
2019-11-27 15:43:03 +00:00
|
|
|
|
2020-09-10 07:31:23 +00:00
|
|
|
/*SUBCASE("CellLoadTamil") {
|
|
|
|
const char zerodeg[] = "\u0bb8\u0bc0\u0bb0\u0bc7\u0bb3\u0b95\u0bbf\u0b95\u0bbf\u0bb0\u0bbf";
|
|
|
|
cell c = CELL_TRIVIAL_INITIALIZER;
|
|
|
|
size_t ulen = cell_load(n_, &c, zerodeg);
|
|
|
|
// First have U+0BB8 TAMIL LETTER SA U+0BC0 TAMIL VOWEL SIGN II
|
|
|
|
// // e0 ae b8 e0 af 80
|
|
|
|
CHECK(6 == ulen);
|
|
|
|
ulen = cell_load(n_, &c, zerodeg + ulen);
|
|
|
|
// U+0BB0 TAMIL LETTER RA U+0BCB TAMIL VOWEL SIGN OO
|
|
|
|
// e0 ae b0 e0 af 8b
|
|
|
|
CHECK(6 == ulen);
|
|
|
|
// FIXME
|
2019-12-27 22:20:20 +00:00
|
|
|
}*/
|
2019-12-08 18:00:19 +00:00
|
|
|
|
2019-12-27 22:20:20 +00:00
|
|
|
SUBCASE("CellSetFGAlpha"){
|
|
|
|
cell c = CELL_TRIVIAL_INITIALIZER;
|
|
|
|
CHECK(0 > cell_set_fg_alpha(&c, -1));
|
|
|
|
CHECK(0 > cell_set_fg_alpha(&c, 4));
|
|
|
|
CHECK(0 == cell_set_fg_alpha(&c, CELL_ALPHA_OPAQUE));
|
2020-02-07 13:12:18 +00:00
|
|
|
CHECK(cell_fg_default_p(&c));
|
|
|
|
CHECK(cell_bg_default_p(&c));
|
2019-12-30 04:47:42 +00:00
|
|
|
CHECK(CELL_ALPHA_OPAQUE == cell_fg_alpha(&c));
|
2019-12-27 22:20:20 +00:00
|
|
|
CHECK(0 == cell_set_fg_alpha(&c, CELL_ALPHA_HIGHCONTRAST));
|
2019-12-30 04:47:42 +00:00
|
|
|
CHECK(CELL_ALPHA_HIGHCONTRAST == cell_fg_alpha(&c));
|
2020-02-07 13:12:18 +00:00
|
|
|
CHECK(!cell_fg_default_p(&c));
|
2019-12-27 22:20:20 +00:00
|
|
|
CHECK(cell_bg_default_p(&c));
|
|
|
|
}
|
2019-12-08 18:00:19 +00:00
|
|
|
|
2019-12-27 22:20:20 +00:00
|
|
|
SUBCASE("CellSetBGAlpha"){
|
|
|
|
cell c = CELL_TRIVIAL_INITIALIZER;
|
|
|
|
CHECK(0 > cell_set_bg_alpha(&c, -1));
|
|
|
|
CHECK(0 > cell_set_bg_alpha(&c, 4));
|
|
|
|
CHECK(0 == cell_set_bg_alpha(&c, CELL_ALPHA_OPAQUE));
|
2019-12-30 04:47:42 +00:00
|
|
|
CHECK(CELL_ALPHA_OPAQUE == cell_bg_alpha(&c));
|
2019-12-27 22:20:20 +00:00
|
|
|
CHECK(0 != cell_set_bg_alpha(&c, CELL_ALPHA_HIGHCONTRAST));
|
|
|
|
CHECK(0 == cell_set_bg_alpha(&c, CELL_ALPHA_TRANSPARENT));
|
2019-12-30 04:47:42 +00:00
|
|
|
CHECK(CELL_ALPHA_TRANSPARENT == cell_bg_alpha(&c));
|
2019-12-27 22:20:20 +00:00
|
|
|
CHECK(cell_fg_default_p(&c));
|
2020-02-23 17:11:28 +00:00
|
|
|
CHECK(!cell_bg_default_p(&c));
|
2019-12-27 22:20:20 +00:00
|
|
|
}
|
|
|
|
|
2020-07-18 23:23:41 +00:00
|
|
|
// white on a black background ought be unmolested for highcontrast
|
|
|
|
SUBCASE("HighContrastWhiteOnBlackBackground"){
|
2020-08-31 23:39:07 +00:00
|
|
|
cell c = CELL_CHAR_INITIALIZER('+');
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(0 == cell_set_fg_rgb8(&c, 0xff, 0xff, 0xff));
|
2020-07-18 23:23:41 +00:00
|
|
|
CHECK(0 == cell_set_fg_alpha(&c, CELL_ALPHA_HIGHCONTRAST));
|
|
|
|
CHECK(0 == cell_set_bg_alpha(&c, CELL_ALPHA_TRANSPARENT));
|
2020-09-18 08:01:19 +00:00
|
|
|
auto np = ncplane_new(n_, 1, 1, 0, 0, nullptr, nullptr);
|
2020-07-18 23:23:41 +00:00
|
|
|
REQUIRE(nullptr != np);
|
|
|
|
CHECK(1 == ncplane_putc(np, &c));
|
2020-08-31 23:39:07 +00:00
|
|
|
cell_load_char(np, &c, '*');
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(0 == cell_set_bg_rgb8(&c, 0x0, 0x0, 0x0));
|
2020-07-18 23:23:41 +00:00
|
|
|
CHECK(0 == cell_set_bg_alpha(&c, CELL_ALPHA_OPAQUE));
|
|
|
|
CHECK(1 == ncplane_putc(n_, &c));
|
|
|
|
CHECK(0 == notcurses_render(nc_));
|
|
|
|
uint64_t channels, underchannels, overchannels;
|
|
|
|
auto egc = notcurses_at_yx(nc_, 0, 0, nullptr, &channels);
|
|
|
|
REQUIRE(nullptr != egc);
|
|
|
|
auto negc = ncplane_at_yx(n_, 0, 0, nullptr, &underchannels);
|
|
|
|
REQUIRE(nullptr != negc);
|
|
|
|
auto topegc = ncplane_at_yx(np, 0, 0, nullptr, &overchannels);
|
|
|
|
REQUIRE(nullptr != topegc);
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(channels_bg_rgb(channels) == channels_bg_rgb(underchannels));
|
|
|
|
CHECK(channels_fg_rgb(channels) == channels_fg_rgb(overchannels));
|
2020-07-18 23:43:45 +00:00
|
|
|
ncplane_destroy(np);
|
2020-07-18 23:23:41 +00:00
|
|
|
free(topegc);
|
|
|
|
free(negc);
|
|
|
|
free(egc);
|
|
|
|
}
|
|
|
|
|
|
|
|
// white on a white background ought be changed for highcontrast
|
|
|
|
SUBCASE("HighContrastWhiteOnWhiteBackground"){
|
2020-08-31 23:39:07 +00:00
|
|
|
cell c = CELL_CHAR_INITIALIZER('+');
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(0 == cell_set_fg_rgb8(&c, 0xff, 0xff, 0xff));
|
2020-07-18 23:23:41 +00:00
|
|
|
CHECK(0 == cell_set_fg_alpha(&c, CELL_ALPHA_HIGHCONTRAST));
|
|
|
|
CHECK(0 == cell_set_bg_alpha(&c, CELL_ALPHA_TRANSPARENT));
|
2020-09-18 08:01:19 +00:00
|
|
|
auto np = ncplane_new(n_, 1, 1, 0, 0, nullptr, nullptr);
|
2020-07-18 23:23:41 +00:00
|
|
|
REQUIRE(nullptr != np);
|
|
|
|
CHECK(1 == ncplane_putc(np, &c));
|
2020-08-31 23:39:07 +00:00
|
|
|
cell_load_char(np, &c, '*');
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(0 == cell_set_bg_rgb8(&c, 0xff, 0xff, 0xff));
|
2020-07-18 23:23:41 +00:00
|
|
|
CHECK(0 == cell_set_bg_alpha(&c, CELL_ALPHA_OPAQUE));
|
|
|
|
CHECK(1 == ncplane_putc(n_, &c));
|
|
|
|
CHECK(0 == notcurses_render(nc_));
|
|
|
|
uint64_t channels, underchannels, overchannels;
|
|
|
|
auto egc = notcurses_at_yx(nc_, 0, 0, nullptr, &channels);
|
|
|
|
REQUIRE(nullptr != egc);
|
|
|
|
auto negc = ncplane_at_yx(n_, 0, 0, nullptr, &underchannels);
|
|
|
|
REQUIRE(nullptr != negc);
|
|
|
|
auto topegc = ncplane_at_yx(np, 0, 0, nullptr, &overchannels);
|
|
|
|
REQUIRE(nullptr != topegc);
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(channels_bg_rgb(channels) == channels_bg_rgb(underchannels));
|
|
|
|
CHECK(channels_fg_rgb(channels) < channels_fg_rgb(overchannels));
|
2020-07-18 23:43:45 +00:00
|
|
|
ncplane_destroy(np);
|
2020-07-18 23:23:41 +00:00
|
|
|
free(topegc);
|
|
|
|
free(negc);
|
|
|
|
free(egc);
|
|
|
|
}
|
|
|
|
|
|
|
|
// black on a black background must be changed for highcontrast
|
|
|
|
SUBCASE("HighContrastBlackOnBlackBackground"){
|
2020-08-31 23:39:07 +00:00
|
|
|
cell c = CELL_CHAR_INITIALIZER('+');
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(0 == cell_set_fg_rgb8(&c, 0x0, 0x0, 0x0));
|
2020-07-18 23:23:41 +00:00
|
|
|
CHECK(0 == cell_set_fg_alpha(&c, CELL_ALPHA_HIGHCONTRAST));
|
|
|
|
CHECK(0 == cell_set_bg_alpha(&c, CELL_ALPHA_TRANSPARENT));
|
2020-09-18 08:01:19 +00:00
|
|
|
auto np = ncplane_new(n_, 1, 1, 0, 0, nullptr, nullptr);
|
2020-07-18 23:23:41 +00:00
|
|
|
REQUIRE(nullptr != np);
|
|
|
|
CHECK(1 == ncplane_putc(np, &c));
|
2020-08-31 23:39:07 +00:00
|
|
|
cell_load_char(np, &c, '*');
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(0 == cell_set_bg_rgb8(&c, 0x0, 0x0, 0x0));
|
2020-07-18 23:23:41 +00:00
|
|
|
CHECK(0 == cell_set_bg_alpha(&c, CELL_ALPHA_OPAQUE));
|
|
|
|
CHECK(1 == ncplane_putc(n_, &c));
|
|
|
|
CHECK(0 == notcurses_render(nc_));
|
|
|
|
uint64_t channels, underchannels, overchannels;
|
|
|
|
auto egc = notcurses_at_yx(nc_, 0, 0, nullptr, &channels);
|
|
|
|
REQUIRE(nullptr != egc);
|
|
|
|
auto negc = ncplane_at_yx(n_, 0, 0, nullptr, &underchannels);
|
|
|
|
REQUIRE(nullptr != negc);
|
|
|
|
auto topegc = ncplane_at_yx(np, 0, 0, nullptr, &overchannels);
|
|
|
|
REQUIRE(nullptr != topegc);
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(channels_bg_rgb(channels) == channels_bg_rgb(underchannels));
|
|
|
|
CHECK(channels_fg_rgb(channels) > channels_fg_rgb(overchannels));
|
2020-07-18 23:43:45 +00:00
|
|
|
ncplane_destroy(np);
|
2020-07-18 23:23:41 +00:00
|
|
|
free(topegc);
|
|
|
|
free(negc);
|
|
|
|
free(egc);
|
|
|
|
}
|
|
|
|
|
|
|
|
// black on a white background ought be unmolested for highcontrast
|
|
|
|
SUBCASE("HighContrastBlackOnWhiteBackground"){
|
2020-08-31 23:39:07 +00:00
|
|
|
cell c = CELL_CHAR_INITIALIZER('+');
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(0 == cell_set_fg_rgb8(&c, 0x0, 0x0, 0x0));
|
2020-07-18 23:23:41 +00:00
|
|
|
CHECK(0 == cell_set_fg_alpha(&c, CELL_ALPHA_HIGHCONTRAST));
|
|
|
|
CHECK(0 == cell_set_bg_alpha(&c, CELL_ALPHA_TRANSPARENT));
|
2020-09-18 08:01:19 +00:00
|
|
|
auto np = ncplane_new(n_, 1, 1, 0, 0, nullptr, nullptr);
|
2020-07-18 23:23:41 +00:00
|
|
|
REQUIRE(nullptr != np);
|
|
|
|
CHECK(1 == ncplane_putc(np, &c));
|
2020-08-31 23:39:07 +00:00
|
|
|
cell_load_char(np, &c, '*');
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(0 == cell_set_bg_rgb8(&c, 0xff, 0xff, 0xff));
|
2020-07-18 23:23:41 +00:00
|
|
|
CHECK(0 == cell_set_bg_alpha(&c, CELL_ALPHA_OPAQUE));
|
|
|
|
CHECK(1 == ncplane_putc(n_, &c));
|
|
|
|
CHECK(0 == notcurses_render(nc_));
|
|
|
|
uint64_t channels, underchannels, overchannels;
|
|
|
|
auto egc = notcurses_at_yx(nc_, 0, 0, nullptr, &channels);
|
|
|
|
REQUIRE(nullptr != egc);
|
|
|
|
auto negc = ncplane_at_yx(n_, 0, 0, nullptr, &underchannels);
|
|
|
|
REQUIRE(nullptr != negc);
|
|
|
|
auto topegc = ncplane_at_yx(np, 0, 0, nullptr, &overchannels);
|
|
|
|
REQUIRE(nullptr != topegc);
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(channels_bg_rgb(channels) == channels_bg_rgb(underchannels));
|
|
|
|
CHECK(channels_fg_rgb(channels) == channels_fg_rgb(overchannels));
|
2020-07-18 23:43:45 +00:00
|
|
|
ncplane_destroy(np);
|
2020-07-18 23:23:41 +00:00
|
|
|
free(topegc);
|
|
|
|
free(negc);
|
|
|
|
free(egc);
|
|
|
|
}
|
|
|
|
|
|
|
|
// high contrast ought only be activated relevant to the background equal to
|
|
|
|
// or below them, not above.
|
|
|
|
SUBCASE("HighContrastBelowOnly"){
|
2020-07-18 23:43:45 +00:00
|
|
|
cell c = CELL_TRIVIAL_INITIALIZER;
|
2020-07-18 23:23:41 +00:00
|
|
|
// top has a background of white
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(0 == cell_set_bg_rgb8(&c, 0xff, 0xff, 0xff));
|
2020-07-18 23:23:41 +00:00
|
|
|
CHECK(0 == cell_set_fg_alpha(&c, CELL_ALPHA_TRANSPARENT));
|
2020-09-18 08:01:19 +00:00
|
|
|
auto np = ncplane_new(n_, 1, 1, 0, 0, nullptr, nullptr);
|
2020-07-18 23:23:41 +00:00
|
|
|
REQUIRE(nullptr != np);
|
|
|
|
CHECK(1 == ncplane_putc(np, &c));
|
2020-08-31 23:39:07 +00:00
|
|
|
cell_load_char(n_, &c, '*');
|
2020-07-18 23:23:41 +00:00
|
|
|
// bottom has white foreground + HIGHCONTRAST, should remain white
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(0 == cell_set_fg_rgb8(&c, 0xff, 0x0, 0xff));
|
2020-07-18 23:43:45 +00:00
|
|
|
CHECK(0 == cell_set_fg_alpha(&c, CELL_ALPHA_HIGHCONTRAST));
|
|
|
|
cell_set_bg_default(&c);
|
2020-07-18 23:23:41 +00:00
|
|
|
CHECK(1 == ncplane_putc(n_, &c));
|
|
|
|
CHECK(0 == notcurses_render(nc_));
|
|
|
|
uint64_t channels, underchannels, overchannels;
|
|
|
|
auto egc = notcurses_at_yx(nc_, 0, 0, nullptr, &channels);
|
|
|
|
REQUIRE(nullptr != egc);
|
|
|
|
auto negc = ncplane_at_yx(n_, 0, 0, nullptr, &underchannels);
|
|
|
|
REQUIRE(nullptr != negc);
|
|
|
|
auto topegc = ncplane_at_yx(np, 0, 0, nullptr, &overchannels);
|
|
|
|
REQUIRE(nullptr != topegc);
|
2020-09-17 19:34:28 +00:00
|
|
|
CHECK(channels_bg_rgb(channels) == channels_bg_rgb(overchannels));
|
|
|
|
CHECK(channels_fg_rgb(channels) < channels_fg_rgb(underchannels));
|
2020-07-18 23:23:41 +00:00
|
|
|
free(topegc);
|
|
|
|
free(negc);
|
|
|
|
free(egc);
|
|
|
|
}
|
|
|
|
|
2019-12-27 22:20:20 +00:00
|
|
|
// common teardown
|
|
|
|
CHECK(0 == notcurses_stop(nc_));
|
2019-12-08 18:00:19 +00:00
|
|
|
}
|