tests: lib: gui: lvgl: Migrate to version 9.2
With the update to v9.2.0 several Kconfig symbols were renamed or removed. Adjust the test accordingly. Also several constants were renamed, rename those also. Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
This commit is contained in:
parent
02cb5fe0c5
commit
8ff8e2940a
3 changed files with 38 additions and 18 deletions
|
|
@ -9,20 +9,18 @@ CONFIG_FLASH=y
|
|||
CONFIG_FLASH_MAP=y
|
||||
CONFIG_FILE_SYSTEM=y
|
||||
CONFIG_FILE_SYSTEM_LITTLEFS=y
|
||||
CONFIG_LV_Z_AUTO_INIT=n
|
||||
|
||||
CONFIG_LVGL=y
|
||||
CONFIG_LV_Z_MEM_POOL_SIZE=16384
|
||||
CONFIG_LV_Z_USE_FILESYSTEM=y
|
||||
CONFIG_LV_MEM_CUSTOM=y
|
||||
CONFIG_LV_USE_LOG=y
|
||||
CONFIG_LV_COLOR_DEPTH_32=y
|
||||
CONFIG_LV_COLOR_SCREEN_TRANSP=y
|
||||
CONFIG_LV_USE_BIDI=y
|
||||
CONFIG_LV_USE_ARABIC_PERSIAN_CHARS=y
|
||||
CONFIG_LV_USE_LABEL=y
|
||||
CONFIG_LV_LABEL_TEXT_SELECTION=y
|
||||
CONFIG_LV_LABEL_LONG_TXT_HINT=y
|
||||
CONFIG_LV_USE_IMG=y
|
||||
CONFIG_LV_USE_LINE=y
|
||||
CONFIG_LV_USE_ARC=y
|
||||
CONFIG_LV_USE_WIN=y
|
||||
|
|
@ -39,9 +37,6 @@ CONFIG_LV_USE_LED=y
|
|||
CONFIG_LV_USE_MSGBOX=y
|
||||
CONFIG_LV_USE_TEXTAREA=y
|
||||
CONFIG_LV_USE_SPINBOX=y
|
||||
CONFIG_LV_USE_BTN=y
|
||||
CONFIG_LV_USE_IMGBTN=y
|
||||
CONFIG_LV_USE_BTNMATRIX=y
|
||||
CONFIG_LV_USE_KEYBOARD=y
|
||||
CONFIG_LV_USE_CHECKBOX=y
|
||||
CONFIG_LV_USE_LIST=y
|
||||
|
|
@ -71,10 +66,8 @@ CONFIG_LV_FONT_MONTSERRAT_42=y
|
|||
CONFIG_LV_FONT_MONTSERRAT_44=y
|
||||
CONFIG_LV_FONT_MONTSERRAT_46=y
|
||||
CONFIG_LV_FONT_MONTSERRAT_48=y
|
||||
CONFIG_LV_FONT_MONTSERRAT_12_SUBPX=y
|
||||
CONFIG_LV_FONT_MONTSERRAT_28_COMPRESSED=y
|
||||
CONFIG_LV_FONT_DEJAVU_16_PERSIAN_HEBREW=y
|
||||
CONFIG_LV_FONT_SIMSUN_16_CJK=y
|
||||
CONFIG_LV_FONT_UNSCII_8=y
|
||||
CONFIG_LV_USE_FONT_COMPRESSED=y
|
||||
CONFIG_LV_USE_FONT_SUBPX=y
|
||||
|
|
|
|||
|
|
@ -120,17 +120,16 @@ static const uint8_t img_data[] = {
|
|||
/* 96 */
|
||||
};
|
||||
|
||||
static lv_img_dsc_t img_dsc = {
|
||||
.header.always_zero = 0,
|
||||
static lv_image_dsc_t img_dsc = {
|
||||
.header.w = 96,
|
||||
.header.h = 96,
|
||||
.data_size = sizeof(img_data),
|
||||
.header.cf = LV_IMG_CF_INDEXED_1BIT,
|
||||
.header.cf = LV_COLOR_FORMAT_I1,
|
||||
.data = img_data,
|
||||
};
|
||||
|
||||
|
||||
const lv_img_dsc_t *get_lvgl_img(void)
|
||||
const lv_image_dsc_t *get_lvgl_img(void)
|
||||
{
|
||||
return &img_dsc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,11 @@
|
|||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/drivers/display.h>
|
||||
#include <zephyr/fs/fs.h>
|
||||
#include <zephyr/fs/littlefs.h>
|
||||
#include <zephyr/ztest.h>
|
||||
#include <lvgl_zephyr.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
|
|
@ -54,6 +56,8 @@ static struct fs_mount_t mnt = {
|
|||
};
|
||||
#endif /* CONFIG_FS_LITTLEFS_BLK_DEV */
|
||||
|
||||
static const struct device *display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
|
||||
|
||||
ZTEST(lvgl_screen, test_get_default_screen)
|
||||
{
|
||||
zassert_not_null(lv_scr_act(), "No default screen");
|
||||
|
|
@ -94,13 +98,37 @@ ZTEST_USER(lvgl_fs, test_add_img)
|
|||
lv_obj_align(img, LV_ALIGN_CENTER, 0, 0);
|
||||
}
|
||||
|
||||
void *setup_lvgl(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#if CONFIG_LV_COLOR_DEPTH_1 == 1
|
||||
display_set_pixel_format(display_dev, PIXEL_FORMAT_MONO10);
|
||||
#elif CONFIG_LV_COLOR_DEPTH_8 == 1 || CONFIG_LV_COLOR_DEPTH_24 == 1
|
||||
/* No 8bit display pixel format not supported */
|
||||
display_set_pixel_format(display_dev, PIXEL_FORMAT_RGB_888);
|
||||
#elif CONFIG_LV_COLOR_DEPTH_16 == 1
|
||||
display_set_pixel_format(display_dev, PIXEL_FORMAT_RGB_565);
|
||||
#elif CONFIG_LV_COLOR_DEPTH_32 == 1
|
||||
display_set_pixel_format(display_dev, PIXEL_FORMAT_ARGB_8888);
|
||||
#else
|
||||
#error "No display pixel format defined, is your board supported?"
|
||||
#endif
|
||||
|
||||
ret = lvgl_init();
|
||||
zassert_equal(ret, 0, "Failed to initialize lvgl");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *setup_fs(void)
|
||||
{
|
||||
struct fs_file_t img;
|
||||
struct fs_dirent info;
|
||||
int ret;
|
||||
const lv_img_dsc_t *c_img = get_lvgl_img();
|
||||
const lv_image_dsc_t *c_img = get_lvgl_img();
|
||||
|
||||
setup_lvgl();
|
||||
|
||||
ret = fs_mount(&mnt);
|
||||
if (ret < 0) {
|
||||
|
|
@ -122,7 +150,7 @@ void *setup_fs(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ret = fs_write(&img, &c_img->header, sizeof(lv_img_header_t));
|
||||
ret = fs_write(&img, &c_img->header, sizeof(lv_image_header_t));
|
||||
if (ret < 0) {
|
||||
TC_PRINT("Failed to write image file header: %d\n", ret);
|
||||
ztest_test_fail();
|
||||
|
|
@ -145,10 +173,10 @@ void *setup_fs(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void teardown_fs(void *data)
|
||||
void teardown_lvgl(void *data)
|
||||
{
|
||||
return;
|
||||
lv_deinit();
|
||||
}
|
||||
|
||||
ZTEST_SUITE(lvgl_screen, NULL, NULL, NULL, NULL, NULL);
|
||||
ZTEST_SUITE(lvgl_fs, NULL, setup_fs, NULL, NULL, teardown_fs);
|
||||
ZTEST_SUITE(lvgl_screen, NULL, setup_lvgl, NULL, NULL, teardown_lvgl);
|
||||
ZTEST_SUITE(lvgl_fs, NULL, setup_fs, NULL, NULL, teardown_lvgl);
|
||||
|
|
|
|||
Loading…
Reference in a new issue