mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04:00
z-axis unit tests #71
This commit is contained in:
parent
dac4f78ee6
commit
599b7a6d9a
@ -39,6 +39,27 @@ TEST_F(ZAxisTest, StdPlaneOnly) {
|
||||
EXPECT_EQ(nullptr, ncplane_below(top));
|
||||
}
|
||||
|
||||
// if you want to move the plane which is already top+bottom to either, go ahead
|
||||
TEST_F(ZAxisTest, StdPlaneOnanism) {
|
||||
EXPECT_EQ(0, ncplane_move_top(n_));
|
||||
struct ncplane* top = notcurses_top(nc_);
|
||||
EXPECT_EQ(n_, top);
|
||||
EXPECT_EQ(nullptr, ncplane_below(top));
|
||||
EXPECT_EQ(0, ncplane_move_bottom(n_));
|
||||
EXPECT_EQ(nullptr, ncplane_below(n_));
|
||||
}
|
||||
|
||||
// you can't place a plane above or below itself, stdplane or otherwise
|
||||
TEST_F(ZAxisTest, NoMoveSelf) {
|
||||
struct ncplane* np = notcurses_newplane(nc_, 2, 2, 0, 0, nullptr);
|
||||
ASSERT_NE(nullptr, np);
|
||||
EXPECT_NE(0, ncplane_move_below(n_, n_));
|
||||
EXPECT_NE(0, ncplane_move_above(n_, n_));
|
||||
EXPECT_NE(0, ncplane_move_below(np, np));
|
||||
EXPECT_NE(0, ncplane_move_above(np, np));
|
||||
}
|
||||
|
||||
// new planes ought be on the top
|
||||
TEST_F(ZAxisTest, NewPlaneOnTop) {
|
||||
struct ncplane* np = notcurses_newplane(nc_, 2, 2, 0, 0, nullptr);
|
||||
ASSERT_NE(nullptr, np);
|
||||
@ -47,3 +68,34 @@ TEST_F(ZAxisTest, NewPlaneOnTop) {
|
||||
EXPECT_EQ(n_, ncplane_below(top));
|
||||
EXPECT_EQ(nullptr, ncplane_below(n_));
|
||||
}
|
||||
|
||||
// "move" top plane to top. everything ought remain the same.
|
||||
TEST_F(ZAxisTest, TopToTop) {
|
||||
struct ncplane* np = notcurses_newplane(nc_, 2, 2, 0, 0, nullptr);
|
||||
ASSERT_NE(nullptr, np);
|
||||
struct ncplane* top = notcurses_top(nc_);
|
||||
EXPECT_EQ(np, top);
|
||||
EXPECT_EQ(n_, ncplane_below(top));
|
||||
EXPECT_EQ(nullptr, ncplane_below(n_));
|
||||
EXPECT_EQ(0, ncplane_move_top(np));
|
||||
// verify it
|
||||
top = notcurses_top(nc_);
|
||||
EXPECT_EQ(np, top);
|
||||
EXPECT_EQ(n_, ncplane_below(top));
|
||||
EXPECT_EQ(nullptr, ncplane_below(n_));
|
||||
}
|
||||
|
||||
// move top plane to bottom, and verify enumeration
|
||||
TEST_F(ZAxisTest, TopToBottom) {
|
||||
struct ncplane* np = notcurses_newplane(nc_, 2, 2, 0, 0, nullptr);
|
||||
ASSERT_NE(nullptr, np);
|
||||
struct ncplane* top = notcurses_top(nc_);
|
||||
EXPECT_EQ(np, top);
|
||||
EXPECT_EQ(n_, ncplane_below(top));
|
||||
EXPECT_EQ(nullptr, ncplane_below(n_));
|
||||
EXPECT_EQ(0, ncplane_move_bottom(np));
|
||||
top = notcurses_top(nc_);
|
||||
EXPECT_EQ(n_, top);
|
||||
EXPECT_EQ(np, ncplane_below(top));
|
||||
EXPECT_EQ(nullptr, ncplane_below(np));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user