aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass2016-01-14 18:10:50 -0700
committerAnatolij Gustschin2016-01-30 10:58:26 +0100
commit8df8dad528df027d5318020cc9f1d3c1ef231075 (patch)
tree139c6f095385cebacdfcdd8545b74c616f2c78ca
parent8de536c27c10bbbd7bd974b68718f3c788e4e8af (diff)
video: sandbox: Enable truetype fonts for sandbox
Enable this feature so that truetype fonts can be used on the sandbox console. Update the tests to select the normal/rotated console when needed. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Anatolij Gustschin <agust@denx.de>
-rw-r--r--configs/sandbox_defconfig2
-rw-r--r--test/dm/video.c21
2 files changed, 22 insertions, 1 deletions
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 2ebcba0a889..b5b81caaae8 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -78,6 +78,8 @@ CONFIG_USB_KEYBOARD=y
CONFIG_SYS_USB_EVENT_POLL=y
CONFIG_DM_VIDEO=y
CONFIG_CONSOLE_ROTATION=y
+CONFIG_CONSOLE_TRUETYPE=y
+CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y
CONFIG_VIDEO_SANDBOX_SDL=y
CONFIG_CMD_DHRYSTONE=y
CONFIG_TPM=y
diff --git a/test/dm/video.c b/test/dm/video.c
index 4e3f9d558f4..a7e44e06ebf 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -86,6 +86,20 @@ static void __maybe_unused see_output(void)
while (1);
}
+/* Select the video console driver to use for a video device */
+static int select_vidconsole(struct unit_test_state *uts, const char *drv_name)
+{
+ struct sandbox_sdl_plat *plat;
+ struct udevice *dev;
+
+ ut_assertok(uclass_find_device(UCLASS_VIDEO, 0, &dev));
+ ut_assert(!device_active(dev));
+ plat = dev_get_platdata(dev);
+ plat->vidconsole_drv_name = "vidconsole0";
+
+ return 0;
+}
+
/* Test text output works on the video console */
static int dm_test_video_text(struct unit_test_state *uts)
{
@@ -95,6 +109,7 @@ static int dm_test_video_text(struct unit_test_state *uts)
#define WHITE 0xffff
#define SCROLL_LINES 100
+ ut_assertok(select_vidconsole(uts, "vidconsole0"));
ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev));
ut_asserteq(46, compress_frame_buffer(dev));
@@ -127,6 +142,7 @@ static int dm_test_video_chars(struct unit_test_state *uts)
const char *test_string = "Well\b\b\b\bxhe is\r \n\ta very \amodest \bman\n\t\tand Has much to\b\bto be modest about.";
const char *s;
+ ut_assertok(select_vidconsole(uts, "vidconsole0"));
ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev));
ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
for (s = test_string; *s; s++)
@@ -185,7 +201,10 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot,
/* Test text output through the console uclass */
static int dm_test_video_context(struct unit_test_state *uts)
{
- return check_vidconsole_output(uts, 0, 788, 453);
+ ut_assertok(select_vidconsole(uts, "vidconsole0"));
+ ut_assertok(check_vidconsole_output(uts, 0, 788, 453));
+
+ return 0;
}
DM_TEST(dm_test_video_context, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);