mirror of
https://github.com/lvgl/lvgl.git
synced 2026-06-01 00:51:49 +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:
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
static void hal_init(void);
|
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 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;
|
uint8_t * last_flushed_buf;
|
||||||
lv_indev_t * lv_test_mouse_indev;
|
lv_indev_t * lv_test_mouse_indev;
|
||||||
@@ -19,6 +20,14 @@ lv_indev_t * lv_test_encoder_indev;
|
|||||||
void lv_test_init(void)
|
void lv_test_init(void)
|
||||||
{
|
{
|
||||||
lv_init();
|
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();
|
hal_init();
|
||||||
#if LV_USE_SYSMON
|
#if LV_USE_SYSMON
|
||||||
#if LV_USE_MEM_MONITOR
|
#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);
|
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)
|
void lv_test_assert_fail(void)
|
||||||
{
|
{
|
||||||
/*Handle error on test*/
|
/*Handle error on test*/
|
||||||
|
|||||||
Reference in New Issue
Block a user