test: Print some progress info in a couple of tests

This commit is contained in:
Kim Woelders 2023-02-01 19:40:17 +01:00
parent a83de2e244
commit 21af0e5a95
6 changed files with 41 additions and 4 deletions

View File

@ -4,12 +4,15 @@
#include "test.h"
int debug = 0;
static bool ttyout = false;
int
main(int argc, char **argv)
{
const char *s;
ttyout = isatty(STDOUT_FILENO);
::testing::InitGoogleTest(&argc, argv);
for (argc--, argv++; argc > 0; argc--, argv++)
@ -32,6 +35,36 @@ main(int argc, char **argv)
return RUN_ALL_TESTS();
}
#define COL_RST "\x1B[0m"
#define COL_RED "\x1B[31m"
#define COL_GRN "\x1B[32m"
#define COL_YEL "\x1B[33m"
#define COL_BLU "\x1B[34m"
#define COL_MAG "\x1B[35m"
#define COL_CYN "\x1B[36m"
#define COL_WHT "\x1B[37m"
#include <stdarg.h>
void
pr_info(const char *fmt, ...)
{
char fmtx[1024];
va_list args;
va_start(args, fmt);
if (ttyout)
snprintf(fmtx, sizeof(fmtx), COL_YEL "[ ] - %s%s\n",
fmt, COL_RST);
else
snprintf(fmtx, sizeof(fmtx), "[ ] - %s", fmt);
fmt = fmtx;
vprintf(fmt, args);
va_end(args);
}
#include <Imlib2.h>
#include <zlib.h>

View File

@ -11,6 +11,8 @@
extern int debug;
void pr_info(const char *fmt, ...);
unsigned int image_get_crc32(Imlib_Image im);
#endif /* TEST_H */

View File

@ -351,8 +351,8 @@ _test_grab_2(const char *test, int depth, int func, int opt, int mask)
Pixmap pmap;
int w, h, d, d2;
D("%s: %s: depth=%d func=%d opt=%d mask=%d", __func__,
test, depth, func, opt, mask);
pr_info("%s: %s: depth=%d func=%d opt=%d mask=%d", __func__,
test, depth, func, opt, mask);
snprintf(buf, sizeof(buf), "%s_d%02d_f%d_o%d_m%d",
test, depth, func, opt, mask);

View File

@ -117,6 +117,7 @@ test_load(void)
{
// Load files of all types
snprintf(fileo, sizeof(fileo), "%s/%s.%s", IMG_SRC, "icon-64", pfxs[i]);
pr_info("Load '%s'", fileo);
D("Load '%s' (deferred)\n", fileo);
im = imlib_load_image(fileo);

View File

@ -113,7 +113,7 @@ TEST(LOAD2, load_1)
snprintf(buf, sizeof(buf), "%s/%s", IMG_SRC, fn);
fn = buf;
}
D("Load '%s'\n", fn);
pr_info("Load '%s'", fn);
im = imlib_load_image(fn);
ASSERT_TRUE(im);

View File

@ -97,7 +97,8 @@ test_save_1(const char *file, int prog, int check = 0)
h = imlib_image_get_height();
snprintf(fileo, sizeof(fileo), "%s/save-%s-%dx%d.%s",
IMG_GEN, file, w, h, ext);
D("Save '%s'\n", fileo);
pr_info("Save '%s'", fileo);
imlib_save_image_with_errno_return(fileo, &err);
EXPECT_EQ(err, 0);
if (err)