return 0;
}
DM_TEST(dm_test_video_damage, UTF_SCAN_PDATA | UTF_SCAN_FDT);
+
+/* Test font measurement */
+static int dm_test_font_measure(struct unit_test_state *uts)
+{
+ const char *test_string = "There is always much to be said for not "
+ "attempting more than you can do and for making a certainty of "
+ "what you try. But this principle, like others in life and "
+ "war, has its exceptions.";
+ struct vidconsole_bbox bbox;
+ struct video_priv *priv;
+ struct udevice *dev, *con;
+
+ ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev));
+ priv = dev_get_uclass_priv(dev);
+ ut_asserteq(1366, priv->xsize);
+ ut_asserteq(768, priv->ysize);
+
+ /* this is using the Nimbus font with size of 18 pixels */
+ ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
+ vidconsole_position_cursor(con, 0, 0);
+ ut_assertok(vidconsole_measure(con, NULL, 0, test_string, &bbox));
+ ut_asserteq(0, bbox.x0);
+ ut_asserteq(0, bbox.y0);
+ ut_asserteq(0x47a, bbox.x1);
+ ut_asserteq(0x12, bbox.y1);
+
+ return 0;
+}
+DM_TEST(dm_test_font_measure, UTF_SCAN_FDT);