mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
unit tests for ncplane_moverel()
This commit is contained in:
parent
cd80b70594
commit
0941efbea5
@ -1001,6 +1001,45 @@ TEST_CASE("Plane") {
|
||||
}while(c != 127);
|
||||
}
|
||||
|
||||
// relative moves
|
||||
SUBCASE("RelativePlaneMoves") {
|
||||
struct ncplane_options nopts{};
|
||||
nopts.x = 2;
|
||||
nopts .y = 2;
|
||||
nopts.rows = 4;
|
||||
nopts.cols = 4;
|
||||
auto n = ncplane_create(n_, &nopts);
|
||||
REQUIRE(nullptr != n);
|
||||
uint64_t channels = CHANNELS_RGB_INITIALIZER(0, 0xff, 0, 0xff, 0, 0xff);
|
||||
int y, x;
|
||||
ncplane_yx(n, &y, &x);
|
||||
CHECK(y == 2);
|
||||
CHECK(x == 2);
|
||||
CHECK(1 == ncplane_set_base(n, " ", 0, channels));
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
CHECK(0 == ncplane_moverel(n, -1, 0)); // up
|
||||
ncplane_yx(n, &y, &x);
|
||||
CHECK(y == 1);
|
||||
CHECK(x == 2);
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
CHECK(0 == ncplane_moverel(n, 2, 0)); // down
|
||||
ncplane_yx(n, &y, &x);
|
||||
CHECK(y == 3);
|
||||
CHECK(x == 2);
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
CHECK(0 == ncplane_moverel(n, 0, -1)); // left
|
||||
ncplane_yx(n, &y, &x);
|
||||
CHECK(y == 3);
|
||||
CHECK(x == 1);
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
CHECK(0 == ncplane_moverel(n, 0, 2)); // right
|
||||
ncplane_yx(n, &y, &x);
|
||||
CHECK(y == 3);
|
||||
CHECK(x == 3);
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
CHECK(0 == ncplane_destroy(n));
|
||||
}
|
||||
|
||||
CHECK(0 == notcurses_stop(nc_));
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user