add ncdirect_ascii_box(), use it in DefaultBox unit test

This commit is contained in:
nick black 2021-06-12 17:20:37 -04:00
parent 4ca1036da9
commit 0b72bec79d
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
5 changed files with 14 additions and 2 deletions

View File

@ -1,6 +1,9 @@
This document attempts to list user-visible changes and any major internal
rearrangements of Notcurses.
* 2.3.4 (not yet released)
* Added `ncdirect_ascii_box()`.
* 2.3.3 (2021-06-12)
* Added the flag `NCVISUAL_OPTION_NOINTERPOLATE` to use non-interpolative
scaling in `ncvisual_render()`. `ncvisual_render()` without a multimedia

View File

@ -288,6 +288,13 @@ ncdirect_heavy_box(struct ncdirect* n, uint64_t ul, uint64_t ur,
return ncdirect_box(n, ul, ur, ll, lr, NCBOXHEAVYW, ylen, xlen, ctlword);
}
__attribute__ ((nonnull (1))) static inline int
ncdirect_ascii_box(struct ncdirect* n, uint64_t ul, uint64_t ur,
uint64_t ll, uint64_t lr,
int ylen, int xlen, unsigned ctlword){
return ncdirect_box(n, ul, ur, ll, lr, NCBOXASCIIW, ylen, xlen, ctlword);
}
// ncdirect_box() with the rounded box-drawing characters
API int ncdirect_rounded_box(struct ncdirect* n, uint64_t ul, uint64_t ur,
uint64_t ll, uint64_t lr,

View File

@ -10,11 +10,13 @@ extern "C" {
#define NCBOXHEAVY "┏┓┗┛━┃"
#define NCBOXROUND "╭╮╰╯─│"
#define NCBOXDOUBLE "╔╗╚╝═║"
#define NCBOXASCII "/\\\\/-|"
// argh
#define NCBOXLIGHTW L"┌┐└┘─│"
#define NCBOXHEAVYW L"┏┓┗┛━┃"
#define NCBOXROUNDW L"╭╮╰╯─│"
#define NCBOXDOUBLEW L"╔╗╚╝═║"
#define NCBOXASCIIW L"/\\\\/-|"
#ifdef __cplusplus
} // extern "C"

View File

@ -2327,7 +2327,7 @@ API int nccells_rounded_box(struct ncplane* n, uint32_t styles, uint64_t channel
static inline int
nccells_ascii_box(struct ncplane* n, uint32_t attr, uint64_t channels,
nccell* ul, nccell* ur, nccell* ll, nccell* lr, nccell* hl, nccell* vl){
return nccells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, "/\\\\/-|");
return nccells_load_box(n, attr, channels, ul, ur, ll, lr, hl, vl, NCBOXASCII);
}
static inline int

View File

@ -58,7 +58,7 @@ TEST_CASE("Direct") {
ncchannels_set_bg_default(&chans);
ncdirect_set_bg_rgb8(nc_, 0x88, 0x88, 0x88);
printf("test background\n");
CHECK(0 == ncdirect_rounded_box(nc_, chans, chans, chans, chans, 8, 8, 0));
CHECK(0 == ncdirect_ascii_box(nc_, chans, chans, chans, chans, 8, 8, 0));
}
#ifndef NOTCURSES_USE_MULTIMEDIA