2020-02-05 22:29:42 +00:00
|
|
|
#include "main.h"
|
|
|
|
#include <iostream>
|
|
|
|
|
2020-08-09 21:40:59 +00:00
|
|
|
auto panelcb(struct nctablet* t, bool toptobottom) -> int {
|
2020-02-06 01:04:56 +00:00
|
|
|
CHECK(nctablet_ncplane(t));
|
|
|
|
CHECK(!nctablet_userptr(t));
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK(toptobottom);
|
2020-02-05 22:29:42 +00:00
|
|
|
// FIXME verify geometry is as expected
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-08-09 21:40:59 +00:00
|
|
|
auto cbfxn(struct nctablet* t, bool toptobottom) -> int {
|
|
|
|
(void)toptobottom;
|
|
|
|
int* userptr = static_cast<int*>(nctablet_userptr(t));
|
2020-08-10 02:14:56 +00:00
|
|
|
++*userptr;
|
2020-08-09 21:40:59 +00:00
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
// debugging
|
|
|
|
bool ncreel_validate(const ncreel* n){
|
|
|
|
if(n->tablets == NULL){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
const nctablet* t = n->tablets;
|
|
|
|
int cury = -1;
|
|
|
|
bool wentaround = false;
|
|
|
|
do{
|
|
|
|
const ncplane* np = t->p;
|
|
|
|
if(np){
|
|
|
|
int y, x;
|
|
|
|
ncplane_yx(np, &y, &x);
|
|
|
|
//fprintf(stderr, "forvart: %p (%p) @ %d\n", t, np, y);
|
2020-08-10 02:14:56 +00:00
|
|
|
if(y < cury + 1){
|
2020-08-09 21:40:59 +00:00
|
|
|
if(wentaround){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
wentaround = true;
|
|
|
|
}else if(y == cury){
|
|
|
|
return false;
|
|
|
|
}
|
2020-08-10 02:14:56 +00:00
|
|
|
int ylen, xlen;
|
|
|
|
ncplane_dim_yx(np, &ylen, &xlen);
|
|
|
|
cury = y + ylen - 1;
|
2020-08-09 21:40:59 +00:00
|
|
|
}
|
|
|
|
}while((t = t->next) != n->tablets);
|
|
|
|
cury = INT_MAX;
|
|
|
|
wentaround = false;
|
|
|
|
do{
|
|
|
|
const ncplane* np = t->p;
|
|
|
|
if(np){
|
2020-08-10 02:14:56 +00:00
|
|
|
int y, x, ylen, xlen;
|
2020-08-09 21:40:59 +00:00
|
|
|
ncplane_yx(np, &y, &x);
|
2020-08-10 02:14:56 +00:00
|
|
|
ncplane_dim_yx(np, &ylen, &xlen);
|
2020-08-09 21:40:59 +00:00
|
|
|
//fprintf(stderr, "backwards: %p (%p) @ %d\n", t, np, y);
|
2020-08-10 02:14:56 +00:00
|
|
|
if(y + ylen - 1 > cury - 1){
|
2020-08-09 21:40:59 +00:00
|
|
|
if(wentaround){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
wentaround = true;
|
|
|
|
}else if(y == cury){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
cury = y;
|
|
|
|
}
|
|
|
|
}while((t = t->prev) != n->tablets);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-05-07 19:06:07 +00:00
|
|
|
TEST_CASE("Reels") {
|
2020-06-16 03:58:43 +00:00
|
|
|
auto nc_ = testing_notcurses();
|
2020-05-17 11:57:21 +00:00
|
|
|
if(!nc_){
|
|
|
|
return;
|
|
|
|
}
|
2020-02-05 22:29:42 +00:00
|
|
|
struct ncplane* n_ = notcurses_stdplane(nc_);
|
|
|
|
REQUIRE(n_);
|
|
|
|
REQUIRE(0 == ncplane_cursor_move_yx(n_, 0, 0));
|
|
|
|
|
|
|
|
SUBCASE("InitLinear") {
|
|
|
|
ncreel_options r = { };
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(nr);
|
2020-08-16 10:52:45 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
|
|
|
CHECK(0 == ncreel_destroy(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("InitLinearInfinite") {
|
|
|
|
ncreel_options r{};
|
2020-05-29 18:53:53 +00:00
|
|
|
r.flags = NCREEL_OPTION_INFINITESCROLL;
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(nr);
|
2020-08-16 10:52:45 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
|
|
|
CHECK(0 == ncreel_destroy(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("InitCircular") {
|
|
|
|
ncreel_options r{};
|
2020-05-29 18:53:53 +00:00
|
|
|
r.flags = NCREEL_OPTION_INFINITESCROLL | NCREEL_OPTION_CIRCULAR;
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(nr);
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK(ncreel_validate(nr));
|
2020-08-16 10:52:45 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(0 == ncreel_destroy(nr));
|
|
|
|
}
|
|
|
|
|
|
|
|
// circular is not allowed to be true when infinitescroll is false
|
|
|
|
SUBCASE("FiniteCircleRejected") {
|
|
|
|
ncreel_options r{};
|
2020-05-29 18:53:53 +00:00
|
|
|
r.flags = NCREEL_OPTION_CIRCULAR;
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(!nr);
|
2020-08-16 10:52:45 +00:00
|
|
|
CHECK(0 == notcurses_render(nc_));
|
|
|
|
REQUIRE(0 == ncreel_destroy(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// We ought be able to invoke ncreel_next() and ncreel_prev() safely,
|
|
|
|
// even if there are no tablets. They both ought return nullptr.
|
|
|
|
SUBCASE("MovementWithoutTablets") {
|
|
|
|
ncreel_options r{};
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(nr);
|
|
|
|
CHECK(!ncreel_next(nr));
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
CHECK(!ncreel_prev(nr));
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
2020-08-16 10:52:45 +00:00
|
|
|
REQUIRE(0 == ncreel_destroy(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("OneTablet") {
|
|
|
|
ncreel_options r{};
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(nr);
|
2020-02-06 01:04:56 +00:00
|
|
|
struct nctablet* t = ncreel_add(nr, nullptr, nullptr, panelcb, nullptr);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(t);
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
CHECK(0 == ncreel_del(nr, t));
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
2020-08-16 10:52:45 +00:00
|
|
|
REQUIRE(0 == ncreel_destroy(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("MovementWithOneTablet") {
|
|
|
|
ncreel_options r{};
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(nr);
|
2020-02-06 01:04:56 +00:00
|
|
|
struct nctablet* t = ncreel_add(nr, nullptr, nullptr, panelcb, nullptr);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(t);
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
CHECK(ncreel_next(nr));
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
CHECK(ncreel_prev(nr));
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
CHECK(0 == ncreel_del(nr, t));
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
2020-08-16 10:52:45 +00:00
|
|
|
REQUIRE(0 == ncreel_destroy(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("DeleteActiveTablet") {
|
|
|
|
ncreel_options r{};
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(nr);
|
2020-02-06 01:04:56 +00:00
|
|
|
struct nctablet* t = ncreel_add(nr, nullptr, nullptr, panelcb, nullptr);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(t);
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
CHECK(0 == ncreel_del(nr, ncreel_focused(nr)));
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
2020-08-16 10:52:45 +00:00
|
|
|
REQUIRE(0 == ncreel_destroy(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("NoBorder") {
|
|
|
|
ncreel_options r{};
|
|
|
|
r.bordermask = NCBOXMASK_LEFT | NCBOXMASK_RIGHT |
|
|
|
|
NCBOXMASK_TOP | NCBOXMASK_BOTTOM;
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(nr);
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
2020-08-16 10:52:45 +00:00
|
|
|
CHECK(0 == ncreel_destroy(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("BadBorderBitsRejected") {
|
|
|
|
ncreel_options r{};
|
|
|
|
r.bordermask = NCBOXMASK_LEFT * 2;
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(!nr);
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("NoTabletBorder") {
|
|
|
|
ncreel_options r{};
|
|
|
|
r.tabletmask = NCBOXMASK_LEFT | NCBOXMASK_RIGHT |
|
|
|
|
NCBOXMASK_TOP | NCBOXMASK_BOTTOM;
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(nr);
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
2020-08-16 10:52:45 +00:00
|
|
|
CHECK(0 == ncreel_destroy(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("NoTopBottomBorder") {
|
|
|
|
ncreel_options r{};
|
|
|
|
r.bordermask = NCBOXMASK_TOP | NCBOXMASK_BOTTOM;
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(nr);
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
2020-08-16 10:52:45 +00:00
|
|
|
CHECK(0 == ncreel_destroy(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("NoSideBorders") {
|
|
|
|
ncreel_options r{};
|
|
|
|
r.bordermask = NCBOXMASK_LEFT | NCBOXMASK_RIGHT;
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(nr);
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
2020-08-16 10:52:45 +00:00
|
|
|
CHECK(0 == ncreel_destroy(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("BadTabletBorderBitsRejected") {
|
|
|
|
ncreel_options r{};
|
|
|
|
r.tabletmask = NCBOXMASK_LEFT * 2;
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(!nr);
|
|
|
|
}
|
|
|
|
|
2020-08-09 21:40:59 +00:00
|
|
|
SUBCASE("TransparentBackground") {
|
2020-02-05 22:29:42 +00:00
|
|
|
ncreel_options r{};
|
2020-08-09 21:40:59 +00:00
|
|
|
channels_set_bg_alpha(&r.bgchannel, 3);
|
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
|
|
|
REQUIRE(nr);
|
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
2020-08-16 10:52:45 +00:00
|
|
|
CHECK(0 == ncreel_destroy(nr));
|
2020-08-09 21:40:59 +00:00
|
|
|
}
|
2020-02-05 22:29:42 +00:00
|
|
|
|
2020-08-09 21:40:59 +00:00
|
|
|
// Layout tests. Add some tablets, move around, and verify that they all
|
|
|
|
// have the expected locations/contents/geometries.
|
|
|
|
SUBCASE("ThreeCycleDown") {
|
2020-02-05 22:29:42 +00:00
|
|
|
ncreel_options r{};
|
|
|
|
channels_set_bg_alpha(&r.bgchannel, 3);
|
Tons of work on ncreel (#776)
Tons of work on ncreel (#627, #749, #694)
Improve reel demo: get input wired up once more, avoid the FPS demo at bottom, print pointer and line count in each tablet, use new ncreel API. Improve notcurses-ncreel explorer: kill memory leaks (#694), draw tablets better, use new ncreel API. Fix bug in ncreel core where cruft could be left on the screen, via a very gross brute force algorithm. I'll likely come back and make this a bit less ghastly in the future #749. Remove weird one-off input system from ncreel, residue from outcurses. Make some of the normalizing changes speced out in #627
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* more terminal environment variable notes
* TERMS.md: add Sakura, st
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* ncreel: give each tablet an index, and print it #749
* reel: eliminate FIXME + param to insert_tabler() #749
* ncreel: label tablets with their adress to correlate against debugging logs #749
* ncreel: move legend out of reel proper
* ncreel_options: dump min/max_supported_rows/cols #627
* ncreel: remove weird one-off input layer #627
* ncreel: add ncreel_offer_input()
* reel demo: call demo_getc()
* reel demo: rig up input to demo main
* ncreel: drop ncreel_del_focused(), properly bind tablets
* reel demo: don't free up necessary plane
* ncreel: don't pull absolute locations of tablets
* ncreel: place tablets correctly in boundrel
* reel demo: add back support for left/right
* reel demo: restore thread movement
* ncreel: remove a great deal of complexity
* reel demo: stay out of FPS graph's way
* reel: tighten up reel following redraw
* reel: fix upper-left corner of topless perimeter
* ncreel: print linecount, return clipped value
* reel: draw focused tablet relative to reel
* reel: brute force decruftification, how embarrassing #749
2020-07-09 06:02:23 +00:00
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
2020-02-05 22:29:42 +00:00
|
|
|
REQUIRE(nr);
|
2020-08-09 21:40:59 +00:00
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
|
|
|
int order[3];
|
|
|
|
nctablet* tabs[3];
|
|
|
|
for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){
|
|
|
|
order[n] = -1;
|
|
|
|
tabs[n] = ncreel_add(nr, nullptr, nullptr, cbfxn, &order[n]);
|
|
|
|
REQUIRE(tabs[n]);
|
|
|
|
CHECK(tabs[0] == nr->tablets);
|
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
|
|
|
}
|
|
|
|
int expectedy = 1;
|
|
|
|
for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){
|
|
|
|
CHECK_LE(0, order[n]);
|
|
|
|
int y;
|
|
|
|
ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr);
|
|
|
|
CHECK(y == expectedy);
|
|
|
|
expectedy += 7;
|
|
|
|
}
|
|
|
|
ncreel_next(nr);
|
|
|
|
CHECK(tabs[1] == nr->tablets);
|
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
|
|
|
expectedy = 1;
|
|
|
|
for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){
|
|
|
|
CHECK_LE(1, order[n]);
|
|
|
|
int y;
|
|
|
|
ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr);
|
|
|
|
CHECK(y == expectedy);
|
|
|
|
expectedy += 7;
|
|
|
|
}
|
|
|
|
ncreel_next(nr);
|
|
|
|
CHECK(tabs[2] == nr->tablets);
|
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
|
|
|
expectedy = 1;
|
|
|
|
for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){
|
2020-08-10 02:14:56 +00:00
|
|
|
CHECK_LE(2, order[n]);
|
2020-08-09 21:40:59 +00:00
|
|
|
int y;
|
|
|
|
ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr);
|
|
|
|
CHECK(y == expectedy);
|
|
|
|
expectedy += 7;
|
|
|
|
}
|
|
|
|
ncreel_prev(nr);
|
|
|
|
CHECK(tabs[1] == nr->tablets);
|
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
|
|
|
expectedy = 1;
|
|
|
|
for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){
|
2020-08-10 02:14:56 +00:00
|
|
|
CHECK_LE(3, order[n]);
|
2020-08-09 21:40:59 +00:00
|
|
|
int y;
|
|
|
|
ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr);
|
|
|
|
CHECK(y == expectedy);
|
|
|
|
expectedy += 7;
|
|
|
|
}
|
|
|
|
ncreel_prev(nr);
|
|
|
|
CHECK(tabs[0] == nr->tablets);
|
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
|
|
|
expectedy = 1;
|
|
|
|
for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){
|
2020-08-10 02:14:56 +00:00
|
|
|
CHECK_LE(4, order[n]);
|
2020-08-09 21:40:59 +00:00
|
|
|
int y;
|
|
|
|
ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr);
|
|
|
|
CHECK(y == expectedy);
|
|
|
|
expectedy += 7;
|
|
|
|
}
|
2020-08-16 10:52:45 +00:00
|
|
|
CHECK(0 == ncreel_destroy(nr));
|
2020-02-05 22:29:42 +00:00
|
|
|
}
|
|
|
|
|
2020-08-10 02:14:56 +00:00
|
|
|
// Layout tests. Add some tablets, move around, and verify that they all
|
|
|
|
// have the expected locations/contents/geometries.
|
|
|
|
SUBCASE("ThreeCycleDownNoTabletBorders") {
|
|
|
|
ncreel_options r{};
|
|
|
|
r.tabletmask = 0xf;
|
|
|
|
channels_set_bg_alpha(&r.bgchannel, 3);
|
|
|
|
struct ncreel* nr = ncreel_create(n_, &r);
|
|
|
|
REQUIRE(nr);
|
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
|
|
|
int order[3];
|
|
|
|
nctablet* tabs[3];
|
|
|
|
for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){
|
|
|
|
order[n] = -1;
|
|
|
|
tabs[n] = ncreel_add(nr, nullptr, nullptr, cbfxn, &order[n]);
|
|
|
|
REQUIRE(tabs[n]);
|
|
|
|
CHECK(tabs[0] == nr->tablets);
|
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
|
|
|
}
|
|
|
|
int expectedy = 1;
|
|
|
|
for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){
|
|
|
|
CHECK_LE(-1, order[n]);
|
|
|
|
int y;
|
|
|
|
ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr);
|
|
|
|
CHECK(y == expectedy);
|
|
|
|
expectedy += 5;
|
|
|
|
}
|
|
|
|
ncreel_next(nr);
|
|
|
|
CHECK(tabs[1] == nr->tablets);
|
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
|
|
|
expectedy = 1;
|
|
|
|
for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){
|
|
|
|
CHECK_LE(1, order[n]);
|
|
|
|
int y;
|
|
|
|
ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr);
|
|
|
|
CHECK(y == expectedy);
|
|
|
|
expectedy += 5;
|
|
|
|
}
|
|
|
|
ncreel_next(nr);
|
|
|
|
CHECK(tabs[2] == nr->tablets);
|
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
|
|
|
expectedy = 1;
|
|
|
|
for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){
|
|
|
|
CHECK_LE(2, order[n]);
|
|
|
|
int y;
|
|
|
|
ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr);
|
|
|
|
CHECK(y == expectedy);
|
|
|
|
expectedy += 5;
|
|
|
|
}
|
|
|
|
ncreel_prev(nr);
|
|
|
|
CHECK(tabs[1] == nr->tablets);
|
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
|
|
|
expectedy = 1;
|
|
|
|
for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){
|
|
|
|
CHECK_LE(3, order[n]);
|
|
|
|
int y;
|
|
|
|
ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr);
|
|
|
|
CHECK(y == expectedy);
|
|
|
|
expectedy += 5;
|
|
|
|
}
|
|
|
|
ncreel_prev(nr);
|
|
|
|
CHECK(tabs[0] == nr->tablets);
|
|
|
|
CHECK_EQ(0, ncreel_redraw(nr));
|
|
|
|
CHECK_EQ(0, notcurses_render(nc_));
|
|
|
|
CHECK(ncreel_validate(nr));
|
|
|
|
expectedy = 1;
|
|
|
|
for(size_t n = 0 ; n < sizeof(order) / sizeof(*order) ; ++n){
|
|
|
|
CHECK_LE(4, order[n]);
|
|
|
|
int y;
|
|
|
|
ncplane_yx(ncplane_parent(nctablet_ncplane(tabs[n])), &y, nullptr);
|
|
|
|
CHECK(y == expectedy);
|
|
|
|
expectedy += 5;
|
|
|
|
}
|
2020-08-16 10:52:45 +00:00
|
|
|
CHECK(0 == ncreel_destroy(nr));
|
2020-08-10 02:14:56 +00:00
|
|
|
}
|
|
|
|
|
2020-02-05 22:29:42 +00:00
|
|
|
CHECK(0 == notcurses_stop(nc_));
|
|
|
|
}
|