grub2/0411-New-series-of-tests-for-gfxterm-and-gfxmenu.patch

892 lines
38 KiB
Diff
Raw Normal View History

2013-06-07 18:03:56 +00:00
From 5a030df7b1a5e9a15689be38a09c7ff37d874fbc Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Fri, 3 May 2013 14:09:55 +0200
Subject: [PATCH 411/471] New series of tests for gfxterm and gfxmenu.
---
ChangeLog | 4 +
grub-core/Makefile.core.def | 5 +
grub-core/tests/checksums.c | 108 ++++++++++---
grub-core/tests/fake_input.c | 2 +
grub-core/tests/gfxterm_menu.c | 113 ++++++++++++++
grub-core/tests/lib/functional_test.c | 3 +-
grub-core/tests/video_checksum.c | 204 ++++++++++++++++++++++++-
grub-core/tests/videotest_checksum.c | 279 +---------------------------------
include/grub/test.h | 5 +
tests/util/grub-shell.in | 3 +
10 files changed, 426 insertions(+), 300 deletions(-)
create mode 100644 grub-core/tests/gfxterm_menu.c
diff --git a/ChangeLog b/ChangeLog
index ed99c80..5fc7372 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2013-05-03 Vladimir Serbinenko <phcoder@gmail.com>
+ New series of tests for gfxterm and gfxmenu.
+
+2013-05-03 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/gfxmenu/gfxmenu.c (grub_gfxmenu_try): Allow specifying
the theme path relative to $prefix/themes.
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 2fa0ea7..da7637f 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -1747,6 +1747,11 @@ module = {
};
module = {
+ name = gfxterm_menu;
+ common = tests/gfxterm_menu.c;
+};
+
+module = {
name = bitmap;
common = video/bitmap.c;
enable = videomodules;
diff --git a/grub-core/tests/checksums.c b/grub-core/tests/checksums.c
index 583c696..c2d2f5a 100644
--- a/grub-core/tests/checksums.c
+++ b/grub-core/tests/checksums.c
@@ -1,30 +1,90 @@
+ { "gfxterm_menu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0xa14ad466, 0x69520db1, 0xa14ad466, 0xe82e990f, 0x59c36f00, }, 6 },
+ { "gfxterm_menu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0xa3faf149, 0xb4654ad0, 0xa3faf149, 0xff6942c6, 0xaa4593fe, }, 6 },
+ { "gfxterm_menu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xd5e4100a, 0x39522e26, 0xd5e4100a, 0x2e0276, 0xc9cbf769, }, 6 },
+ { "gfxterm_menu", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0xa14ad466, 0x69520db1, 0xa14ad466, 0xe82e990f, 0x59c36f00, }, 6 },
+ { "gfxterm_menu", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0xa3faf149, 0xb4654ad0, 0xa3faf149, 0xff6942c6, 0xaa4593fe, }, 6 },
+ { "gfxterm_menu", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0xd5e4100a, 0x39522e26, 0xd5e4100a, 0x2e0276, 0xc9cbf769, }, 6 },
+ { "gfxterm_menu", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0x9093f849, 0xc02929e3, 0x9093f849, 0xe2f077d4, 0x5387d57f, }, 6 },
+ { "gfxterm_menu", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xbbe054f6, 0xbef13bfe, 0xbbe054f6, 0xa23fcfe0, 0xf83ee7aa, }, 6 },
+ { "gfxterm_menu", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0x8cea8db2, 0x9688dd3b, 0x8cea8db2, 0x6fe82515, 0x724366e5, }, 6 },
+ { "gfxterm_menu", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0x25e346a1, 0xbd5eb38b, 0x25e346a1, 0x9d469431, 0x5387d57f, }, 6 },
+ { "gfxterm_menu", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x6f33e7a0, 0x5716dafe, 0x6f33e7a0, 0xbfa18d18, 0xf83ee7aa, }, 6 },
+ { "gfxterm_menu", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0xffb24323, 0x6e8fa0be, 0xffb24323, 0xad5c8fa5, 0x724366e5, }, 6 },
+ { "gfxterm_menu", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0x5a925b39, 0x36226b, 0x5a925b39, 0xafa322b7, 0x1c955882, }, 6 },
+ { "gfxterm_menu", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0xfb4aecf8, 0x17b91739, 0xfb4aecf8, 0xf7e3d211, 0x4d266f7a, }, 6 },
+ { "gfxterm_menu", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x4015c90f, 0x430ae98c, 0x4015c90f, 0xeb61f90d, 0x1ed9d731, }, 6 },
+ { "gfxterm_menu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x9813a416, 0x4df27666, 0xb8015ce1, 0x4df27666, 0x8bef2cac, 0x9813a416, }, 6 },
+ { "gfxterm_menu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x6d1d5058, 0xb2d8ed2c, 0x6d1d5058, 0xe8936168, 0x5fcf013d, }, 6 },
+ { "gfxterm_menu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xeec86af1, 0x13493ea, 0xeec86af1, 0xee83739a, 0xdd28f52b, }, 6 },
+ { "gfxterm_menu", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0x9093f849, 0xc02929e3, 0x9093f849, 0xe2f077d4, 0x5387d57f, }, 6 },
+ { "gfxterm_menu", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xbbe054f6, 0xbef13bfe, 0xbbe054f6, 0xa23fcfe0, 0xf83ee7aa, }, 6 },
+ { "gfxterm_menu", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x8cea8db2, 0x9688dd3b, 0x8cea8db2, 0x6fe82515, 0x724366e5, }, 6 },
+ { "gfxterm_menu", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0x25e346a1, 0xbd5eb38b, 0x25e346a1, 0x9d469431, 0x5387d57f, }, 6 },
+ { "gfxterm_menu", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x6f33e7a0, 0x5716dafe, 0x6f33e7a0, 0xbfa18d18, 0xf83ee7aa, }, 6 },
+ { "gfxterm_menu", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xffb24323, 0x6e8fa0be, 0xffb24323, 0xad5c8fa5, 0x724366e5, }, 6 },
+ { "gfxterm_menu", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0x5a925b39, 0x36226b, 0x5a925b39, 0xafa322b7, 0x1c955882, }, 6 },
+ { "gfxterm_menu", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0xfb4aecf8, 0x17b91739, 0xfb4aecf8, 0xf7e3d211, 0x4d266f7a, }, 6 },
+ { "gfxterm_menu", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x4015c90f, 0x430ae98c, 0x4015c90f, 0xeb61f90d, 0x1ed9d731, }, 6 },
+ { "gfxterm_menu", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x9813a416, 0x4df27666, 0xb8015ce1, 0x4df27666, 0x8bef2cac, 0x9813a416, }, 6 },
+ { "gfxterm_menu", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x5fcf013d, 0x6d1d5058, 0xb2d8ed2c, 0x6d1d5058, 0xe8936168, 0x5fcf013d, }, 6 },
+ { "gfxterm_menu", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xdd28f52b, 0xeec86af1, 0x13493ea, 0xeec86af1, 0xee83739a, 0xdd28f52b, }, 6 },
+ { "gfxmenu", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x59c36f00, 0x7a3f695f, 0xac449d41, 0x7a3f695f, 0x28a073b1, }, 5 },
+ { "gfxmenu", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xaa4593fe, 0x2ee70aea, 0x8f5328d2, 0x2ee70aea, 0x19fb9508, }, 5 },
+ { "gfxmenu", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xc9cbf769, 0xef842e14, 0x9b7cdc00, 0xef842e14, 0x750c3145, }, 5 },
+ { "gfxmenu", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x59c36f00, 0xcfa0e627, 0x8b7088da, 0xcfa0e627, 0xcd807142, }, 5 },
+ { "gfxmenu", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0xaa4593fe, 0x64807934, 0x85d684c9, 0x64807934, 0x61726a79, }, 5 },
+ { "gfxmenu", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xc9cbf769, 0x9792b643, 0x1d769dd8, 0x9386dd8c, 0x9792b643, 0x3d74bd2f, }, 6 },
+ { "gfxmenu", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x5387d57f, 0xbdb8f583, 0x1e27b76, 0xbdb8f583, 0x91be6e17, }, 5 },
+ { "gfxmenu", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0xbe72e1cb, 0x4943add3, 0xbe72e1cb, 0xa207f983, }, 5 },
+ { "gfxmenu", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0x724366e5, 0xbc064047, 0x9e12d9ac, 0xbc064047, 0xf9bdce43, }, 5 },
+ { "gfxmenu", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x5387d57f, 0x6181ad43, 0xe570d91, 0x6181ad43, 0x567fb1cc, }, 5 },
+ { "gfxmenu", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0x1e5b6982, 0x789f961c, 0x1e5b6982, 0xc1ad694a, }, 5 },
+ { "gfxmenu", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x724366e5, 0x73f85cef, 0x9469d68d, 0x73f85cef, 0x24779078, }, 5 },
+ { "gfxmenu", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x1c955882, 0xa6ddcb95, 0xa3934314, 0xa6ddcb95, 0x16ab9b6c, }, 5 },
+ { "gfxmenu", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x18e25ecc, 0xe52f7def, 0x18e25ecc, 0x5bd10081, }, 5 },
+ { "gfxmenu", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0x1ed9d731, 0xa845bba2, 0xb67fe791, 0xa845bba2, 0x80452493, }, 5 },
+ { "gfxmenu", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x1c3742c9, 0xf162dfa3, 0xe0f86fe6, 0xf162dfa3, 0x51f56384, }, 5 },
+ { "gfxmenu", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0xcc5a7bed, 0x644b801, 0x8a201b04, 0x644b801, 0xa4508ec0, }, 5 },
+ { "gfxmenu", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0xef4a3312, 0x1e1a41fe, 0x237e53c4, 0x1e1a41fe, 0xd5890062, }, 5 },
+ { "gfxmenu", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x5387d57f, 0xa35a45c5, 0xacbc8410, 0xa35a45c5, 0xed2e11bd, }, 5 },
+ { "gfxmenu", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0xf83ee7aa, 0x8a6fa170, 0x7605140e, 0x8a6fa170, 0xc030feb1, }, 5 },
+ { "gfxmenu", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0x724366e5, 0x49ddd3e4, 0xbfaeedf9, 0x49ddd3e4, 0xcde1d4b5, }, 5 },
+ { "gfxmenu", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0x5387d57f, 0x98a8e7a8, 0xd9cab55f, 0x98a8e7a8, 0xf2b7dd05, }, 5 },
+ { "gfxmenu", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0xf83ee7aa, 0xa000334f, 0xa1b11a86, 0xa000334f, 0x8ac1b99f, }, 5 },
+ { "gfxmenu", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x724366e5, 0xc662fb1, 0x673baf90, 0xc662fb1, 0xfb88406, }, 5 },
+ { "gfxmenu", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x1c955882, 0x33d4530e, 0x11ff262b, 0x33d4530e, 0xbb511beb, }, 5 },
+ { "gfxmenu", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x4d266f7a, 0x8b2e9364, 0x1d99d298, 0x8b2e9364, 0x958d5e8d, }, 5 },
+ { "gfxmenu", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0x1ed9d731, 0x6e78baae, 0xaedcda00, 0x6e78baae, 0x9399bef9, }, 5 },
+ { "gfxmenu", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x1c3742c9, 0x42860f9a, 0x57da9ef, 0x42860f9a, 0x221db42c, }, 5 },
+ { "gfxmenu", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0xcc5a7bed, 0x2ade7eff, 0xc91e0e0c, 0x2ade7eff, 0x8ad4bad6, }, 5 },
+ { "gfxmenu", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xef4a3312, 0x4c493c2d, 0x487c542b, 0x4c493c2d, 0xfec68cd6, }, 5 },
{ "videotest", 640, 480, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi16 */, (grub_uint32_t []) { 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, 0x7f1853ba, }, 5 },
{ "videotest", 800, 600, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi16 */, (grub_uint32_t []) { 0xff1957f0, 0xff1957f0, 0xff1957f0, 0xff1957f0, 0xff1957f0, }, 5 },
{ "videotest", 1024, 768, 0x2, 16, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi16 */, (grub_uint32_t []) { 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, 0xcb45d8c5, }, 5 },
{ "videotest", 640, 480, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 640x480xi256 */, (grub_uint32_t []) { 0x2d1b122b, 0x2d1b122b, 0x2d1b122b, 0x2d1b122b, 0x2d1b122b, }, 5 },
{ "videotest", 800, 600, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 800x600xi256 */, (grub_uint32_t []) { 0x327d1082, 0x327d1082, 0x327d1082, 0x327d1082, 0x327d1082, }, 5 },
{ "videotest", 1024, 768, 0x2, 256, 8, 1, 0, 0, 0, 0, 0, 0, 0, 0 /* 1024x768xi256 */, (grub_uint32_t []) { 0xadd0f186, 0xadd0f186, 0xadd0f186, 0xadd0f186, 0xadd0f186, }, 5 },
- { "videotest", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgb555 */, (grub_uint32_t []) { 0x2c97569c, 0x2c97569c, 0x2c97569c, 0x2c97569c, 0x2c97569c, }, 5 },
- { "videotest", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgb555 */, (grub_uint32_t []) { 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, }, 5 },
- { "videotest", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgb555 */, (grub_uint32_t []) { 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, }, 5 },
- { "videotest", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgb565 */, (grub_uint32_t []) { 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, }, 5 },
- { "videotest", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgb565 */, (grub_uint32_t []) { 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, }, 5 },
- { "videotest", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgb565 */, (grub_uint32_t []) { 0x66cee14c, 0x66cee14c, 0x66cee14c, 0x66cee14c, 0x66cee14c, }, 5 },
- { "videotest", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgb888 */, (grub_uint32_t []) { 0x61db45b7, 0x1d867efe, 0x99613325, 0xe53c086c, 0x9543de62, }, 5 },
- { "videotest", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgb888 */, (grub_uint32_t []) { 0xa46eb37f, 0xd2a59656, 0x49f8f92d, 0x3f33dc04, 0x7aae512a, }, 5 },
- { "videotest", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgb888 */, (grub_uint32_t []) { 0xb864a496, 0x6c22313b, 0x1505f93d, 0xc1436c90, 0xe74a6931, }, 5 },
- { "videotest", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgb888 */, (grub_uint32_t []) { 0x2b154617, 0x692e98df, 0xaf62fb87, 0xed59254f, 0x26164bc6, }, 5 },
- { "videotest", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgb888 */, (grub_uint32_t []) { 0x3b0fbc56, 0xd9d57c0e, 0xfb564a17, 0x198c8a4f, 0xbe502625, }, 5 },
- { "videotest", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgb888 */, (grub_uint32_t []) { 0x6e6c9b36, 0x4ae9f137, 0x27664f34, 0x3e32535, 0xfc793332, }, 5 },
- { "videotest", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgr555 */, (grub_uint32_t []) { 0x9056f776, 0x9056f776, 0x9056f776, 0x9056f776, 0x9056f776, }, 5 },
- { "videotest", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgr555 */, (grub_uint32_t []) { 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, }, 5 },
- { "videotest", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgr555 */, (grub_uint32_t []) { 0xb04615f3, 0xb04615f3, 0xb04615f3, 0xb04615f3, 0xb04615f3, }, 5 },
- { "videotest", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgr565 */, (grub_uint32_t []) { 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, }, 5 },
- { "videotest", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgr565 */, (grub_uint32_t []) { 0x84ac1329, 0x84ac1329, 0x84ac1329, 0x84ac1329, 0x84ac1329, }, 5 },
- { "videotest", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgr565 */, (grub_uint32_t []) { 0x145ad698, 0x145ad698, 0x145ad698, 0x145ad698, 0x145ad698, }, 5 },
- { "videotest", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgr888 */, (grub_uint32_t []) { 0x4af6b480, 0x923db79c, 0xfe8cc449, 0x2647c755, 0x27ee23e3, }, 5 },
- { "videotest", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgr888 */, (grub_uint32_t []) { 0x121d5e29, 0xf66c0aed, 0xdf138150, 0x3b62d594, 0x8dec962a, }, 5 },
- { "videotest", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgr888 */, (grub_uint32_t []) { 0xae86a12c, 0x4dabbe89, 0x6d30e897, 0x8e1df732, 0x2c0644ab, }, 5 },
- { "videotest", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgr888 */, (grub_uint32_t []) { 0x2605d280, 0xc06e3172, 0xef3e6395, 0x9558067, 0xb19ec65b, }, 5 },
- { "videotest", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgr888 */, (grub_uint32_t []) { 0x9404ef3b, 0xa4fdf18, 0xad7ef98c, 0x3335c9af, 0xe6f0c255, }, 5 },
- { "videotest", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgr888 */, (grub_uint32_t []) { 0xa008b770, 0xb98eb0d8, 0x9304b820, 0x8a82bf88, 0xc610a9d0, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 640x480xrgba5550 */, (grub_uint32_t []) { 0x2c97569c, 0x2c97569c, 0x2c97569c, 0x2c97569c, 0x2c97569c, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 800x600xrgba5550 */, (grub_uint32_t []) { 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, 0x9bd7a3ac, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 15, 2, 10, 5, 5, 5, 0, 5, 0, 0 /* 1024x768xrgba5550 */, (grub_uint32_t []) { 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, 0xedbceb9c, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 640x480xrgba5650 */, (grub_uint32_t []) { 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, 0x3c2a42f1, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 800x600xrgba5650 */, (grub_uint32_t []) { 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, 0xb25ce62a, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 16, 2, 11, 5, 5, 6, 0, 5, 0, 0 /* 1024x768xrgba5650 */, (grub_uint32_t []) { 0x66cee14c, 0x66cee14c, 0x66cee14c, 0x66cee14c, 0x66cee14c, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 640x480xrgba8880 */, (grub_uint32_t []) { 0x61db45b7, 0x1d867efe, 0x99613325, 0xe53c086c, 0x9543de62, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 800x600xrgba8880 */, (grub_uint32_t []) { 0xa46eb37f, 0xd2a59656, 0x49f8f92d, 0x3f33dc04, 0x7aae512a, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 24, 3, 16, 8, 8, 8, 0, 8, 0, 0 /* 1024x768xrgba8880 */, (grub_uint32_t []) { 0xb864a496, 0x6c22313b, 0x1505f93d, 0xc1436c90, 0xe74a6931, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 640x480xrgba8888 */, (grub_uint32_t []) { 0x2b154617, 0x692e98df, 0xaf62fb87, 0xed59254f, 0x26164bc6, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 800x600xrgba8888 */, (grub_uint32_t []) { 0x3b0fbc56, 0xd9d57c0e, 0xfb564a17, 0x198c8a4f, 0xbe502625, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 32, 4, 16, 8, 8, 8, 0, 8, 24, 8 /* 1024x768xrgba8888 */, (grub_uint32_t []) { 0x6e6c9b36, 0x4ae9f137, 0x27664f34, 0x3e32535, 0xfc793332, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 640x480xbgra5550 */, (grub_uint32_t []) { 0x9056f776, 0x9056f776, 0x9056f776, 0x9056f776, 0x9056f776, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 800x600xbgra5550 */, (grub_uint32_t []) { 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, 0x2bde3c67, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 15, 2, 0, 5, 5, 5, 10, 5, 0, 0 /* 1024x768xbgra5550 */, (grub_uint32_t []) { 0xb04615f3, 0xb04615f3, 0xb04615f3, 0xb04615f3, 0xb04615f3, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 640x480xbgra5650 */, (grub_uint32_t []) { 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, 0xba8df8dd, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 800x600xbgra5650 */, (grub_uint32_t []) { 0x84ac1329, 0x84ac1329, 0x84ac1329, 0x84ac1329, 0x84ac1329, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 16, 2, 0, 5, 5, 6, 11, 5, 0, 0 /* 1024x768xbgra5650 */, (grub_uint32_t []) { 0x145ad698, 0x145ad698, 0x145ad698, 0x145ad698, 0x145ad698, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 640x480xbgra8880 */, (grub_uint32_t []) { 0x4af6b480, 0x923db79c, 0xfe8cc449, 0x2647c755, 0x27ee23e3, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 800x600xbgra8880 */, (grub_uint32_t []) { 0x121d5e29, 0xf66c0aed, 0xdf138150, 0x3b62d594, 0x8dec962a, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 24, 3, 0, 8, 8, 8, 16, 8, 0, 0 /* 1024x768xbgra8880 */, (grub_uint32_t []) { 0xae86a12c, 0x4dabbe89, 0x6d30e897, 0x8e1df732, 0x2c0644ab, }, 5 },
+ { "videotest", 640, 480, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 640x480xbgra8888 */, (grub_uint32_t []) { 0x2605d280, 0xc06e3172, 0xef3e6395, 0x9558067, 0xb19ec65b, }, 5 },
+ { "videotest", 800, 600, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 800x600xbgra8888 */, (grub_uint32_t []) { 0x9404ef3b, 0xa4fdf18, 0xad7ef98c, 0x3335c9af, 0xe6f0c255, }, 5 },
+ { "videotest", 1024, 768, 0x1, 256, 32, 4, 0, 8, 8, 8, 16, 8, 24, 8 /* 1024x768xbgra8888 */, (grub_uint32_t []) { 0xa008b770, 0xb98eb0d8, 0x9304b820, 0x8a82bf88, 0xc610a9d0, }, 5 },
diff --git a/grub-core/tests/fake_input.c b/grub-core/tests/fake_input.c
index b514c2a..3c24e0f 100644
--- a/grub-core/tests/fake_input.c
+++ b/grub-core/tests/fake_input.c
@@ -55,6 +55,7 @@ grub_terminal_input_fake_sequence (int *seq_in, int nseq_in)
grub_memcpy (seq, seq_in, nseq_in * sizeof (seq[0]));
}
nseq = nseq_in;
+ seqptr = 0;
}
void
@@ -64,4 +65,5 @@ grub_terminal_input_fake_sequence_end (void)
grub_free (seq);
seq = 0;
nseq = 0;
+ seqptr = 0;
}
diff --git a/grub-core/tests/gfxterm_menu.c b/grub-core/tests/gfxterm_menu.c
new file mode 100644
index 0000000..e4aae12
--- /dev/null
+++ b/grub-core/tests/gfxterm_menu.c
@@ -0,0 +1,113 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2013 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* All tests need to include test.h for GRUB testing framework. */
+#include <grub/test.h>
+#include <grub/dl.h>
+#include <grub/video.h>
+#include <grub/video_fb.h>
+#include <grub/command.h>
+#include <grub/font.h>
+#include <grub/procfs.h>
+#include <grub/env.h>
+#include <grub/normal.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+
+static const char testfile[] =
+ "terminal_output gfxterm\n"
+ "menuentry \"test\" {\n"
+ "\ttrue\n"
+ "}\n"
+ "menuentry \"s̛ ơ t o̒ s̒ u o̕̚ 8.04 m̂ñåh̊z̆x̣ a̡ b̢g̢ u᷎ô᷎ ô᷎ O̷ a̖̣ ȃ̐\" --class ubuntu --class linux --class os {\n"
+ "\ttrue\n"
+ "}\n"
+ "menuentry \" הַרמלל(טוֹבָ) לֶךְ\" --class opensuse --class linux --class os {\n"
+ "\ttrue\n"
+ "}\n"
+ "menuentry \"الرملل جِداً لِكَ\" --class gentoo --class linux --class os {\n"
+ "\ttrue\n"
+ "}\n"
+ "menuentry \"ὑπόγυͅον\" --class kubuntu --class linux --class os {\n"
+ "\ttrue\n"
+ "}\n"
+ "menuentry \"سَّ نِّ نَّ نٌّ نّْ\" --class linuxmint --class linux --class os {\n"
+ "\ttrue\n"
+ "}\n"
+ /* Chinese & UTF-8 test from Carbon Jiao. */
+ "menuentry \"从硬盘的第一主分区启动\" --class \"windows xp\" --class windows --class os {\n"
+ "\ttrue\n"
+ "}\n"
+ "timeout=3\n";
+
+static char *
+get_test_cfg (void)
+{
+ return grub_strdup (testfile);
+}
+
+struct grub_procfs_entry test_cfg =
+{
+ .name = "test.cfg",
+ .get_contents = get_test_cfg
+};
+
+
+/* Functional test main method. */
+static void
+gfxterm_menu (void)
+{
+ unsigned i, j;
+ if (grub_font_load ("unicode") == 0)
+ {
+ grub_test_assert (0, "unicode font not found: %s", grub_errmsg);
+ return;
+ }
+
+ grub_procfs_register ("test.cfg", &test_cfg);
+
+ for (j = 0; j < 2; j++)
+ for (i = 0; i < ARRAY_SIZE (grub_test_video_modes); i++)
+ {
+ grub_video_capture_start (&grub_test_video_modes[i],
+ grub_video_fbstd_colors,
+ grub_test_video_modes[i].number_of_colors);
+ grub_terminal_input_fake_sequence ((int []) { -1, -1, -1, GRUB_TERM_KEY_DOWN, -1, '\e' }, 6);
+
+ grub_video_checksum (j ? "gfxmenu" : "gfxterm_menu");
+
+ grub_env_context_open ();
+ if (j)
+ grub_env_set ("theme", "starfield/theme.txt");
+ grub_normal_execute ("(proc)/test.cfg", 1, 0);
+ grub_env_context_close ();
+
+ char *args[] = { (char *) "console", 0 };
+ grub_command_execute ("terminal_output", 1, args);
+
+ grub_terminal_input_fake_sequence_end ();
+ grub_video_checksum_end ();
+ grub_video_capture_end ();
+ }
+
+ grub_procfs_unregister (&test_cfg);
+}
+
+/* Register example_test method as a functional test. */
+GRUB_FUNCTIONAL_TEST (gfxterm_menu, gfxterm_menu);
diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c
index da4d5f8..c70e1ad 100644
--- a/grub-core/tests/lib/functional_test.c
+++ b/grub-core/tests/lib/functional_test.c
@@ -51,9 +51,10 @@ grub_functional_all_tests (grub_extcmd_context_t ctxt __attribute__ ((unused)),
grub_dl_load ("exfctest");
grub_dl_load ("videotest_checksum");
+ grub_dl_load ("gfxterm_menu");
FOR_LIST_ELEMENTS (test, grub_test_list)
- ok = ok && !grub_test_run (test);
+ ok = !grub_test_run (test) && ok;
if (ok)
grub_printf ("ALL TESTS PASSED\n");
else
diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c
index cf47fa2..c678059 100644
--- a/grub-core/tests/video_checksum.c
+++ b/grub-core/tests/video_checksum.c
@@ -31,6 +31,208 @@ static char *basename;
static const grub_uint32_t *checksums;
static struct grub_video_mode_info capt_mode_info;
+struct grub_video_mode_info grub_test_video_modes[30] = {
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 640,
+ .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
+ .bpp = 8,
+ .bytes_per_pixel = 1,
+ .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 800,
+ .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
+ .bpp = 8,
+ .bytes_per_pixel = 1,
+ .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 1024,
+ .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
+ .bpp = 8,
+ .bytes_per_pixel = 1,
+ .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 640,
+ .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
+ .bpp = 8,
+ .bytes_per_pixel = 1,
+ .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 800,
+ .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
+ .bpp = 8,
+ .bytes_per_pixel = 1,
+ .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 1024,
+ .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
+ .bpp = 8,
+ .bytes_per_pixel = 1,
+ .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 1280,
+ GRUB_VIDEO_MI_RGB555 ()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 1600,
+ GRUB_VIDEO_MI_RGB555 ()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 2048,
+ GRUB_VIDEO_MI_RGB555 ()
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 1280,
+ GRUB_VIDEO_MI_RGB565 ()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 1600,
+ GRUB_VIDEO_MI_RGB565 ()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 2048,
+ GRUB_VIDEO_MI_RGB565 ()
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 640 * 3,
+ GRUB_VIDEO_MI_RGB888 ()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 800 * 3,
+ GRUB_VIDEO_MI_RGB888 ()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 1024 * 3,
+ GRUB_VIDEO_MI_RGB888 ()
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 640 * 4,
+ GRUB_VIDEO_MI_RGBA8888()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 800 * 4,
+ GRUB_VIDEO_MI_RGBA8888()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 1024 * 4,
+ GRUB_VIDEO_MI_RGBA8888()
+ },
+
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 1280,
+ GRUB_VIDEO_MI_BGR555 ()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 1600,
+ GRUB_VIDEO_MI_BGR555 ()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 2048,
+ GRUB_VIDEO_MI_BGR555 ()
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 1280,
+ GRUB_VIDEO_MI_BGR565 ()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 1600,
+ GRUB_VIDEO_MI_BGR565 ()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 2048,
+ GRUB_VIDEO_MI_BGR565 ()
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 640 * 3,
+ GRUB_VIDEO_MI_BGR888 ()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 800 * 3,
+ GRUB_VIDEO_MI_BGR888 ()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 1024 * 3,
+ GRUB_VIDEO_MI_BGR888 ()
+ },
+ {
+ .width = 640,
+ .height = 480,
+ .pitch = 640 * 4,
+ GRUB_VIDEO_MI_BGRA8888()
+ },
+ {
+ .width = 800,
+ .height = 600,
+ .pitch = 800 * 4,
+ GRUB_VIDEO_MI_BGRA8888()
+ },
+ {
+ .width = 1024,
+ .height = 768,
+ .pitch = 1024 * 4,
+ GRUB_VIDEO_MI_BGRA8888()
+ },
+};
+
#ifdef GRUB_MACHINE_EMU
#include <grub/emu/misc.h>
#include <sys/types.h>
@@ -262,7 +464,7 @@ get_modename (void)
return buf;
}
-//#define GENERATE_MODE 1
+#define GENERATE_MODE 1
#if defined (GENERATE_MODE) && defined (GRUB_MACHINE_EMU)
int genfd = -1;
diff --git a/grub-core/tests/videotest_checksum.c b/grub-core/tests/videotest_checksum.c
index 7833d04..ee7058f 100644
--- a/grub-core/tests/videotest_checksum.c
+++ b/grub-core/tests/videotest_checksum.c
@@ -26,292 +26,23 @@
GRUB_MOD_LICENSE ("GPLv3+");
-struct
-{
- struct grub_video_mode_info mode_info;
-} tests[] = {
- {
- .mode_info = {
- .width = 640,
- .height = 480,
- .pitch = 640,
- .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
- .bpp = 8,
- .bytes_per_pixel = 1,
- .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS
- },
- },
- {
- .mode_info = {
- .width = 800,
- .height = 600,
- .pitch = 800,
- .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
- .bpp = 8,
- .bytes_per_pixel = 1,
- .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS
- },
- },
- {
- .mode_info = {
- .width = 1024,
- .height = 768,
- .pitch = 1024,
- .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
- .bpp = 8,
- .bytes_per_pixel = 1,
- .number_of_colors = GRUB_VIDEO_FBSTD_NUMCOLORS
- },
- },
-
-
- {
- .mode_info = {
- .width = 640,
- .height = 480,
- .pitch = 640,
- .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
- .bpp = 8,
- .bytes_per_pixel = 1,
- .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS
- },
- },
- {
- .mode_info = {
- .width = 800,
- .height = 600,
- .pitch = 800,
- .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
- .bpp = 8,
- .bytes_per_pixel = 1,
- .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS
- },
- },
- {
- .mode_info = {
- .width = 1024,
- .height = 768,
- .pitch = 1024,
- .mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR,
- .bpp = 8,
- .bytes_per_pixel = 1,
- .number_of_colors = GRUB_VIDEO_FBSTD_EXT_NUMCOLORS
- },
- },
-
- {
- .mode_info = {
- .width = 640,
- .height = 480,
- .pitch = 1280,
- GRUB_VIDEO_MI_RGB555 ()
- },
- },
- {
- .mode_info = {
- .width = 800,
- .height = 600,
- .pitch = 1600,
- GRUB_VIDEO_MI_RGB555 ()
- },
- },
- {
- .mode_info = {
- .width = 1024,
- .height = 768,
- .pitch = 2048,
- GRUB_VIDEO_MI_RGB555 ()
- },
- },
- {
- .mode_info = {
- .width = 640,
- .height = 480,
- .pitch = 1280,
- GRUB_VIDEO_MI_RGB565 ()
- },
- },
- {
- .mode_info = {
- .width = 800,
- .height = 600,
- .pitch = 1600,
- GRUB_VIDEO_MI_RGB565 ()
- },
- },
- {
- .mode_info = {
- .width = 1024,
- .height = 768,
- .pitch = 2048,
- GRUB_VIDEO_MI_RGB565 ()
- },
- },
- {
- .mode_info = {
- .width = 640,
- .height = 480,
- .pitch = 640 * 3,
- GRUB_VIDEO_MI_RGB888 ()
- },
- },
- {
- .mode_info = {
- .width = 800,
- .height = 600,
- .pitch = 800 * 3,
- GRUB_VIDEO_MI_RGB888 ()
- },
- },
- {
- .mode_info = {
- .width = 1024,
- .height = 768,
- .pitch = 1024 * 3,
- GRUB_VIDEO_MI_RGB888 ()
- },
- },
- {
- .mode_info = {
- .width = 640,
- .height = 480,
- .pitch = 640 * 4,
- GRUB_VIDEO_MI_RGBA8888()
- },
- },
- {
- .mode_info = {
- .width = 800,
- .height = 600,
- .pitch = 800 * 4,
- GRUB_VIDEO_MI_RGBA8888()
- },
- },
- {
- .mode_info = {
- .width = 1024,
- .height = 768,
- .pitch = 1024 * 4,
- GRUB_VIDEO_MI_RGBA8888()
- },
- },
-
- {
- .mode_info = {
- .width = 640,
- .height = 480,
- .pitch = 1280,
- GRUB_VIDEO_MI_BGR555 ()
- },
- },
- {
- .mode_info = {
- .width = 800,
- .height = 600,
- .pitch = 1600,
- GRUB_VIDEO_MI_BGR555 ()
- },
- },
- {
- .mode_info = {
- .width = 1024,
- .height = 768,
- .pitch = 2048,
- GRUB_VIDEO_MI_BGR555 ()
- },
- },
- {
- .mode_info = {
- .width = 640,
- .height = 480,
- .pitch = 1280,
- GRUB_VIDEO_MI_BGR565 ()
- },
- },
- {
- .mode_info = {
- .width = 800,
- .height = 600,
- .pitch = 1600,
- GRUB_VIDEO_MI_BGR565 ()
- },
- },
- {
- .mode_info = {
- .width = 1024,
- .height = 768,
- .pitch = 2048,
- GRUB_VIDEO_MI_BGR565 ()
- },
- },
- {
- .mode_info = {
- .width = 640,
- .height = 480,
- .pitch = 640 * 3,
- GRUB_VIDEO_MI_BGR888 ()
- },
- },
- {
- .mode_info = {
- .width = 800,
- .height = 600,
- .pitch = 800 * 3,
- GRUB_VIDEO_MI_BGR888 ()
- },
- },
- {
- .mode_info = {
- .width = 1024,
- .height = 768,
- .pitch = 1024 * 3,
- GRUB_VIDEO_MI_BGR888 ()
- },
- },
- {
- .mode_info = {
- .width = 640,
- .height = 480,
- .pitch = 640 * 4,
- GRUB_VIDEO_MI_BGRA8888()
- },
- },
- {
- .mode_info = {
- .width = 800,
- .height = 600,
- .pitch = 800 * 4,
- GRUB_VIDEO_MI_BGRA8888()
- },
- },
- {
- .mode_info = {
- .width = 1024,
- .height = 768,
- .pitch = 1024 * 4,
- GRUB_VIDEO_MI_BGRA8888()
- },
- },
-
- };
-
-
/* Functional test main method. */
static void
videotest_checksum (void)
{
unsigned i;
+
if (grub_font_load ("unicode") == 0)
{
grub_test_assert (0, "unicode font not found: %s", grub_errmsg);
return;
}
-
- for (i = 0; i < ARRAY_SIZE (tests); i++)
+
+ for (i = 0; i < ARRAY_SIZE (grub_test_video_modes); i++)
{
- grub_video_capture_start (&tests[i].mode_info,
+ grub_video_capture_start (&grub_test_video_modes[i],
grub_video_fbstd_colors,
- tests[i].mode_info.number_of_colors);
+ grub_test_video_modes[i].number_of_colors);
grub_terminal_input_fake_sequence ((int []) { '\n' }, 1);
grub_video_checksum ("videotest");
diff --git a/include/grub/test.h b/include/grub/test.h
index 6aa4069..946a81b 100644
--- a/include/grub/test.h
+++ b/include/grub/test.h
@@ -25,6 +25,9 @@
#include <grub/types.h>
#include <grub/symbol.h>
+#include <grub/video.h>
+#include <grub/video_fb.h>
+
struct grub_test
{
/* The next test. */
@@ -99,4 +102,6 @@ grub_terminal_input_fake_sequence (int *seq_in, int nseq_in);
void
grub_terminal_input_fake_sequence_end (void);
+extern struct grub_video_mode_info grub_test_video_modes[30];
+
#endif /* ! GRUB_TEST_HEADER */
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index dfde836..dee3962 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -22,6 +22,7 @@ prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
builddir="@builddir@"
+srcdir="@srcdir@"
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
@@ -409,7 +410,9 @@ if [ x$boot = xnet ]; then
elif [ x$boot = xemu ]; then
grubdir="$(mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")"
mkdir -p "$grubdir/fonts"
+ mkdir -p "$grubdir/themes"
cp "@builddir@/"unicode.pf2 "$grubdir/fonts/unicode.pf2"
+ cp -R "@srcdir@/themes/starfield" "$grubdir/themes/starfield"
cp "${cfgfile}" "$grubdir/grub.cfg"
cp "${source}" "$grubdir/testcase.cfg"
@builddir@/grub-core/grub-emu -m "$device_map" -d "$grubdir" | tr -d "\r" | do_trim
--
1.8.2.1