test: highlight the various state machines with colors

Makes visual identification easier

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2017-03-28 11:48:52 +10:00
parent 6ab2999be9
commit 24445374b2
2 changed files with 34 additions and 4 deletions

View file

@ -53,9 +53,20 @@
/* The HW DPI rate we normalize to before calculating pointer acceleration */
#define DEFAULT_MOUSE_DPI 1000
#define ANSI_HIGHLIGHT "\x1B[0;1;39m"
#define ANSI_RED "\x1B[0;31m"
#define ANSI_NORMAL "\x1B[0m"
#define ANSI_HIGHLIGHT "\x1B[0;1;39m"
#define ANSI_RED "\x1B[0;31m"
#define ANSI_GREEN "\x1B[0;32m"
#define ANSI_YELLOW "\x1B[0;33m"
#define ANSI_BLUE "\x1B[0;34m"
#define ANSI_MAGENTA "\x1B[0;35m"
#define ANSI_CYAN "\x1B[0;36m"
#define ANSI_BRIGHT_RED "\x1B[0;31;1m"
#define ANSI_BRIGHT_GREEN "\x1B[0;32;1m"
#define ANSI_BRIGHT_YELLOW "\x1B[0;33;1m"
#define ANSI_BRIGHT_BLUE "\x1B[0;34;1m"
#define ANSI_BRIGHT_MAGENTA "\x1B[0;35;1m"
#define ANSI_BRIGHT_CYAN "\x1B[0;36;1m"
#define ANSI_NORMAL "\x1B[0m"
#define CASE_RETURN_STRING(a) case a: return #a

View file

@ -800,7 +800,7 @@ litest_log_handler(struct libinput *libinput,
break;
case LIBINPUT_LOG_PRIORITY_ERROR:
priority = "error";
color = ANSI_RED;
color = ANSI_BRIGHT_RED;
break;
case LIBINPUT_LOG_PRIORITY_DEBUG:
priority = "debug";
@ -815,6 +815,25 @@ litest_log_handler(struct libinput *libinput,
if (had_newline)
fprintf(stderr, "%slitest %s ", color, priority);
if (strstr(format, "tap state:"))
color = ANSI_BLUE;
else if (strstr(format, "thumb state:"))
color = ANSI_YELLOW;
else if (strstr(format, "button state:"))
color = ANSI_MAGENTA;
else if (strstr(format, "touch-size:") ||
strstr(format, "pressure:"))
color = ANSI_GREEN;
else if (strstr(format, "palm:") ||
strstr(format, "thumb:"))
color = ANSI_CYAN;
else if (strstr(format, "edge state:"))
color = ANSI_BRIGHT_GREEN;
if (is_tty)
fprintf(stderr, "%s ", color);
vfprintf(stderr, format, args);
had_newline = strlen(format) >= 1 &&
format[strlen(format) - 1] == '\n';