1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

feat(tests): add log print callback (#7076)

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
VIFEX 2024-10-16 18:09:49 +08:00 committed by GitHub
parent 79b3bf1265
commit 8a9ce07c2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,7 @@
static void hal_init(void);
static void dummy_flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * color_p);
static void test_log_print_cb(lv_log_level_t level, const char * buf);
uint8_t * last_flushed_buf;
lv_indev_t * lv_test_mouse_indev;
@ -19,6 +20,14 @@ lv_indev_t * lv_test_encoder_indev;
void lv_test_init(void)
{
lv_init();
lv_log_register_print_cb(test_log_print_cb);
#if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN
/* Disable profiler, to reduce redundant profiler log printing */
lv_profiler_builtin_set_enable(false);
#endif
hal_init();
#if LV_USE_SYSMON
#if LV_USE_MEM_MONITOR
@ -76,6 +85,15 @@ static void dummy_flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t
lv_display_flush_ready(disp);
}
static void test_log_print_cb(lv_log_level_t level, const char * buf)
{
if(level < LV_LOG_LEVEL_WARN) {
return;
}
TEST_PRINTF("%s", buf);
}
void lv_test_assert_fail(void)
{
/*Handle error on test*/