[planes] add NCPLANE_OPTION_MARGINALIZED #1472

This commit is contained in:
nick black 2021-03-27 06:01:51 -04:00 committed by Nick Black
parent a3a4f40fa0
commit 78c8e70933
32 changed files with 242 additions and 46 deletions

View File

@ -16,6 +16,9 @@ rearrangements of Notcurses.
tabs. Courtesy Łukasz Drukała, in his first contribution. tabs. Courtesy Łukasz Drukała, in his first contribution.
* Removed **notcurses_canpixel()**, which was obsoleted by * Removed **notcurses_canpixel()**, which was obsoleted by
**notcurses_check_pixel_support()**. **notcurses_check_pixel_support()**.
* Added `NCPLANE_OPTION_MARGINALIZED` flag for `ncplane_create()`. Added
the `ncplane_resize_marginalized()` resize callback. This allows you to
have automatic resizing with a margin relative to some parent plane.
* 2.2.3 (2021-03-08) * 2.2.3 (2021-03-08)
* Implemented **EXPERIMENTAL** `NCBLIT_PIXEL` for terminals reporting Sixel * Implemented **EXPERIMENTAL** `NCBLIT_PIXEL` for terminals reporting Sixel

View File

@ -731,16 +731,24 @@ When an `ncplane` is no longer needed, free it with
#define NCPLANE_OPTION_HORALIGNED 0x0001ull #define NCPLANE_OPTION_HORALIGNED 0x0001ull
// Vertical alignment relative to the parent plane. Use ncalign_e for 'y'. // Vertical alignment relative to the parent plane. Use ncalign_e for 'y'.
#define NCPLANE_OPTION_VERALIGNED 0x0002ull #define NCPLANE_OPTION_VERALIGNED 0x0002ull
// Maximize relative to the parent plane, modulo the provided margins. The
// margins are best-effort; the plane will always be at least 1 column by
// 1 row. If the margins can be effected, the plane will be sized to all
// remaining space. 'y' and 'x' are overloaded as the top and left margins
// when this flag is used. 'rows' and 'cols' must be 0 when this flag is
// used. This flag is exclusive with both of the alignment flags.
#define NCPLANE_OPTION_MARGINALIZED 0x0004ull
typedef struct ncplane_options { typedef struct ncplane_options {
int y; // vertical placement relative to parent plane int y; // vertical placement relative to parent plane
int x; // horizontal placement relative to parent plane int x; // horizontal placement relative to parent plane
int rows; // number of rows, must be positive int rows; // rows, must be positive (unless NCPLANE_OPTION_MARGINALIZED)
int cols; // number of columns, must be positive int cols; // columns, must be positive (unless NCPLANE_OPTION_MARGINALIZED)
void* userptr; // user curry, may be NULL void* userptr; // user curry, may be NULL
const char* name; // name (used only for debugging), may be NULL const char* name; // name (used only for debugging), may be NULL
int (*resizecb)(struct ncplane*); // callback when parent is resized int (*resizecb)(struct ncplane*); // callback when parent is resized
uint64_t flags; // closure over NCPLANE_OPTION_* uint64_t flags; // closure over NCPLANE_OPTION_*
int margin_b, margin_r; // margins (require NCPLANE_OPTION_MARGINALIZED)
} ncplane_options; } ncplane_options;
// Create a new ncplane bound to plane 'n', at the offset 'y'x'x' (relative to // Create a new ncplane bound to plane 'n', at the offset 'y'x'x' (relative to
@ -768,8 +776,17 @@ void ncplane_set_resizecb(struct ncplane* n, int(*resizecb)(struct ncplane*));
// Returns the ncplane's current resize callback. // Returns the ncplane's current resize callback.
int (*ncplane_resizecb(const struct ncplane* n))(struct ncplane*); int (*ncplane_resizecb(const struct ncplane* n))(struct ncplane*);
// Suitable for use as a 'resizecb'. This will realign the plane 'n' against its // Suitable for use as a 'resizecb', this will resize the plane to the visual
// parent, using the alignment specified at ncplane_create()-time. // region's size. It is used for the standard plane.
int ncplane_resize_maximize(struct ncplane* n);
// Suitable for use as a 'resizecb' with planes created with
// NCPLANE_OPTION_MARGINALIZED. This will resize the plane 'n' against its
// parent, attempting to enforce the supplied margins.
int ncplane_resize_marginalize(struct ncplane* n);
// Suitable for use as a 'resizecb'. This will realign the plane 'n' against
// its parent, using the alignment specified at ncplane_create()-time.
int ncplane_resize_realign(struct ncplane* n); int ncplane_resize_realign(struct ncplane* n);
// Get the plane to which the plane 'n' is bound, if any. // Get the plane to which the plane 'n' is bound, if any.

View File

@ -11,8 +11,9 @@ notcurses_plane - operations on ncplanes
**#include <notcurses/notcurses.h>** **#include <notcurses/notcurses.h>**
```c ```c
#define NCPLANE_OPTION_HORALIGNED 0x0001ull #define NCPLANE_OPTION_HORALIGNED 0x0001ull
#define NCPLANE_OPTION_VERALIGNED 0x0002ull #define NCPLANE_OPTION_VERALIGNED 0x0002ull
#define NCPLANE_OPTION_MARGINALIZED 0x0004ull
typedef struct ncplane_options { typedef struct ncplane_options {
int y; // vertical placement relative to parent plane int y; // vertical placement relative to parent plane
@ -23,6 +24,7 @@ typedef struct ncplane_options {
const char* name; // name (used only for debugging), may be NULL const char* name; // name (used only for debugging), may be NULL
int (*resizecb)(struct ncplane*); // called on parent resize int (*resizecb)(struct ncplane*); // called on parent resize
uint64_t flags; // closure over NCPLANE_OPTION_* uint64_t flags; // closure over NCPLANE_OPTION_*
int margin_b, margin_r; // bottom and right margins
} ncplane_options; } ncplane_options;
``` ```
@ -46,6 +48,10 @@ typedef struct ncplane_options {
**int ncplane_resize_realign(struct ncplane* ***n***);** **int ncplane_resize_realign(struct ncplane* ***n***);**
**int ncplane_resize_maximize(struct ncplane* ***n***);**
**int ncplane_resize_marginalize(struct ncplane* ***n***);**
**void ncplane_set_resizecb(struct ncplane* ***n***, int(*resizecb)(struct ncplane*));** **void ncplane_set_resizecb(struct ncplane* ***n***, int(*resizecb)(struct ncplane*));**
**int (*ncplane_resizecb(const struct ncplane* ***n***))(struct ncplane*);** **int (*ncplane_resizecb(const struct ncplane* ***n***))(struct ncplane*);**
@ -209,6 +215,7 @@ anywhere. In addition to its framebuffer--a rectilinear matrix of **nccell**s
* the plane, if any, to which it is bound, * the plane, if any, to which it is bound,
* the next plane bound by the plane to which it is bound, * the next plane bound by the plane to which it is bound,
* the head of the list of its bound planes, * the head of the list of its bound planes,
* its resize methodology,
* its z-index, and * its z-index, and
* a name (used only for debugging). * a name (used only for debugging).
@ -222,7 +229,19 @@ If the **NCPLANE_OPTION_HORALIGNED** flag is provided, ***x*** is interpreted
as an **ncalign_e** rather than an absolute position. If the as an **ncalign_e** rather than an absolute position. If the
**NCPLANE_OPTION_VERALIGNED** flag is provided, ***y*** is interpreted as an **NCPLANE_OPTION_VERALIGNED** flag is provided, ***y*** is interpreted as an
**ncalign_e** rather than an absolute postiion. Either way, all positions **ncalign_e** rather than an absolute postiion. Either way, all positions
are relative to the parent plane. are relative to the parent plane. **ncplane_resize_realign** should usually be
used together with these flags, so that the plane is automatically realigned
upon a resize of its parent.
If the **NCPLANE_OPTION_MARGINALIZED** flag is provided, neither
**NCPLANE_OPTION_HORALIGNED** nor **NCPLANE_OPTION_VERALIGNED** may be
provided, and ***rows*** and ***cols*** must both be 0. ***y*** and ***x***
will be interpreted as top and left margins. ***margin_b*** and ***margin_r***
will be interpreted as bottom and right margins. The plane will take the maximum
space possible subject to its parent planes and these margins. The plane cannot
become smaller than 1x1 (the margins are best-effort).
**ncplane_resize_marginalize** should usually be used together with this flag,
so that the plane is automatically resized.
**ncplane_reparent** detaches the plane ***n*** from any plane to which it is **ncplane_reparent** detaches the plane ***n*** from any plane to which it is
bound, and binds it to ***newparent***. Its children are reparented to its bound, and binds it to ***newparent***. Its children are reparented to its

View File

@ -92,6 +92,8 @@ namespace ncpp
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0,
.margin_r = 0,
}; };
plane = ncplane_create ( plane = ncplane_create (
notcurses_stdplane(get_notcurses ()), notcurses_stdplane(get_notcurses ()),
@ -1310,6 +1312,8 @@ namespace ncpp
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0,
.margin_r = 0,
}; };
return create_plane (n, nopts); return create_plane (n, nopts);
} }
@ -1325,6 +1329,8 @@ namespace ncpp
nullptr, nullptr,
nullptr, nullptr,
0, 0,
0,
0,
}; };
return create_plane (n, nopts); return create_plane (n, nopts);
} }

