From 9fe6c152a9207142fa737f99a66a6477a4e6b0bb Mon Sep 17 00:00:00 2001 From: nick black Date: Fri, 29 Nov 2019 05:37:41 -0500 Subject: [PATCH] enhance SetStyles unit test --- src/lib/notcurses.c | 6 +++--- tests/cell.cpp | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index b3ea1a6fa..a7893306f 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -834,13 +834,13 @@ term_putc(FILE* out, const ncplane* n, const cell* c){ static void advance_cursor(ncplane* n, int cols){ - if(n->y == n->leny){ - if(n->x == n->lenx){ + if(n->y >= n->leny){ + if(n->x >= n->lenx){ return; // stuck! } } if((n->x += cols) >= n->lenx){ - if(n->y == n->leny){ + if(n->y >= n->leny){ n->x = n->lenx; }else{ n->x -= n->lenx; diff --git a/tests/cell.cpp b/tests/cell.cpp index f99652bf7..9f4c38587 100644 --- a/tests/cell.cpp +++ b/tests/cell.cpp @@ -50,6 +50,17 @@ TEST_F(CellTest, SetStyles) { } } EXPECT_EQ(0, notcurses_render(nc_)); + cell_styles_off(&c, CELL_STYLE_ITALIC); + for(y = 0 ; y < dimy ; ++y){ + ncplane_cursor_move_yx(n_, y, 0); + for(x = 0 ; x < dimx ; ++x){ + EXPECT_EQ(1, ncplane_putc(n_, &c)); + } + } + ncplane_cursor_yx(n_, &y, &x); + EXPECT_EQ(dimy, y); + EXPECT_EQ(0, x); // FIXME shouldn't this be dimx?!?! + EXPECT_EQ(0, notcurses_render(nc_)); } /*TEST_F(CellTest, CellLoadTamil) {