From e29701cac37cd013f31f08dba529af57b5f1eff4 Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 24 Apr 2021 05:18:04 -0400 Subject: [PATCH] notcurses-tester: accept -l to enable all logging --- doc/man/man1/notcurses-tester.1.md | 7 ++++++- src/lib/render.c | 2 ++ src/tests/main.cpp | 9 ++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/man/man1/notcurses-tester.1.md b/doc/man/man1/notcurses-tester.1.md index 57ac048b8..aed67bff2 100644 --- a/doc/man/man1/notcurses-tester.1.md +++ b/doc/man/man1/notcurses-tester.1.md @@ -8,7 +8,7 @@ notcurses-tester - Notcurses unit testing # SYNOPSIS -**notcurses-tester** [**-p datadir**] +**notcurses-tester** [**-p datadir**] [**-l**] # DESCRIPTION @@ -18,7 +18,12 @@ if these are in an irregular location, supply **-p**. # OPTIONS +**-p** ***path***: Look in the specified ***path*** for data files. + +**-l**: Enable all possible diagnostics/logging. + # NOTES + Valid **TERM** and **LANG** environment variables are necessary for **notcurses-tester**'s correct operation. diff --git a/src/lib/render.c b/src/lib/render.c index 3cda046a5..2d6762e58 100644 --- a/src/lib/render.c +++ b/src/lib/render.c @@ -140,6 +140,8 @@ highcontrast(uint32_t bchannel){ } // wants coordinates within the sprixel, not absolute +// FIXME if plane is not wholly on-screen, probably need to toss plane, +// at least for this rendering cycle static void paint_sprixel(const ncplane* p, const nccell* vis, struct crender* crender, int y, int x){ diff --git a/src/tests/main.cpp b/src/tests/main.cpp index eee6fc62f..53f4f7c9f 100644 --- a/src/tests/main.cpp +++ b/src/tests/main.cpp @@ -12,13 +12,14 @@ #include #include -static const char* datadir = NOTCURSES_SHARE; +const char* datadir = NOTCURSES_SHARE; +ncloglevel_e loglevel = NCLOGLEVEL_SILENT; auto testing_notcurses() -> struct notcurses* { notcurses_options nopts{}; - // FIXME get loglevel from command line. enabling it by default leads to + // get loglevel from command line. enabling it by default leads to // more confusion than useful information, so leave it off by default. - //nopts.loglevel = NCLOGLEVEL_TRACE; + nopts.loglevel = loglevel; nopts.flags = NCOPTION_SUPPRESS_BANNERS | NCOPTION_NO_ALTERNATE_SCREEN; auto nc = notcurses_init(&nopts, nullptr); return nc; @@ -39,6 +40,8 @@ handle_opts(const char** argv){ inarg = false; }else if(strcmp(*argv, "-p") == 0){ inarg = true; + }else if(strcmp(*argv, "-l") == 0){ + loglevel = NCLOGLEVEL_TRACE; } ++argv; }