View File

@ -1130,16 +1130,24 @@ API char* notcurses_at_yx(struct notcurses* nc, int yoff, int xoff,
#define NCPLANE_OPTION_HORALIGNED 0x0001ull #define NCPLANE_OPTION_HORALIGNED 0x0001ull
// Vertical alignment relative to the parent plane. Use ncalign_e for 'y'. // Vertical alignment relative to the parent plane. Use ncalign_e for 'y'.
#define NCPLANE_OPTION_VERALIGNED 0x0002ull #define NCPLANE_OPTION_VERALIGNED 0x0002ull
// Maximize relative to the parent plane, modulo the provided margins. The
// margins are best-effort; the plane will always be at least 1 column by
// 1 row. If the margins can be effected, the plane will be sized to all
// remaining space. 'y' and 'x' are overloaded as the top and left margins
// when this flag is used. 'rows' and 'cols' must be 0 when this flag is
// used. This flag is exclusive with both of the alignment flags.
#define NCPLANE_OPTION_MARGINALIZED 0x0004ull
typedef struct ncplane_options { typedef struct ncplane_options {
int y; // vertical placement relative to parent plane int y; // vertical placement relative to parent plane
int x; // horizontal placement relative to parent plane int x; // horizontal placement relative to parent plane
int rows; // number of rows, must be positive int rows; // rows, must be positive (unless NCPLANE_OPTION_MARGINALIZED)
int cols; // number of columns, must be positive int cols; // columns, must be positive (unless NCPLANE_OPTION_MARGINALIZED)
void* userptr; // user curry, may be NULL void* userptr; // user curry, may be NULL
const char* name; // name (used only for debugging), may be NULL const char* name; // name (used only for debugging), may be NULL
int (*resizecb)(struct ncplane*); // callback when parent is resized int (*resizecb)(struct ncplane*); // callback when parent is resized
uint64_t flags; // closure over NCPLANE_OPTION_* uint64_t flags; // closure over NCPLANE_OPTION_*
int margin_b, margin_r; // margins (require NCPLANE_OPTION_MARGINALIZED)
} ncplane_options; } ncplane_options;
// Create a new ncplane bound to plane 'n', at the offset 'y'x'x' (relative to // Create a new ncplane bound to plane 'n', at the offset 'y'x'x' (relative to
@ -1162,6 +1170,11 @@ API ALLOC struct ncplane* ncplane_new(struct ncplane* n, int rows, int cols, int
// region's size. It is used for the standard plane. // region's size. It is used for the standard plane.
API int ncplane_resize_maximize(struct ncplane* n); API int ncplane_resize_maximize(struct ncplane* n);
// Suitable for use as a 'resizecb' with planes created with
// NCPLANE_OPTION_MARGINALIZED. This will resize the plane 'n' against its
// parent, attempting to enforce the supplied margins.
API int ncplane_resize_marginalize(struct ncplane* n);
// Suitable for use as a 'resizecb'. This will realign the plane 'n' against // Suitable for use as a 'resizecb'. This will realign the plane 'n' against
// its parent, using the alignment specified at ncplane_create()-time. // its parent, using the alignment specified at ncplane_create()-time.
API int ncplane_resize_realign(struct ncplane* n); API int ncplane_resize_realign(struct ncplane* n);

View File

@ -416,6 +416,7 @@ const ncplane* notcurses_stdplane_const(const notcurses* nc){
} }
ncplane* ncplane_create(ncplane* n, const ncplane_options* nopts){ ncplane* ncplane_create(ncplane* n, const ncplane_options* nopts){
fprintf(stderr, "nopts: %p name: %s\n", nopts, nopts->name);
return ncplane_new_internal(ncplane_notcurses(n), n, nopts); return ncplane_new_internal(ncplane_notcurses(n), n, nopts);
} }
@ -473,6 +474,7 @@ inline int ncplane_cursor_move_yx(ncplane* n, int y, int x){
} }
ncplane* ncplane_dup(const ncplane* n, void* opaque){ ncplane* ncplane_dup(const ncplane* n, void* opaque){
fprintf(stderr, "FUCXK ME IN THE ASS\n");
int dimy = n->leny; int dimy = n->leny;
int dimx = n->lenx; int dimx = n->lenx;
// if we're duping the standard plane, we need adjust for marginalia // if we're duping the standard plane, we need adjust for marginalia
@ -2152,13 +2154,17 @@ int (*ncplane_resizecb(const ncplane* n))(ncplane*){
return n->resizecb; return n->resizecb;
} }
int ncplane_resize_marginalize(ncplane* n){
(void)n;// FIXME uhhh do something here
return 0;
}
int ncplane_resize_maximize(ncplane* n){ int ncplane_resize_maximize(ncplane* n){
const ncpile* pile = ncplane_pile(n); const ncpile* pile = ncplane_pile(n); // FIXME should be taken against parent
const int rows = pile->dimy; const int rows = pile->dimy;
const int cols = pile->dimx; const int cols = pile->dimx;
int oldy, oldx; int oldy, oldx;
ncplane_dim_yx(n, &oldy, &oldx); // current dimensions of 'n' ncplane_dim_yx(n, &oldy, &oldx); // current dimensions of 'n'
//fprintf(stderr, "CURRENT: %d/%d TERM: %d/%d\n", oldy, oldx, rows, cols);
int keepleny = oldy > rows ? rows : oldy; int keepleny = oldy > rows ? rows : oldy;
int keeplenx = oldx > cols ? cols : oldx; int keeplenx = oldx > cols ? cols : oldx;
return ncplane_resize_internal(n, 0, 0, keepleny, keeplenx, 0, 0, rows, cols); return ncplane_resize_internal(n, 0, 0, keepleny, keeplenx, 0, 0, rows, cols);
@ -2166,6 +2172,7 @@ int ncplane_resize_maximize(ncplane* n){
int ncplane_resize_realign(ncplane* n){ int ncplane_resize_realign(ncplane* n){
const ncplane* parent = ncplane_parent_const(n); const ncplane* parent = ncplane_parent_const(n);
// FIXME this *should* be allowed for other root planes, though, right?
if(parent == n){ // somehow got stdplane, should never get here if(parent == n){ // somehow got stdplane, should never get here
logerror(ncplane_notcurses(n), "Passed the standard plane"); logerror(ncplane_notcurses(n), "Passed the standard plane");
return -1; return -1;

View File

@ -958,7 +958,7 @@ rasterize_sprixels(notcurses* nc, const ncpile* p, FILE* out){
ncplane_yx(s->n, &y, &x); ncplane_yx(s->n, &y, &x);
y += s->y; y += s->y;
x += s->x; x += s->x;
//fprintf(stderr, "DRAWING BITMAP AT %d/%d\n", y + nc->stdplane->absy, x + nc->stdplane->absx); //fprintf(stderr, "DRAWING BITMAP %d AT %d/%d\n", s->id, y + nc->stdplane->absy, x + nc->stdplane->absx);
if(goto_location(nc, out, y + nc->stdplane->absy, x + nc->stdplane->absx)){ if(goto_location(nc, out, y + nc->stdplane->absy, x + nc->stdplane->absx)){
return -1; return -1;
} }

View File

@ -61,19 +61,26 @@ sprixel* sprixel_create(ncplane* n, const char* s, int bytes, int placey, int pl
} }
int sprite_wipe_cell(const notcurses* nc, sprixel* s, int ycell, int xcell){ int sprite_wipe_cell(const notcurses* nc, sprixel* s, int ycell, int xcell){
if(s->invalidated == SPRIXEL_HIDE){ // no need to do work if we're killing it
return 0;
}
if(!nc->tcache.pixel_cell_wipe){ if(!nc->tcache.pixel_cell_wipe){
return 0; return 0;
} }
if(ycell >= s->dimy){ if(ycell >= s->dimy || ycell < 0){
logerror(nc, "Bad y coordinate %d (%d)\n", ycell, s->dimy);
return -1; return -1;
} }
if(xcell >= s->dimx){ if(xcell >= s->dimx || xcell < 0){
logerror(nc, "Bad x coordinate %d (%d)\n", xcell, s->dimx);
return -1; return -1;
} }
if(s->tacache[s->dimx * ycell + xcell] == 2){ if(s->tacache[s->dimx * ycell + xcell] == 2){
//fprintf(stderr, "CACHED WIPE %d %d/%d\n", s->id, ycell, xcell);
return 0; // already annihilated return 0; // already annihilated
} }
s->tacache[s->dimx * ycell + xcell] = 2; s->tacache[s->dimx * ycell + xcell] = 2;
//fprintf(stderr, "WIPING %d %d/%d\n", s->id, ycell, xcell);
int r = nc->tcache.pixel_cell_wipe(nc, s, ycell, xcell); int r = nc->tcache.pixel_cell_wipe(nc, s, ycell, xcell);
if(r == 0){ if(r == 0){
s->invalidated = SPRIXEL_INVALIDATED; s->invalidated = SPRIXEL_INVALIDATED;

View File

@ -55,6 +55,8 @@ auto handle_subtitle(char* subtitle, struct marshal* marsh,
.name = "subt", .name = "subt",
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0,
.margin_r = 0,
}; };
marsh->subtitle_plane = ncplane_create(vopts->n, &nopts); marsh->subtitle_plane = ncplane_create(vopts->n, &nopts);
uint64_t channels = 0; uint64_t channels = 0;
@ -96,7 +98,7 @@ auto perframe(struct ncvisual* ncv, struct ncvisual_options* vopts,
marsh->blitter = ncvisual_media_defblitter(nc, vopts->scaling); marsh->blitter = ncvisual_media_defblitter(nc, vopts->scaling);
} }
if(!marsh->quiet){ if(!marsh->quiet){
// FIXME put this on its own plane if we're going to erase()ing it // FIXME put this on its own plane if we're going to be erase()ing it
stdn->erase(); stdn->erase();
stdn->printf(0, NCAlign::Left, "frame %06d (%s)", marsh->framecount, stdn->printf(0, NCAlign::Left, "frame %06d (%s)", marsh->framecount,
notcurses_str_blitter(vopts->blitter)); notcurses_str_blitter(vopts->blitter));
@ -122,14 +124,15 @@ auto perframe(struct ncvisual* ncv, struct ncvisual_options* vopts,
nc.get_term_dim(&dimy, &dimx); nc.get_term_dim(&dimy, &dimx);
ncplane_dim_yx(vopts->n, &oldy, &oldx); ncplane_dim_yx(vopts->n, &oldy, &oldx);
uint64_t absnow = timespec_to_ns(abstime); uint64_t absnow = timespec_to_ns(abstime);
char32_t keyp;
for( ; ; ){ for( ; ; ){
struct timespec interval; struct timespec interval;
clock_gettime(CLOCK_MONOTONIC, &interval); clock_gettime(CLOCK_MONOTONIC, &interval);
uint64_t nsnow = timespec_to_ns(&interval); uint64_t nsnow = timespec_to_ns(&interval);
char32_t keyp;
ncinput ni;
if(absnow > nsnow){ if(absnow > nsnow){
ns_to_timespec(absnow - nsnow, &interval); ns_to_timespec(absnow - nsnow, &interval);
keyp = nc.getc(&interval, nullptr, nullptr); keyp = nc.getc(&interval, nullptr, &ni);
}else{ }else{
keyp = nc.getc(); keyp = nc.getc();
} }
@ -147,17 +150,14 @@ auto perframe(struct ncvisual* ncv, struct ncvisual_options* vopts,
} }
if(keyp == NCKey::Resize){ if(keyp == NCKey::Resize){
return 0; return 0;
}else if(keyp == 'L'){ // FIXME check for ctrl+l }else if(keyp == 'L' && ni.ctrl){
nc.refresh(nullptr, nullptr); nc.refresh(nullptr, nullptr);
continue; continue;
}else if(keyp >= '0' && keyp <= '6'){ // FIXME eliminate ctrl/alt }else if(keyp >= '0' && keyp <= '6' && !ni.alt && !ni.ctrl){
marsh->blitter = static_cast<ncblitter_e>(keyp - '0'); marsh->blitter = static_cast<ncblitter_e>(keyp - '0');
vopts->blitter = marsh->blitter; vopts->blitter = marsh->blitter;
if(vopts->blitter == NCBLIT_PIXEL){ if(vopts->blitter == NCBLIT_PIXEL){
notcurses_check_pixel_support(nc); notcurses_check_pixel_support(nc);
vopts->y = 1;
}else{
vopts->y = 0;
} }
continue; continue;
}else if(keyp == NCKey::Up){ }else if(keyp == NCKey::Up){
@ -343,11 +343,16 @@ int rendered_mode_player_inner(NotCurses& nc, int argc, char** argv,
channels_set_bg_alpha(&transchan, CELL_ALPHA_TRANSPARENT); channels_set_bg_alpha(&transchan, CELL_ALPHA_TRANSPARENT);
stdn->set_base("", 0, transchan); stdn->set_base("", 0, transchan);
struct ncplane_options nopts{}; struct ncplane_options nopts{};
nopts.rows = dimy - 1; // don't want kitty to scroll on pixels FIXME // leave a line at the bottom. perhaps one day we'll put information there.
nopts.cols = dimx; // for now, this keeps us from scrolling when we use bitmaps.
nopts.resizecb = ncplane_resize_maximize; nopts.margin_b = 1;
auto n = std::make_unique<Plane>(*stdn, &nopts); nopts.resizecb = ncplane_resize_marginalize;
n->move_bottom(); nopts.flags = NCPLANE_OPTION_MARGINALIZED;
auto n = ncplane_create(*stdn, &nopts);
if(!n){
return -1;
}
ncplane_move_bottom(n);
for(auto i = 0 ; i < argc ; ++i){ for(auto i = 0 ; i < argc ; ++i){
std::unique_ptr<Visual> ncv; std::unique_ptr<Visual> ncv;
ncv = std::make_unique<Visual>(argv[i]); ncv = std::make_unique<Visual>(argv[i]);
@ -356,13 +361,13 @@ int rendered_mode_player_inner(NotCurses& nc, int argc, char** argv,
vopts.flags |= NCVISUAL_OPTION_HORALIGNED | NCVISUAL_OPTION_VERALIGNED; vopts.flags |= NCVISUAL_OPTION_HORALIGNED | NCVISUAL_OPTION_VERALIGNED;
vopts.y = NCALIGN_CENTER; vopts.y = NCALIGN_CENTER;
vopts.x = NCALIGN_CENTER; vopts.x = NCALIGN_CENTER;
vopts.n = *n; vopts.n = n;
vopts.scaling = scalemode; vopts.scaling = scalemode;
vopts.blitter = blitter; vopts.blitter = blitter;
if(vopts.blitter == NCBLIT_PIXEL){ if(vopts.blitter == NCBLIT_PIXEL){
notcurses_check_pixel_support(nc); notcurses_check_pixel_support(nc);
} }
n->erase(); ncplane_erase(n);
do{ do{
struct marshal marsh = { struct marshal marsh = {
.subtitle_plane = nullptr, .subtitle_plane = nullptr,
@ -377,7 +382,7 @@ int rendered_mode_player_inner(NotCurses& nc, int argc, char** argv,
vopts.blitter = marsh.blitter; vopts.blitter = marsh.blitter;
if(!loop){ if(!loop){
if(displaytime < 0){ if(displaytime < 0){
stdn->printf(0, NCAlign::Center, "press key to advance"); stdn->printf(0, NCAlign::Center, "press a key to advance");
if(!nc.render()){ if(!nc.render()){
return -1; return -1;
} }

View File

@ -46,6 +46,7 @@ auto main(int argc, const char** argv) -> int {
.name = "read", .name = "read",
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* rp = ncplane_create(**n, &nopts); struct ncplane* rp = ncplane_create(**n, &nopts);
ncplane_set_base(rp, "", 0, 0); ncplane_set_base(rp, "", 0, 0);

View File

@ -222,6 +222,7 @@ int main(int argc, char** argv){
.name = "reel", .name = "reel",
.resizecb = resize_reel, .resizecb = resize_reel,
.flags = NCPLANE_OPTION_HORALIGNED, .flags = NCPLANE_OPTION_HORALIGNED,
.margin_b = 0, .margin_r = 0,
}; };
n = ncplane_create(nstd, &nopts); n = ncplane_create(nstd, &nopts);
if(!n){ if(!n){

View File

@ -23,6 +23,7 @@ TEST_CASE("Blitting") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
REQUIRE(nullptr != ncp); REQUIRE(nullptr != ncp);
@ -71,6 +72,7 @@ TEST_CASE("Blitting") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
REQUIRE(nullptr != ncp); REQUIRE(nullptr != ncp);

View File

@ -162,6 +162,7 @@ TEST_CASE("Cell") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto np = ncplane_create(n_, &nopts); auto np = ncplane_create(n_, &nopts);
REQUIRE(nullptr != np); REQUIRE(nullptr != np);
@ -201,6 +202,7 @@ TEST_CASE("Cell") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto np = ncplane_create(n_, &nopts); auto np = ncplane_create(n_, &nopts);
REQUIRE(nullptr != np); REQUIRE(nullptr != np);
@ -240,6 +242,7 @@ TEST_CASE("Cell") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto np = ncplane_create(n_, &nopts); auto np = ncplane_create(n_, &nopts);
REQUIRE(nullptr != np); REQUIRE(nullptr != np);
@ -279,6 +282,7 @@ TEST_CASE("Cell") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto np = ncplane_create(n_, &nopts); auto np = ncplane_create(n_, &nopts);
REQUIRE(nullptr != np); REQUIRE(nullptr != np);
@ -319,6 +323,7 @@ TEST_CASE("Cell") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto np = ncplane_create(n_, &nopts); auto np = ncplane_create(n_, &nopts);
REQUIRE(nullptr != np); REQUIRE(nullptr != np);

View File

@ -44,6 +44,7 @@ TEST_CASE("Fills") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* pfn = ncplane_create(n_, &nopts); struct ncplane* pfn = ncplane_create(n_, &nopts);
REQUIRE(nullptr != pfn); REQUIRE(nullptr != pfn);
@ -76,6 +77,7 @@ TEST_CASE("Fills") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* pfn = ncplane_create(n_, &nopts); struct ncplane* pfn = ncplane_create(n_, &nopts);
REQUIRE(nullptr != pfn); REQUIRE(nullptr != pfn);
@ -95,6 +97,7 @@ TEST_CASE("Fills") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* pfn = ncplane_create(n_, &nopts); struct ncplane* pfn = ncplane_create(n_, &nopts);
REQUIRE(nullptr != pfn); REQUIRE(nullptr != pfn);
@ -366,6 +369,7 @@ TEST_CASE("Fills") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* p1 = ncplane_create(n_, &nopts); struct ncplane* p1 = ncplane_create(n_, &nopts);
REQUIRE(p1); REQUIRE(p1);
@ -410,6 +414,7 @@ TEST_CASE("Fills") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto p1 = ncplane_create(n_, &nopts); auto p1 = ncplane_create(n_, &nopts);
REQUIRE(p1); REQUIRE(p1);
@ -464,6 +469,7 @@ TEST_CASE("Fills") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* p1 = ncplane_create(n_, &nopts); struct ncplane* p1 = ncplane_create(n_, &nopts);
REQUIRE(p1); REQUIRE(p1);
@ -482,6 +488,7 @@ TEST_CASE("Fills") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto p2 = ncplane_create(n_, &n2opts); auto p2 = ncplane_create(n_, &n2opts);
REQUIRE(p2); REQUIRE(p2);
@ -523,6 +530,7 @@ TEST_CASE("Fills") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* p1 = ncplane_create(n_, &nopts); struct ncplane* p1 = ncplane_create(n_, &nopts);
REQUIRE(p1); REQUIRE(p1);
@ -541,6 +549,7 @@ TEST_CASE("Fills") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto p2 = ncplane_create(n_, &n2opts); auto p2 = ncplane_create(n_, &n2opts);
REQUIRE(p2); REQUIRE(p2);

View File

@ -33,6 +33,7 @@ TEST_CASE("Geometry") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto n = ncplane_create(n_, &nopts); auto n = ncplane_create(n_, &nopts);
REQUIRE(n); REQUIRE(n);
@ -79,6 +80,7 @@ TEST_CASE("Geometry") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto n = ncplane_create(n_, &nopts); auto n = ncplane_create(n_, &nopts);
REQUIRE(n); REQUIRE(n);

View File

@ -21,6 +21,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -45,6 +46,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -69,6 +71,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -94,6 +97,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -120,6 +124,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -146,6 +151,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -172,6 +178,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -199,6 +206,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -227,6 +235,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -255,6 +264,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -281,6 +291,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -307,6 +318,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -333,6 +345,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -359,6 +372,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -385,6 +399,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -411,6 +426,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -438,6 +454,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -466,6 +483,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -492,6 +510,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -526,6 +545,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -560,6 +580,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);
@ -597,6 +618,7 @@ TEST_CASE("TextLayout") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto sp = ncplane_create(n_, &nopts); auto sp = ncplane_create(n_, &nopts);
REQUIRE(sp); REQUIRE(sp);

View File

@ -80,6 +80,7 @@ TEST_CASE("NotcursesBase") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
planes[idx] = ncplane_create(notcurses_stdplane(nc_), &nopts); planes[idx] = ncplane_create(notcurses_stdplane(nc_), &nopts);
REQUIRE(planes[idx]); REQUIRE(planes[idx]);

View File

@ -13,6 +13,7 @@ TEST_CASE("Piles") {
SUBCASE("SmallerPileRender") { SUBCASE("SmallerPileRender") {
struct ncplane_options nopts = { struct ncplane_options nopts = {
1, 1, dimy - 2, dimx - 2, nullptr, "small", nullptr, 0, 1, 1, dimy - 2, dimx - 2, nullptr, "small", nullptr, 0,
.margin_b = 0, .margin_r = 0,
}; };
auto np = ncpile_create(nc_, &nopts); auto np = ncpile_create(nc_, &nopts);
REQUIRE(nullptr != np); REQUIRE(nullptr != np);
@ -49,7 +50,7 @@ TEST_CASE("Piles") {
// create a plane bigger than the standard plane, and render it as a pile // create a plane bigger than the standard plane, and render it as a pile
SUBCASE("BiggerPileRender") { SUBCASE("BiggerPileRender") {
struct ncplane_options nopts = { struct ncplane_options nopts = {
-1, -1, dimy + 2, dimx + 2, nullptr, "big", nullptr, 0, -1, -1, dimy + 2, dimx + 2, nullptr, "big", nullptr, 0, 0, 0,
}; };
auto np = ncpile_create(nc_, &nopts); auto np = ncpile_create(nc_, &nopts);
REQUIRE(nullptr != np); REQUIRE(nullptr != np);
@ -86,7 +87,7 @@ TEST_CASE("Piles") {
// create a new pile, and rotate subplanes through the root set // create a new pile, and rotate subplanes through the root set
SUBCASE("ShufflePile") { SUBCASE("ShufflePile") {
struct ncplane_options nopts = { struct ncplane_options nopts = {
1, 1, dimy - 2, dimx - 2, nullptr, "new1", nullptr, 0, 1, 1, dimy - 2, dimx - 2, nullptr, "new1", nullptr, 0, 0, 0,
}; };
auto n1 = ncpile_create(nc_, &nopts); auto n1 = ncpile_create(nc_, &nopts);
REQUIRE(nullptr != n1); REQUIRE(nullptr != n1);
@ -131,7 +132,7 @@ TEST_CASE("Piles") {
SUBCASE("ShufflePileFamilies") { SUBCASE("ShufflePileFamilies") {
struct ncplane_options nopts = { struct ncplane_options nopts = {
1, 1, dimy - 2, dimx - 2, nullptr, "new1", nullptr, 0, 1, 1, dimy - 2, dimx - 2, nullptr, "new1", nullptr, 0, 0, 0,
}; };
auto n1 = ncpile_create(nc_, &nopts); auto n1 = ncpile_create(nc_, &nopts);
REQUIRE(nullptr != n1); REQUIRE(nullptr != n1);
@ -175,6 +176,7 @@ TEST_CASE("Piles") {
.rows = 2, .rows = 2,
.cols = 2, .cols = 2,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto gen1 = ncplane_create(n_, &nopts); auto gen1 = ncplane_create(n_, &nopts);
REQUIRE(nullptr != gen1); REQUIRE(nullptr != gen1);
@ -223,6 +225,7 @@ TEST_CASE("Piles") {
.rows = 2, .rows = 2,
.cols = 2, .cols = 2,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto gen1 = ncplane_create(n_, &nopts); auto gen1 = ncplane_create(n_, &nopts);
REQUIRE(nullptr != gen1); REQUIRE(nullptr != gen1);

View File

@ -382,6 +382,7 @@ TEST_CASE("Plane") {
.cols = x, .cols = x,
.userptr = sentinel, .userptr = sentinel,
.name = nullptr, .resizecb = nullptr, .flags = 0, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* ncp = ncplane_create(n_, &nopts); struct ncplane* ncp = ncplane_create(n_, &nopts);
REQUIRE(ncp); REQUIRE(ncp);
@ -405,6 +406,7 @@ TEST_CASE("Plane") {
.rows = y, .rows = y,
.cols = x, .cols = x,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* ncp = ncplane_create(n_, &nopts); struct ncplane* ncp = ncplane_create(n_, &nopts);
REQUIRE(ncp); REQUIRE(ncp);
@ -430,6 +432,7 @@ TEST_CASE("Plane") {
.rows = y, .rows = y,
.cols = x, .cols = x,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* ncp = ncpile_create(nc_, &nopts); struct ncplane* ncp = ncpile_create(nc_, &nopts);
REQUIRE(ncp); REQUIRE(ncp);
@ -461,6 +464,7 @@ TEST_CASE("Plane") {
.rows = maxy, .rows = maxy,
.cols = maxx, .cols = maxx,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* newp = ncplane_create(n_, &nopts); struct ncplane* newp = ncplane_create(n_, &nopts);
REQUIRE(newp); REQUIRE(newp);
@ -507,6 +511,7 @@ TEST_CASE("Plane") {
.rows = maxy, .rows = maxy,
.cols = maxx, .cols = maxx,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* newp = ncplane_create(n_, &nopts); struct ncplane* newp = ncplane_create(n_, &nopts);
REQUIRE(newp); REQUIRE(newp);
@ -751,6 +756,7 @@ TEST_CASE("Plane") {
.rows = 2, .rows = 2,
.cols = 2, .cols = 2,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* ncp = ncplane_create(n_, &nopts); struct ncplane* ncp = ncplane_create(n_, &nopts);
REQUIRE(ncp); REQUIRE(ncp);
@ -773,6 +779,7 @@ TEST_CASE("Plane") {
.rows = 2, .rows = 2,
.cols = 2, .cols = 2,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* ncp = ncplane_create(n_, &nopts); struct ncplane* ncp = ncplane_create(n_, &nopts);
REQUIRE(ncp); REQUIRE(ncp);
@ -827,6 +834,7 @@ TEST_CASE("Plane") {
.rows = 2, .rows = 2,
.cols = 2, .cols = 2,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
REQUIRE(n); REQUIRE(n);
@ -856,6 +864,7 @@ TEST_CASE("Plane") {
.rows = 2, .rows = 2,
.cols = 2, .cols = 2,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* ndom = ncplane_create(n_, &nopts); struct ncplane* ndom = ncplane_create(n_, &nopts);
REQUIRE(ndom); REQUIRE(ndom);
@ -879,6 +888,7 @@ TEST_CASE("Plane") {
.rows = 2, .rows = 2,
.cols = 2, .cols = 2,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* ndom = ncplane_create(n_, &nopts); struct ncplane* ndom = ncplane_create(n_, &nopts);
REQUIRE(ndom); REQUIRE(ndom);
@ -904,6 +914,7 @@ TEST_CASE("Plane") {
.userptr = nullptr, .userptr = nullptr,
.name = "ndom", .name = "ndom",
.resizecb = nullptr, .flags = 0, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* ndom = ncplane_create(n_, &nopts); struct ncplane* ndom = ncplane_create(n_, &nopts);
CHECK(ncplane_pile(ndom) == ncplane_pile(n_)); CHECK(ncplane_pile(ndom) == ncplane_pile(n_));
@ -944,6 +955,7 @@ TEST_CASE("Plane") {
.rows = 2, .rows = 2,
.cols = 2, .cols = 2,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* ndom = ncplane_create(n_, &nopts); struct ncplane* ndom = ncplane_create(n_, &nopts);
REQUIRE(ndom); REQUIRE(ndom);
@ -958,6 +970,7 @@ TEST_CASE("Plane") {
.rows = 2, .rows = 2,
.cols = 2, .cols = 2,
.userptr = nullptr, .name = "new1", .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = "new1", .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto n1 = ncplane_create(n_, &nopts); auto n1 = ncplane_create(n_, &nopts);
REQUIRE(n1); REQUIRE(n1);

View File

@ -149,6 +149,7 @@ TEST_CASE("Plot") {
ncplane_options nopts = { ncplane_options nopts = {
.y = 1, .x = 1, .rows = 6, .cols = 50, .y = 1, .x = 1, .rows = 6, .cols = 50,
.userptr = nullptr, .name = "plot", .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = "plot", .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
REQUIRE(ncp); REQUIRE(ncp);
@ -180,6 +181,7 @@ TEST_CASE("Plot") {
ncplane_options nopts = { ncplane_options nopts = {
.y = 1, .x = 1, .rows = 1, .cols = 9, .y = 1, .x = 1, .rows = 1, .cols = 9,
.userptr = nullptr, .name = "plot", .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = "plot", .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
REQUIRE(ncp); REQUIRE(ncp);
@ -206,6 +208,7 @@ TEST_CASE("Plot") {
ncplane_options nopts = { ncplane_options nopts = {
.y = 1, .x = 1, .rows = 1, .cols = 9, .y = 1, .x = 1, .rows = 1, .cols = 9,
.userptr = nullptr, .name = "plot", .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = "plot", .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
REQUIRE(ncp); REQUIRE(ncp);
@ -229,6 +232,7 @@ TEST_CASE("Plot") {
ncplane_options nopts = { ncplane_options nopts = {
.y = 1, .x = 1, .rows = 1, .cols = 16, .y = 1, .x = 1, .rows = 1, .cols = 16,
.userptr = nullptr, .name = "plot", .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = "plot", .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
REQUIRE(ncp); REQUIRE(ncp);
@ -255,6 +259,7 @@ TEST_CASE("Plot") {
ncplane_options nopts = { ncplane_options nopts = {
.y = 1, .x = 1, .rows = 1, .cols = 25, .y = 1, .x = 1, .rows = 1, .cols = 25,
.userptr = nullptr, .name = "plot", .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = "plot", .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
REQUIRE(ncp); REQUIRE(ncp);

View File

@ -26,6 +26,7 @@ TEST_CASE("ProgressBar") {
.name = "pbar", .name = "pbar",
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
const char* egcs[] = { " ", "", "", "", "", "", "", "", "" }; const char* egcs[] = { " ", "", "", "", "", "", "", "", "" };
auto n = ncplane_create(n_, &nopts); auto n = ncplane_create(n_, &nopts);
@ -55,6 +56,7 @@ TEST_CASE("ProgressBar") {
.name = "pbar", .name = "pbar",
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
const char* egcs[] = { " ", "", "🮂", "🮃", "", "🮄", "🮅", "🮆", ""}; const char* egcs[] = { " ", "", "🮂", "🮃", "", "🮄", "🮅", "🮆", ""};
auto n = ncplane_create(n_, &nopts); auto n = ncplane_create(n_, &nopts);
@ -91,6 +93,7 @@ TEST_CASE("ProgressBar") {
.name = "pbar", .name = "pbar",
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
const char* egcs[] = { " ", "", "", "", "", "", "", "" }; const char* egcs[] = { " ", "", "", "", "", "", "", "" };
auto n = ncplane_create(n_, &nopts); auto n = ncplane_create(n_, &nopts);
@ -130,6 +133,7 @@ TEST_CASE("ProgressBar") {
.name = "pbar", .name = "pbar",
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
const char* egcs[] = { " ", "🮇", "🮇", "🮈", "", "🮉", "🮊", "🮋" }; const char* egcs[] = { " ", "🮇", "🮇", "🮈", "", "🮉", "🮊", "🮋" };
auto n = ncplane_create(n_, &nopts); auto n = ncplane_create(n_, &nopts);

View File

@ -23,6 +23,7 @@ TEST_CASE("Readers") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(notcurses_stdplane(nc_), &nopts); auto ncp = ncplane_create(notcurses_stdplane(nc_), &nopts);
uint64_t echannels = CHANNELS_RGB_INITIALIZER(0xff, 0x44, 0xff, 0, 0, 0); uint64_t echannels = CHANNELS_RGB_INITIALIZER(0xff, 0x44, 0xff, 0, 0, 0);

View File

@ -299,6 +299,7 @@ TEST_CASE("Reels") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
REQUIRE(nullptr != ncp); REQUIRE(nullptr != ncp);

View File

@ -29,6 +29,7 @@ TEST_CASE("Resize") {
.rows = y, .rows = y,
.cols = x, .cols = x,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* testn = ncplane_create(n_, &nopts); struct ncplane* testn = ncplane_create(n_, &nopts);
REQUIRE(nullptr != testn); REQUIRE(nullptr != testn);
@ -53,6 +54,7 @@ TEST_CASE("Resize") {
.rows = y, .rows = y,
.cols = x, .cols = x,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* testn = ncplane_create(n_, &nopts); struct ncplane* testn = ncplane_create(n_, &nopts);
REQUIRE(nullptr != testn); REQUIRE(nullptr != testn);

View File

@ -60,6 +60,7 @@ TEST_CASE("Rotate") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* testn = ncplane_create(n_, &nopts); struct ncplane* testn = ncplane_create(n_, &nopts);
uint64_t channels = 0; uint64_t channels = 0;
@ -94,6 +95,7 @@ TEST_CASE("Rotate") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* testn = ncplane_create(n_, &nopts); struct ncplane* testn = ncplane_create(n_, &nopts);
REQUIRE(0 < ncplane_gradient_sized(testn, " ", 0, ul, ur, ll, lr, 8, 16)); REQUIRE(0 < ncplane_gradient_sized(testn, " ", 0, ul, ur, ll, lr, 8, 16));
@ -112,6 +114,7 @@ TEST_CASE("Rotate") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* testn = ncplane_create(n_, &nopts); struct ncplane* testn = ncplane_create(n_, &nopts);
REQUIRE(0 < ncplane_gradient_sized(testn, " ", 0, ul, ur, ll, lr, 8, 32)); REQUIRE(0 < ncplane_gradient_sized(testn, " ", 0, ul, ur, ll, lr, 8, 32));
@ -130,6 +133,7 @@ TEST_CASE("Rotate") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* testn = ncplane_create(n_, &nopts); struct ncplane* testn = ncplane_create(n_, &nopts);
REQUIRE(0 < ncplane_gradient_sized(testn, " ", 0, ul, ur, ll, lr, 8, 16)); REQUIRE(0 < ncplane_gradient_sized(testn, " ", 0, ul, ur, ll, lr, 8, 16));
@ -148,6 +152,7 @@ TEST_CASE("Rotate") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* testn = ncplane_create(n_, &nopts); struct ncplane* testn = ncplane_create(n_, &nopts);
REQUIRE(0 < ncplane_gradient_sized(testn, " ", 0, ul, ur, ll, lr, 8, 32)); REQUIRE(0 < ncplane_gradient_sized(testn, " ", 0, ul, ur, ll, lr, 8, 32));

View File

@ -25,6 +25,7 @@ TEST_CASE("Scrolling") {
.rows = 2, .rows = 2,
.cols = 20, .cols = 20,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
REQUIRE(n); REQUIRE(n);
@ -54,6 +55,7 @@ TEST_CASE("Scrolling") {
.rows = 2, .rows = 2,
.cols = 20, .cols = 20,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
REQUIRE(n); REQUIRE(n);
@ -75,6 +77,7 @@ TEST_CASE("Scrolling") {
.rows = 2, .rows = 2,
.cols = 20, .cols = 20,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
REQUIRE(n); REQUIRE(n);
@ -102,6 +105,7 @@ TEST_CASE("Scrolling") {
.rows = 2, .rows = 2,
.cols = 20, .cols = 20,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
REQUIRE(n); REQUIRE(n);
@ -141,6 +145,7 @@ TEST_CASE("Scrolling") {
.rows = 4, .rows = 4,
.cols = 20, .cols = 20,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
REQUIRE(n); REQUIRE(n);
@ -165,6 +170,7 @@ TEST_CASE("Scrolling") {
.rows = 2, .rows = 2,
.cols = 20, .cols = 20,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
REQUIRE(n); REQUIRE(n);
@ -225,6 +231,7 @@ TEST_CASE("Scrolling") {
.rows = 2, .rows = 2,
.cols = 20, .cols = 20,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
REQUIRE(n); REQUIRE(n);

View File

@ -19,6 +19,7 @@ TEST_CASE("Selectors") {
.rows = 1, .rows = 1,
.cols = 1, .cols = 1,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
struct ncselector* ncs = ncselector_create(n, &opts); struct ncselector* ncs = ncselector_create(n, &opts);
@ -43,6 +44,7 @@ TEST_CASE("Selectors") {
.rows = 1, .rows = 1,
.cols = 1, .cols = 1,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
struct ncselector* ncs = ncselector_create(n, &opts); struct ncselector* ncs = ncselector_create(n, &opts);
@ -66,6 +68,7 @@ TEST_CASE("Selectors") {
.rows = 1, .rows = 1,
.cols = 1, .cols = 1,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
struct ncselector* ncs = ncselector_create(n, &opts); struct ncselector* ncs = ncselector_create(n, &opts);
@ -89,6 +92,7 @@ TEST_CASE("Selectors") {
.rows = 1, .rows = 1,
.cols = 1, .cols = 1,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
struct ncselector* ncs = ncselector_create(n, &opts); struct ncselector* ncs = ncselector_create(n, &opts);
@ -118,6 +122,7 @@ TEST_CASE("Selectors") {
.rows = 1, .rows = 1,
.cols = 1, .cols = 1,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
struct ncselector* ncs = ncselector_create(n, &opts); struct ncselector* ncs = ncselector_create(n, &opts);
@ -140,6 +145,7 @@ TEST_CASE("Selectors") {
.rows = 1, .rows = 1,
.cols = 1, .cols = 1,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
struct ncselector* ncs = ncselector_create(n, &opts); struct ncselector* ncs = ncselector_create(n, &opts);
@ -171,6 +177,7 @@ TEST_CASE("Selectors") {
.rows = 1, .rows = 1,
.cols = 1, .cols = 1,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
struct ncselector* ncs = ncselector_create(n, &opts); struct ncselector* ncs = ncselector_create(n, &opts);
@ -217,6 +224,7 @@ TEST_CASE("Selectors") {
.rows = 1, .rows = 1,
.cols = 1, .cols = 1,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
struct ncselector* ncs = ncselector_create(n, &opts); struct ncselector* ncs = ncselector_create(n, &opts);
@ -268,6 +276,7 @@ TEST_CASE("Selectors") {
.rows = 1, .rows = 1,
.cols = 1, .cols = 1,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
struct ncselector* ncs = ncselector_create(n, &opts); struct ncselector* ncs = ncselector_create(n, &opts);

View File

@ -29,6 +29,7 @@ TEST_CASE("Stacking") {
SUBCASE("LowerAtopUpperWhite") { SUBCASE("LowerAtopUpperWhite") {
struct ncplane_options opts = { struct ncplane_options opts = {
0, 0, 1, 1, nullptr, "top", nullptr, 0, 0, 0, 1, 1, nullptr, "top", nullptr, 0,
.margin_b = 0, .margin_r = 0,
}; };
auto top = ncplane_create(n_, &opts); auto top = ncplane_create(n_, &opts);
REQUIRE(nullptr != top); REQUIRE(nullptr != top);
@ -65,7 +66,7 @@ TEST_CASE("Stacking") {
SUBCASE("UpperAtopLowerWhite") { SUBCASE("UpperAtopLowerWhite") {
struct ncplane_options opts = { struct ncplane_options opts = {
0, 0, 1, 1, nullptr, "top", nullptr, 0, 0, 0, 1, 1, nullptr, "top", nullptr, 0, 0, 0,
}; };
auto top = ncplane_create(n_, &opts); auto top = ncplane_create(n_, &opts);
REQUIRE(nullptr != top); REQUIRE(nullptr != top);
@ -102,7 +103,7 @@ TEST_CASE("Stacking") {
SUBCASE("StackedQuadHalves") { SUBCASE("StackedQuadHalves") {
struct ncplane_options opts = { struct ncplane_options opts = {
0, 0, 1, 1, nullptr, "top", nullptr, 0, 0, 0, 1, 1, nullptr, "top", nullptr, 0, 0, 0,
}; };
auto top = ncplane_create(n_, &opts); auto top = ncplane_create(n_, &opts);
REQUIRE(nullptr != top); REQUIRE(nullptr != top);
@ -141,7 +142,7 @@ TEST_CASE("Stacking") {
ncplane_erase(n_); ncplane_erase(n_);
notcurses_refresh(nc_, nullptr, nullptr); notcurses_refresh(nc_, nullptr, nullptr);
struct ncplane_options opts = { struct ncplane_options opts = {
0, 0, 1, 1, nullptr, "top", nullptr, 0, 0, 0, 1, 1, nullptr, "top", nullptr, 0, 0, 0,
}; };
auto top = ncplane_create(n_, &opts); auto top = ncplane_create(n_, &opts);
REQUIRE(nullptr != top); REQUIRE(nullptr != top);

View File

@ -16,7 +16,8 @@ TEST_CASE("Tabbed") {
SUBCASE("CreateNullOpts") { SUBCASE("CreateNullOpts") {
struct ncplane_options nopts = { struct ncplane_options nopts = {
.y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4, .y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0 .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
REQUIRE(nullptr != ncp); REQUIRE(nullptr != ncp);
@ -39,7 +40,8 @@ TEST_CASE("Tabbed") {
}; };
struct ncplane_options nopts = { struct ncplane_options nopts = {
.y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4, .y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0 .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
auto nt = nctabbed_create(ncp, &opts); auto nt = nctabbed_create(ncp, &opts);
@ -54,7 +56,8 @@ TEST_CASE("Tabbed") {
SUBCASE("Add") { SUBCASE("Add") {
struct ncplane_options nopts = { struct ncplane_options nopts = {
.y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4, .y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0 .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
auto nt = nctabbed_create(ncp, nullptr); auto nt = nctabbed_create(ncp, nullptr);
@ -108,7 +111,8 @@ TEST_CASE("Tabbed") {
SUBCASE("Del") { SUBCASE("Del") {
struct ncplane_options nopts = { struct ncplane_options nopts = {
.y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4, .y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0 .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
auto nt = nctabbed_create(ncp, nullptr); auto nt = nctabbed_create(ncp, nullptr);
@ -154,7 +158,8 @@ TEST_CASE("Tabbed") {
SUBCASE("Move") { SUBCASE("Move") {
struct ncplane_options nopts = { struct ncplane_options nopts = {
.y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4, .y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0 .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
auto nt = nctabbed_create(ncp, nullptr); auto nt = nctabbed_create(ncp, nullptr);
@ -207,7 +212,8 @@ TEST_CASE("Tabbed") {
SUBCASE("Rotate") { SUBCASE("Rotate") {
struct ncplane_options nopts = { struct ncplane_options nopts = {
.y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4, .y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0 .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
auto nt = nctabbed_create(ncp, nullptr); auto nt = nctabbed_create(ncp, nullptr);
@ -240,7 +246,8 @@ TEST_CASE("Tabbed") {
SUBCASE("MoveLeftRight") { SUBCASE("MoveLeftRight") {
struct ncplane_options nopts = { struct ncplane_options nopts = {
.y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4, .y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0 .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
auto nt = nctabbed_create(ncp, nullptr); auto nt = nctabbed_create(ncp, nullptr);
@ -305,7 +312,8 @@ TEST_CASE("Tabbed") {
SUBCASE("Select") { SUBCASE("Select") {
struct ncplane_options nopts = { struct ncplane_options nopts = {
.y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4, .y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0 .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
auto nt = nctabbed_create(ncp, nullptr); auto nt = nctabbed_create(ncp, nullptr);
@ -332,7 +340,8 @@ TEST_CASE("Tabbed") {
SUBCASE("NextPrev") { SUBCASE("NextPrev") {
struct ncplane_options nopts = { struct ncplane_options nopts = {
.y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4, .y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0 .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
auto nt = nctabbed_create(ncp, nullptr); auto nt = nctabbed_create(ncp, nullptr);
@ -364,7 +373,8 @@ TEST_CASE("Tabbed") {
SUBCASE("Setters") { SUBCASE("Setters") {
struct ncplane_options nopts = { struct ncplane_options nopts = {
.y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4, .y = 1, .x = 2, .rows = ncplane_dim_y(n_) - 2, .cols = ncplane_dim_x(n_) - 4,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0 .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto ncp = ncplane_create(n_, &nopts); auto ncp = ncplane_create(n_, &nopts);
auto nt = nctabbed_create(ncp, nullptr); auto nt = nctabbed_create(ncp, nullptr);

View File

@ -103,6 +103,7 @@ TEST_CASE("Tree") {
const ncplane_options nopts = { const ncplane_options nopts = {
.y = 0, .x = 0, .rows = 3, .cols = ncplane_dim_y(n_), .y = 0, .x = 0, .rows = 3, .cols = ncplane_dim_y(n_),
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto treen = ncplane_create(n_, &nopts); auto treen = ncplane_create(n_, &nopts);
REQUIRE(nullptr != treen); REQUIRE(nullptr != treen);
@ -125,6 +126,7 @@ TEST_CASE("Tree") {
const ncplane_options nopts = { const ncplane_options nopts = {
.y = 0, .x = 0, .rows = 3, .cols = ncplane_dim_y(n_), .y = 0, .x = 0, .rows = 3, .cols = ncplane_dim_y(n_),
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto treen = ncplane_create(n_, &nopts); auto treen = ncplane_create(n_, &nopts);
REQUIRE(nullptr != treen); REQUIRE(nullptr != treen);

View File

@ -230,6 +230,7 @@ TEST_CASE("Wide") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* ncp = ncplane_create(n_, &nopts); struct ncplane* ncp = ncplane_create(n_, &nopts);
REQUIRE(ncp); REQUIRE(ncp);
@ -357,6 +358,7 @@ TEST_CASE("Wide") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n = ncplane_create(n_, &nopts); struct ncplane* n = ncplane_create(n_, &nopts);
REQUIRE(n); REQUIRE(n);
@ -404,6 +406,7 @@ TEST_CASE("Wide") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* p = ncplane_create(n_, &nopts); struct ncplane* p = ncplane_create(n_, &nopts);
REQUIRE(nullptr != p); REQUIRE(nullptr != p);
@ -453,6 +456,7 @@ TEST_CASE("Wide") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* topp = ncplane_create(n_, &nopts); struct ncplane* topp = ncplane_create(n_, &nopts);
REQUIRE(nullptr != topp); REQUIRE(nullptr != topp);
@ -607,6 +611,7 @@ TEST_CASE("Wide") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* topp = ncplane_create(n_, &nopts); struct ncplane* topp = ncplane_create(n_, &nopts);
REQUIRE(nullptr != topp); REQUIRE(nullptr != topp);
@ -762,6 +767,7 @@ TEST_CASE("Wide") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* topp = ncplane_create(n_, &nopts); struct ncplane* topp = ncplane_create(n_, &nopts);
REQUIRE(nullptr != topp); REQUIRE(nullptr != topp);
@ -956,6 +962,7 @@ TEST_CASE("Wide") {
.name = nullptr, .name = nullptr,
.resizecb = nullptr, .resizecb = nullptr,
.flags = 0, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto high = ncplane_create(n_, &nopts); auto high = ncplane_create(n_, &nopts);
REQUIRE(nullptr != high); REQUIRE(nullptr != high);

View File

@ -32,6 +32,7 @@ TEST_CASE("ZAxis") {
.rows = 2, .rows = 2,
.cols = 2, .cols = 2,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* np = ncplane_create(n_, &nopts); struct ncplane* np = ncplane_create(n_, &nopts);
REQUIRE(np); REQUIRE(np);
@ -49,6 +50,7 @@ TEST_CASE("ZAxis") {
.rows = 2, .rows = 2,
.cols = 2, .cols = 2,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* np = ncplane_create(n_, &nopts); struct ncplane* np = ncplane_create(n_, &nopts);
REQUIRE(np); REQUIRE(np);
@ -66,6 +68,7 @@ TEST_CASE("ZAxis") {
.rows = 2, .rows = 2,
.cols = 2, .cols = 2,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* np = ncplane_create(n_, &nopts); struct ncplane* np = ncplane_create(n_, &nopts);
REQUIRE(np); REQUIRE(np);
@ -89,6 +92,7 @@ TEST_CASE("ZAxis") {
.rows = 2, .rows = 2,
.cols = 2, .cols = 2,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* np = ncplane_create(n_, &nopts); struct ncplane* np = ncplane_create(n_, &nopts);
REQUIRE(np); REQUIRE(np);
@ -121,6 +125,7 @@ TEST_CASE("ZAxis") {
.rows = 2, .rows = 2,
.cols = 2, .cols = 2,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
struct ncplane* n2 = ncplane_create(n_, &nopts); struct ncplane* n2 = ncplane_create(n_, &nopts);
REQUIRE(1 == cell_load(n2, &c, "y")); REQUIRE(1 == cell_load(n2, &c, "y"));
@ -152,6 +157,7 @@ TEST_CASE("ZAxis") {
.rows = 1, .rows = 1,
.cols = 1, .cols = 1,
.userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0, .userptr = nullptr, .name = nullptr, .resizecb = nullptr, .flags = 0,
.margin_b = 0, .margin_r = 0,
}; };
auto p = ncplane_create(n_, &nopts); auto p = ncplane_create(n_, &nopts);
REQUIRE(nullptr != p); REQUIRE(nullptr != p);