diff --git a/include/notcurses.h b/include/notcurses.h index 859a8f311..543d400dc 100644 --- a/include/notcurses.h +++ b/include/notcurses.h @@ -331,9 +331,31 @@ API int ncplane_vline(struct ncplane* n, const cell* c, int len); // Draw a box with its upper-left corner at the current cursor position, and its // lower-right corner at 'ystop'x'xstop'. The 6 cells provided are used to draw the // upper-left, ur, ll, and lr corners, then the horizontal and vertical lines. +// 'ctlword' is defined in the least significant byte, where bits [7, 4] are a +// gradient mask, and [3, 0] are a border mask: +// * 7, 3: top +// * 6, 2: right +// * 5, 1: bottom +// * 4, 0: left +// if the gradient bit is not set, the styling from the hl/vl cells is used for +// the horizontal and vertical lines, respectively. if the gradient bit is set, +// the color is linearly interpolated between the two relevant corner cells. if +// the bordermask bit is set, that side of the box is not drawn. iff either edge +// connecting to a corner is drawn, the corner is drawn. + +#define NCBOXMASK_TOP 0x01 +#define NCBOXMASK_RIGHT 0x02 +#define NCBOXMASK_BOTTOM 0x04 +#define NCBOXMASK_LEFT 0x08 +#define NCBOXGRAD_TOP 0x10 +#define NCBOXGRAD_RIGHT 0x20 +#define NCBOXGRAD_BOTTOM 0x40 +#define NCBOXGRAD_LEFT 0x80 + API int ncplane_box(struct ncplane* n, const cell* ul, const cell* ur, const cell* ll, const cell* lr, const cell* hline, - const cell* vline, int ystop, int xstop); + const cell* vline, int ystop, int xstop, + unsigned ctlword); // Draw a box with its upper-left corner at the current cursor position, having // dimensions 'ylen'x'xlen'. See ncplane_box() for more information. The @@ -341,10 +363,11 @@ API int ncplane_box(struct ncplane* n, const cell* ul, const cell* ur, static inline int ncplane_box_sized(struct ncplane* n, const cell* ul, const cell* ur, const cell* ll, const cell* lr, const cell* hline, - const cell* vline, int ylen, int xlen){ + const cell* vline, int ylen, int xlen, unsigned ctlword){ int y, x; ncplane_cursor_yx(n, &y, &x); - return ncplane_box(n, ul, ur, ll, lr, hline, vline, y + ylen - 1, x + xlen - 1); + return ncplane_box(n, ul, ur, ll, lr, hline, vline, y + ylen - 1, + x + xlen - 1, ctlword); } // Erase every cell in the ncplane, resetting all attributes to normal, all @@ -663,13 +686,13 @@ cells_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels, static inline int ncplane_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels, - int ystop, int xstop){ + int ystop, int xstop, unsigned ctlword){ int ret = 0; cell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER; cell ll = CELL_TRIVIAL_INITIALIZER, lr = CELL_TRIVIAL_INITIALIZER; cell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER; if((ret = cells_rounded_box(n, attr, channels, &ul, &ur, &ll, &lr, &hl, &vl)) == 0){ - ret = ncplane_box(n, &ul, &ur, &ll, &lr, &hl, &vl, ystop, xstop); + ret = ncplane_box(n, &ul, &ur, &ll, &lr, &hl, &vl, ystop, xstop, ctlword); } cell_release(n, &ul); cell_release(n, &ur); @@ -682,10 +705,11 @@ ncplane_rounded_box(struct ncplane* n, uint32_t attr, uint64_t channels, static inline int ncplane_rounded_box_sized(struct ncplane* n, uint32_t attr, uint64_t channels, - int ylen, int xlen){ + int ylen, int xlen, unsigned ctlword){ int y, x; ncplane_cursor_yx(n, &y, &x); - return ncplane_rounded_box(n, attr, channels, y + ylen - 1, x + xlen - 1); + return ncplane_rounded_box(n, attr, channels, y + ylen - 1, + x + xlen - 1, ctlword); } static inline int @@ -696,13 +720,13 @@ cells_double_box(struct ncplane* n, uint32_t attr, uint64_t channels, static inline int ncplane_double_box(struct ncplane* n, uint32_t attr, uint64_t channels, - int ystop, int xstop){ + int ystop, int xstop, unsigned ctlword){ int ret = 0; cell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER; cell ll = CELL_TRIVIAL_INITIALIZER, lr = CELL_TRIVIAL_INITIALIZER; cell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER; if((ret = cells_double_box(n, attr, channels, &ul, &ur, &ll, &lr, &hl, &vl)) == 0){ - ret = ncplane_box(n, &ul, &ur, &ll, &lr, &hl, &vl, ystop, xstop); + ret = ncplane_box(n, &ul, &ur, &ll, &lr, &hl, &vl, ystop, xstop, ctlword); } cell_release(n, &ul); cell_release(n, &ur); @@ -715,10 +739,11 @@ ncplane_double_box(struct ncplane* n, uint32_t attr, uint64_t channels, static inline int ncplane_double_box_sized(struct ncplane* n, uint32_t attr, uint64_t channels, - int ylen, int xlen){ + int ylen, int xlen, unsigned ctlword){ int y, x; ncplane_cursor_yx(n, &y, &x); - return ncplane_double_box(n, attr, channels, y + ylen - 1, x + xlen - 1); + return ncplane_double_box(n, attr, channels, y + ylen - 1, + x + xlen - 1, ctlword); } // multimedia functionality @@ -757,13 +782,6 @@ API int ncvisual_stream(struct notcurses* nc, struct ncvisual* ncv, int* averr); // This structure is amenable to line- and page-based navigation via keystrokes, // scrolling gestures, trackballs, scrollwheels, touchpads, and verbal commands. -enum bordermaskbits { - BORDERMASK_TOP = 0x1, - BORDERMASK_RIGHT = 0x2, - BORDERMASK_BOTTOM = 0x4, - BORDERMASK_LEFT = 0x8, -}; - typedef struct panelreel_options { // require this many rows and columns (including borders). otherwise, a // message will be displayed stating that a larger terminal is necessary, and diff --git a/src/demo/boxdemo.c b/src/demo/boxdemo.c index b0ea4e40d..3f92d740b 100644 --- a/src/demo/boxdemo.c +++ b/src/demo/boxdemo.c @@ -32,7 +32,7 @@ int box_demo(struct notcurses* nc){ if(ncplane_cursor_move_yx(n, y, x)){ return -1; } - if(ncplane_box_sized(n, &ul, &ur, &ll, &lr, &hl, &vl, ylen, xlen)){ + if(ncplane_box_sized(n, &ul, &ur, &ll, &lr, &hl, &vl, ylen, xlen, 0)){ return -1; } ylen -= 2; diff --git a/src/demo/demo.c b/src/demo/demo.c index 439a61309..bd1f63171 100644 --- a/src/demo/demo.c +++ b/src/demo/demo.c @@ -142,7 +142,7 @@ intro(struct notcurses* nc){ if(ncplane_cursor_move_yx(ncp, 4, 4)){ return -1; } - if(ncplane_rounded_box(ncp, 0, channels, rows - 6, cols - 6)){ + if(ncplane_rounded_box(ncp, 0, channels, rows - 6, cols - 6, 0)){ return -1; } const char s1[] = " Die Welt ist alles, was der Fall ist. "; diff --git a/src/demo/maxcolor.c b/src/demo/maxcolor.c index 74122b406..0a7593d97 100644 --- a/src/demo/maxcolor.c +++ b/src/demo/maxcolor.c @@ -38,7 +38,7 @@ int maxcolor_demo(struct notcurses* nc){ notcurses_bg_prep(&channels, 90, 0, 90); int y = 0, x = 0; ncplane_cursor_move_yx(n, y, x); - if(ncplane_rounded_box_sized(n, 0, channels, maxy, maxx)){ + if(ncplane_rounded_box_sized(n, 0, channels, maxy, maxx, 0)){ return -1; } uint32_t rgb = 0; diff --git a/src/demo/sliding.c b/src/demo/sliding.c index 840f7a576..230e73a53 100644 --- a/src/demo/sliding.c +++ b/src/demo/sliding.c @@ -102,7 +102,7 @@ fill_chunk(struct ncplane* n, int idx){ uint64_t channels = 0; int r = random() % 256, g = random() % 256, b = random() % 256; notcurses_fg_prep(&channels, r, g, b); - if(ncplane_double_box(n, 0, channels, maxy - 1, maxx - 1)){ + if(ncplane_double_box(n, 0, channels, maxy - 1, maxx - 1, 0)){ return -1; } if(maxx >= 5 && maxy >= 3){ @@ -131,7 +131,7 @@ draw_bounding_box(struct ncplane* n, int yoff, int xoff, int chunky, int chunkx) ncplane_cursor_move_yx(n, yoff, xoff); ret = ncplane_rounded_box(n, 0, channels, CHUNKS_VERT * chunky + yoff + 1, - CHUNKS_HORZ * chunkx + xoff + 1); + CHUNKS_HORZ * chunkx + xoff + 1, 0); return ret; } diff --git a/src/demo/unicodeblocks.c b/src/demo/unicodeblocks.c index 5e1e4a15e..769a27966 100644 --- a/src/demo/unicodeblocks.c +++ b/src/demo/unicodeblocks.c @@ -109,7 +109,7 @@ int unicodeblocks_demo(struct notcurses* nc){ return -1; } ++xstart; - if(ncplane_rounded_box_sized(n, 0, 0, BLOCKSIZE / CHUNKSIZE + 2, (CHUNKSIZE * 2) + 2)){ + if(ncplane_rounded_box_sized(n, 0, 0, BLOCKSIZE / CHUNKSIZE + 2, (CHUNKSIZE * 2) + 2, 0)){ return -1; } for(chunk = 0 ; chunk < BLOCKSIZE / CHUNKSIZE ; ++chunk){ diff --git a/src/demo/widecolor.c b/src/demo/widecolor.c index 55ec8633e..dea6c348d 100644 --- a/src/demo/widecolor.c +++ b/src/demo/widecolor.c @@ -13,7 +13,7 @@ message(struct ncplane* n, int maxy, int maxx, int num, int total){ ncplane_fg_rgb8(n, 0, 0, 0); ncplane_bg_rgb8(n, 255, 255, 255); ncplane_styles_on(n, CELL_STYLE_BOLD); - if(ncplane_rounded_box(n, 0, 0, 5, 57)){ + if(ncplane_rounded_box(n, 0, 0, 5, 57, 0)){ return -1; } ncplane_cursor_move_yx(n, 3, 4); diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 75b24112c..35f4b5bcd 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -1436,7 +1436,8 @@ int ncplane_vline(ncplane* n, const cell* c, int len){ int ncplane_box(ncplane* n, const cell* ul, const cell* ur, const cell* ll, const cell* lr, const cell* hl, - const cell* vl, int ystop, int xstop){ + const cell* vl, int ystop, int xstop, + unsigned ctlword){ int yoff, xoff, ymax, xmax; ncplane_cursor_yx(n, &yoff, &xoff); if(ystop < yoff + 1){ diff --git a/src/lib/panelreel.c b/src/lib/panelreel.c index 7155786f7..1226e23d7 100644 --- a/src/lib/panelreel.c +++ b/src/lib/panelreel.c @@ -81,17 +81,17 @@ draw_borders(ncplane* w, unsigned nobordermask, const cell* attr, if(!cliphead){ // lenx - begx + 1 is the number of columns we have, but drop 2 due to // corners. we thus want lenx - begx - 1 horizontal lines. - if(!(nobordermask & BORDERMASK_TOP)){ + if(!(nobordermask & NCBOXMASK_TOP)){ ret |= ncplane_cursor_move_yx(w, begy, begx); ncplane_putc(w, &ul); ncplane_hline(w, &hl, lenx - 2); ncplane_putc(w, &ur); }else{ - if(!(nobordermask & BORDERMASK_LEFT)){ + if(!(nobordermask & NCBOXMASK_LEFT)){ ret |= ncplane_cursor_move_yx(w, begy, begx); ncplane_putc(w, &ul); } - if(!(nobordermask & BORDERMASK_RIGHT)){ + if(!(nobordermask & NCBOXMASK_RIGHT)){ ret |= ncplane_cursor_move_yx(w, begy, maxx); ncplane_putc(w, &ur); } @@ -99,27 +99,27 @@ draw_borders(ncplane* w, unsigned nobordermask, const cell* attr, } int y; for(y = begy + !cliphead ; y < maxy + !!clipfoot ; ++y){ - if(!(nobordermask & BORDERMASK_LEFT)){ + if(!(nobordermask & NCBOXMASK_LEFT)){ ret |= ncplane_cursor_move_yx(w, y, begx); ncplane_putc(w, &vl); } - if(!(nobordermask & BORDERMASK_RIGHT)){ + if(!(nobordermask & NCBOXMASK_RIGHT)){ ret |= ncplane_cursor_move_yx(w, y, maxx); ncplane_putc(w, &vl); } } if(!clipfoot){ - if(!(nobordermask & BORDERMASK_BOTTOM)){ + if(!(nobordermask & NCBOXMASK_BOTTOM)){ ret |= ncplane_cursor_move_yx(w, maxy, begx); ncplane_putc(w, &ll); ncplane_hline(w, &hl, lenx - 2); ncplane_putc(w, &lr); }else{ - if(!(nobordermask & BORDERMASK_LEFT)){ + if(!(nobordermask & NCBOXMASK_LEFT)){ ret |= ncplane_cursor_move_yx(w, maxy, begx); ret |= ncplane_putc(w, &ll); } - if(!(nobordermask & BORDERMASK_RIGHT)){ + if(!(nobordermask & NCBOXMASK_RIGHT)){ // mvwadd_wch returns error if we print to the lowermost+rightmost // character cell. maybe we can make this go away with scrolling controls // at setup? until then, don't check for error here FIXME. @@ -164,9 +164,9 @@ tablet_columns(const panelreel* pr, int* begx, int* begy, int* lenx, int* leny, int frontiery, int direction){ window_coordinates(pr->p, begy, begx, leny, lenx); int maxy = *leny + *begy - 1; - int begindraw = *begy + !(pr->popts.bordermask & BORDERMASK_TOP); + int begindraw = *begy + !(pr->popts.bordermask & NCBOXMASK_TOP); // FIXME i think this fails to account for an absent panelreel bottom? - int enddraw = maxy - !(pr->popts.bordermask & BORDERMASK_TOP); + int enddraw = maxy - !(pr->popts.bordermask & NCBOXMASK_TOP); if(direction){ if(frontiery < begindraw){ return -1; @@ -177,18 +177,18 @@ tablet_columns(const panelreel* pr, int* begx, int* begy, int* lenx, int* leny, } } // account for the panelreel borders - if(direction <= 0 && !(pr->popts.bordermask & BORDERMASK_TOP)){ + if(direction <= 0 && !(pr->popts.bordermask & NCBOXMASK_TOP)){ ++*begy; --*leny; } - if(direction >= 0 && !(pr->popts.bordermask & BORDERMASK_BOTTOM)){ + if(direction >= 0 && !(pr->popts.bordermask & NCBOXMASK_BOTTOM)){ --*leny; } - if(!(pr->popts.bordermask & BORDERMASK_LEFT)){ + if(!(pr->popts.bordermask & NCBOXMASK_LEFT)){ ++*begx; --*lenx; } - if(!(pr->popts.bordermask & BORDERMASK_RIGHT)){ + if(!(pr->popts.bordermask & NCBOXMASK_RIGHT)){ --*lenx; } // at this point, our coordinates describe the largest possible tablet for @@ -265,16 +265,16 @@ panelreel_draw_tablet(const panelreel* pr, tablet* t, int frontiery, --cbmaxy; --cbmaxx; // If we're drawing up, we'll always have a bottom border unless it's masked - if(direction < 0 && !(pr->popts.tabletmask & BORDERMASK_BOTTOM)){ + if(direction < 0 && !(pr->popts.tabletmask & NCBOXMASK_BOTTOM)){ --cbmaxy; } // If we're drawing down, we'll always have a top border unless it's masked - if(direction >= 0 && !(pr->popts.tabletmask & BORDERMASK_TOP)){ + if(direction >= 0 && !(pr->popts.tabletmask & NCBOXMASK_TOP)){ ++cby; } // Adjust the x-bounds for side borders, which we always have if unmasked - cbmaxx -= !(pr->popts.tabletmask & BORDERMASK_RIGHT); - cbx += !(pr->popts.tabletmask & BORDERMASK_LEFT); + cbmaxx -= !(pr->popts.tabletmask & NCBOXMASK_RIGHT); + cbx += !(pr->popts.tabletmask & NCBOXMASK_LEFT); bool cbdir = direction < 0 ? true : false; // fprintf(stderr, "calling! lenx/leny: %d/%d cbx/cby: %d/%d cbmaxx/cbmaxy: %d/%d dir: %d\n", // lenx, leny, cbx, cby, cbmaxx, cbmaxy, direction); @@ -331,9 +331,9 @@ draw_focused_tablet(const panelreel* pr){ int fulcrum; if(pr->tablets->p == NULL){ if(pr->last_traveled_direction >= 0){ - fulcrum = pleny + pbegy - !(pr->popts.bordermask & BORDERMASK_BOTTOM); + fulcrum = pleny + pbegy - !(pr->popts.bordermask & NCBOXMASK_BOTTOM); }else{ - fulcrum = pbegy + !(pr->popts.bordermask & BORDERMASK_TOP); + fulcrum = pbegy + !(pr->popts.bordermask & NCBOXMASK_TOP); } }else{ // focused was already present. want to stay where we are, if possible int dontcarex; @@ -344,7 +344,7 @@ draw_focused_tablet(const panelreel* pr){ int prevfulcrum; ncplane_yx(pr->tablets->prev->p, &prevfulcrum, &dontcarex); if(fulcrum < prevfulcrum){ - fulcrum = pleny + pbegy - !(pr->popts.bordermask & BORDERMASK_BOTTOM); + fulcrum = pleny + pbegy - !(pr->popts.bordermask & NCBOXMASK_BOTTOM); } } }else if(pr->last_traveled_direction < 0){ @@ -352,7 +352,7 @@ draw_focused_tablet(const panelreel* pr){ int nextfulcrum; ncplane_yx(pr->tablets->next->p, &nextfulcrum, &dontcarex); if(fulcrum > nextfulcrum){ - fulcrum = pbegy + !(pr->popts.bordermask & BORDERMASK_TOP); + fulcrum = pbegy + !(pr->popts.bordermask & NCBOXMASK_TOP); } } } @@ -452,7 +452,7 @@ panelreel_arrange_denormalized(panelreel* pr){ tablet* topmost = find_topmost(pr); int wbegy, wbegx, wleny, wlenx; window_coordinates(pr->p, &wbegy, &wbegx, &wleny, &wlenx); - int frontiery = wbegy + !(pr->popts.bordermask & BORDERMASK_TOP); + int frontiery = wbegy + !(pr->popts.bordermask & NCBOXMASK_TOP); if(pr->last_traveled_direction >= 0){ ncplane_yx(pr->tablets->prev->p, &fromline, NULL); if(fromline > nowline){ // keep the order we had @@ -538,10 +538,10 @@ validate_panelreel_opts(ncplane* w, const panelreel_options* popts){ return false; // can't set circular without infinitescroll } } - const unsigned fullmask = BORDERMASK_LEFT | - BORDERMASK_RIGHT | - BORDERMASK_TOP | - BORDERMASK_BOTTOM; + const unsigned fullmask = NCBOXMASK_LEFT | + NCBOXMASK_RIGHT | + NCBOXMASK_TOP | + NCBOXMASK_BOTTOM; if(popts->bordermask > fullmask){ return false; } @@ -617,7 +617,7 @@ insert_new_panel(struct notcurses* nc, panelreel* pr, tablet* t){ // are we the only tablet? int begx, begy, lenx, leny, frontiery; if(t->prev == t){ - frontiery = wbegy + !(pr->popts.bordermask & BORDERMASK_TOP); + frontiery = wbegy + !(pr->popts.bordermask & NCBOXMASK_TOP); if(tablet_columns(pr, &begx, &begy, &lenx, &leny, frontiery, 1)){ pr->all_visible = false; return t; diff --git a/tests/ncplane.cpp b/tests/ncplane.cpp index 84f6ea7fb..c735cd721 100644 --- a/tests/ncplane.cpp +++ b/tests/ncplane.cpp @@ -176,17 +176,17 @@ TEST_F(NcplaneTest, BadlyPlacedBoxen) { ASSERT_LT(2, x); cell ul{}, ll{}, lr{}, ur{}, hl{}, vl{}; ASSERT_EQ(0, cells_rounded_box(n_, 0, 0, &ul, &ur, &ll, &lr, &hl, &vl)); - EXPECT_GT(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, y + 1, x + 1)); + EXPECT_GT(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, y + 1, x + 1, 0)); EXPECT_EQ(0, ncplane_cursor_move_yx(n_, 1, 0)); - EXPECT_GT(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, y, x)); + EXPECT_GT(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, y, x, 0)); EXPECT_EQ(0, ncplane_cursor_move_yx(n_, 0, 1)); - EXPECT_GT(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, y, x)); + EXPECT_GT(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, y, x, 0)); EXPECT_EQ(0, ncplane_cursor_move_yx(n_, y - 1, x - 1)); - EXPECT_GT(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, 2, 2)); + EXPECT_GT(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, 2, 2, 0)); EXPECT_EQ(0, ncplane_cursor_move_yx(n_, y - 2, x - 1)); - EXPECT_GT(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, 2, 2)); + EXPECT_GT(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, 2, 2, 0)); EXPECT_EQ(0, ncplane_cursor_move_yx(n_, y - 1, x - 2)); - EXPECT_GT(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, 2, 2)); + EXPECT_GT(0, ncplane_box(n_, &ul, &ur, &ll, &lr, &hl, &vl, 2, 2, 0)); EXPECT_EQ(0, notcurses_render(nc_)); } @@ -196,7 +196,7 @@ TEST_F(NcplaneTest, PerimeterRoundedBox) { ASSERT_LT(2, y); ASSERT_LT(2, x); ASSERT_EQ(0, ncplane_cursor_move_yx(n_, 0, 0)); - EXPECT_EQ(0, ncplane_rounded_box(n_, 0, 0, y - 1, x - 1)); + EXPECT_EQ(0, ncplane_rounded_box(n_, 0, 0, y - 1, x - 1, 0)); EXPECT_EQ(0, notcurses_render(nc_)); } @@ -206,7 +206,7 @@ TEST_F(NcplaneTest, PerimeterRoundedBoxSized) { ASSERT_LT(2, y); ASSERT_LT(2, x); ASSERT_EQ(0, ncplane_cursor_move_yx(n_, 0, 0)); - EXPECT_EQ(0, ncplane_rounded_box_sized(n_, 0, 0, y, x)); + EXPECT_EQ(0, ncplane_rounded_box_sized(n_, 0, 0, y, x, 0)); EXPECT_EQ(0, notcurses_render(nc_)); } @@ -216,7 +216,7 @@ TEST_F(NcplaneTest, PerimeterDoubleBox) { ASSERT_LT(2, y); ASSERT_LT(2, x); ASSERT_EQ(0, ncplane_cursor_move_yx(n_, 0, 0)); - EXPECT_EQ(0, ncplane_double_box(n_, 0, 0, y - 1, x - 1)); + EXPECT_EQ(0, ncplane_double_box(n_, 0, 0, y - 1, x - 1, 0)); EXPECT_EQ(0, notcurses_render(nc_)); } @@ -226,7 +226,7 @@ TEST_F(NcplaneTest, PerimeterDoubleBoxSized) { ASSERT_LT(2, y); ASSERT_LT(2, x); ASSERT_EQ(0, ncplane_cursor_move_yx(n_, 0, 0)); - EXPECT_EQ(0, ncplane_double_box_sized(n_, 0, 0, y, x)); + EXPECT_EQ(0, ncplane_double_box_sized(n_, 0, 0, y, x, 0)); EXPECT_EQ(0, notcurses_render(nc_)); } diff --git a/tests/panelreel.cpp b/tests/panelreel.cpp index 5294536d4..028ab088c 100644 --- a/tests/panelreel.cpp +++ b/tests/panelreel.cpp @@ -126,30 +126,30 @@ TEST_F(PanelReelTest, DeleteActiveTablet) { TEST_F(PanelReelTest, NoBorder) { panelreel_options p{}; - p.bordermask = BORDERMASK_LEFT | BORDERMASK_RIGHT | - BORDERMASK_TOP | BORDERMASK_BOTTOM; + p.bordermask = NCBOXMASK_LEFT | NCBOXMASK_RIGHT | + NCBOXMASK_TOP | NCBOXMASK_BOTTOM; struct panelreel* pr = panelreel_create(n_, &p, -1); ASSERT_NE(nullptr, pr); } TEST_F(PanelReelTest, BadBorderBitsRejected) { panelreel_options p{}; - p.bordermask = BORDERMASK_LEFT * 2; + p.bordermask = NCBOXMASK_LEFT * 2; struct panelreel* pr = panelreel_create(n_, &p, -1); ASSERT_EQ(nullptr, pr); } TEST_F(PanelReelTest, NoTabletBorder) { panelreel_options p{}; - p.tabletmask = BORDERMASK_LEFT | BORDERMASK_RIGHT | - BORDERMASK_TOP | BORDERMASK_BOTTOM; + p.tabletmask = NCBOXMASK_LEFT | NCBOXMASK_RIGHT | + NCBOXMASK_TOP | NCBOXMASK_BOTTOM; struct panelreel* pr = panelreel_create(n_, &p, -1); ASSERT_NE(nullptr, pr); } TEST_F(PanelReelTest, BadTabletBorderBitsRejected) { panelreel_options p{}; - p.tabletmask = BORDERMASK_LEFT * 2; + p.tabletmask = NCBOXMASK_LEFT * 2; struct panelreel* pr = panelreel_create(n_, &p, -1); ASSERT_EQ(nullptr, pr); } @@ -201,8 +201,8 @@ TEST_F(PanelReelTest, SubwinNoPanelreelBorders) { p.roff = 1; p.toff = 1; p.boff = 1; - p.bordermask = BORDERMASK_LEFT | BORDERMASK_RIGHT | - BORDERMASK_TOP | BORDERMASK_BOTTOM; + p.bordermask = NCBOXMASK_LEFT | NCBOXMASK_RIGHT | + NCBOXMASK_TOP | NCBOXMASK_BOTTOM; EXPECT_EQ(0, clear()); PANEL* base = make_targwin(n_); ASSERT_NE(nullptr, base);