diff options
author | Tom Rini <trini@konsulko.com> | 2022-10-30 17:16:35 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-10-30 17:16:35 -0400 |
commit | 218e2c45af83f2cb7b1374b9023b4ced6eb0bb77 (patch) | |
tree | e78dcbb902ebca32f6048b74e67414419dc4edab /test | |
parent | 6f02819cceb19c334f1dbd6eccefb4ccfae319f9 (diff) | |
parent | b86986c7b314f1378ca5be8df49310a6ce7302f8 (diff) | |
download | u-boot-218e2c45af83f2cb7b1374b9023b4ced6eb0bb77.tar.gz |
Merge tag 'video-20221030' of https://source.denx.de/u-boot/custodians/u-boot-video
- fix [hv]sync active vs back porch in dw_mipi_dsi
- simplefb rotation support
- support splash as raw image from MMC
- enhancements to Truetype console (multiple fonts and sizes)
- drop old LCD support
Diffstat (limited to 'test')
-rw-r--r-- | test/cmd/Makefile | 1 | ||||
-rw-r--r-- | test/cmd/font.c | 77 | ||||
-rw-r--r-- | test/cmd_ut.c | 6 | ||||
-rw-r--r-- | test/dm/Makefile | 4 |
4 files changed, 86 insertions, 2 deletions
diff --git a/test/cmd/Makefile b/test/cmd/Makefile index f2a5f4ed80..6dd6e81875 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -11,6 +11,7 @@ endif obj-y += mem.o obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o obj-$(CONFIG_CMD_FDT) += fdt.o +obj-$(CONFIG_CONSOLE_TRUETYPE) += font.o obj-$(CONFIG_CMD_LOADM) += loadm.o obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o obj-$(CONFIG_CMD_PINMUX) += pinmux.o diff --git a/test/cmd/font.c b/test/cmd/font.c new file mode 100644 index 0000000000..7a4156ade6 --- /dev/null +++ b/test/cmd/font.c @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Tests for font command + * + * Copyright 2022 Google LLC + */ + +#include <common.h> +#include <console.h> +#include <dm.h> +#include <video_console.h> +#include <test/suites.h> +#include <test/ut.h> + +/* Declare a new fdt test */ +#define FONT_TEST(_name, _flags) UNIT_TEST(_name, _flags, font_test) + +/* Test 'fdt addr' resizing an fdt */ +static int font_test_base(struct unit_test_state *uts) +{ + struct udevice *dev; + int max_metrics; + uint size; + int ret; + + ut_assertok(uclass_first_device_err(UCLASS_VIDEO, &dev)); + ut_assertok(uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev)); + + ut_assertok(console_record_reset_enable()); + ut_assertok(run_command("font list", 0)); + ut_assert_nextline("nimbus_sans_l_regular"); + ut_assert_nextline("cantoraone_regular"); + ut_assertok(ut_check_console_end(uts)); + + ut_asserteq_str("nimbus_sans_l_regular", + vidconsole_get_font(dev, &size)); + ut_asserteq(18, size); + + max_metrics = 1; + if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE)) + max_metrics = IF_ENABLED_INT(CONFIG_CONSOLE_TRUETYPE, + CONFIG_CONSOLE_TRUETYPE_MAX_METRICS); + + ret = run_command("font select cantoraone_regular 40", 0); + if (max_metrics < 2) { + ut_asserteq(1, ret); + ut_assert_nextline("Failed (error -7)"); + ut_assertok(ut_check_console_end(uts)); + return 0; + } + + ut_assertok(ret); + ut_assertok(ut_check_console_end(uts)); + + ut_asserteq_str("cantoraone_regular", + vidconsole_get_font(dev, &size)); + ut_asserteq(40, size); + + ut_assertok(run_command("font size 30", 0)); + ut_assertok(ut_check_console_end(uts)); + + ut_asserteq_str("cantoraone_regular", + vidconsole_get_font(dev, &size)); + ut_asserteq(30, size); + + return 0; +} +FONT_TEST(font_test_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | + UT_TESTF_CONSOLE_REC | UT_TESTF_DM); + +int do_ut_font(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + struct unit_test *tests = UNIT_TEST_SUITE_START(font_Test); + const int n_ents = UNIT_TEST_SUITE_COUNT(font_test); + + return cmd_ut_category("font", "font_test_", tests, n_ents, argc, argv); +} diff --git a/test/cmd_ut.c b/test/cmd_ut.c index 99e53dddc1..dc88c5fb88 100644 --- a/test/cmd_ut.c +++ b/test/cmd_ut.c @@ -49,6 +49,9 @@ static struct cmd_tbl cmd_ut_sub[] = { #ifdef CONFIG_CMD_FDT U_BOOT_CMD_MKENT(fdt, CONFIG_SYS_MAXARGS, 1, do_ut_fdt, "", ""), #endif +#ifdef CONFIG_CONSOLE_TRUETYPE + U_BOOT_CMD_MKENT(font, CONFIG_SYS_MAXARGS, 1, do_ut_font, "", ""), +#endif #ifdef CONFIG_UT_OPTEE U_BOOT_CMD_MKENT(optee, CONFIG_SYS_MAXARGS, 1, do_ut_optee, "", ""), #endif @@ -144,6 +147,9 @@ static char ut_help_text[] = #ifdef CONFIG_CMD_FDT "ut fdt [test-name] - test of the fdt command\n" #endif +#ifdef CONFIG_CONSOLE_TRUETYPE + "ut font [test-name] - test of the font command\n" +#endif #ifdef CONFIG_UT_LIB "ut lib [test-name] - test library functions\n" #endif diff --git a/test/dm/Makefile b/test/dm/Makefile index fd7d310e41..cc3cc454f7 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -69,7 +69,7 @@ obj-y += ofnode.o obj-y += ofread.o obj-y += of_extra.o obj-$(CONFIG_OSD) += osd.o -obj-$(CONFIG_DM_VIDEO) += panel.o +obj-$(CONFIG_VIDEO) += panel.o obj-$(CONFIG_EFI_PARTITION) += part.o obj-$(CONFIG_PCI) += pci.o obj-$(CONFIG_P2SB) += p2sb.o @@ -112,7 +112,7 @@ obj-$(CONFIG_TEE) += tee.o obj-$(CONFIG_TIMER) += timer.o obj-$(CONFIG_TPM_V2) += tpm.o obj-$(CONFIG_DM_USB) += usb.o -obj-$(CONFIG_DM_VIDEO) += video.o +obj-$(CONFIG_VIDEO) += video.o ifeq ($(CONFIG_VIRTIO_SANDBOX),y) obj-y += virtio.o obj-$(CONFIG_VIRTIO_RNG) += virtio_device.o |