summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2011-02-17 11:29:51 -0800
committerBill Richardson <wfrichar@chromium.org>2011-02-17 11:29:51 -0800
commitf456e83dfd12310f146fdbedde5888a6e6293c9b (patch)
tree46690be733642339ff8cca4751f7bd2191e108d1
parentc80fe65f9e42aba26077fc93ce43ae6c02b9eb67 (diff)
downloadvboot-f456e83dfd12310f146fdbedde5888a6e6293c9b.tar.gz
Correctly handle reuse of screens in yaml file.
BUG=chromium-os:12161 TEST=manual cd src/platform/vboot_reference make make runbmptests Change-Id: Ic7708474ce7009744c9f12154d1967bdae8e55d2 Review URL: http://codereview.chromium.org/6534025
-rwxr-xr-xtests/bitmaps/TestBmpBlock.py23
-rw-r--r--tests/bitmaps/case_reuse.yaml28
-rw-r--r--utility/bmpblk_utility.cc3
3 files changed, 53 insertions, 1 deletions
diff --git a/tests/bitmaps/TestBmpBlock.py b/tests/bitmaps/TestBmpBlock.py
index 678fe319..265bd24d 100755
--- a/tests/bitmaps/TestBmpBlock.py
+++ b/tests/bitmaps/TestBmpBlock.py
@@ -134,6 +134,29 @@ class TestReproducable(unittest.TestCase):
rc, out, err = runprog('/bin/rm', '-f', 'ORDER1', 'ORDER2')
self.assertEqual(0, rc)
+class TestReuse(unittest.TestCase):
+
+ def setUp(self):
+ rc, out, err = runprog('/bin/rm', '-rf', './FOO_DIR', 'FOO')
+ self.assertEqual(0, rc)
+
+ def testReuse(self):
+ """Reusing screens in the yaml file should be okay"""
+ rc, out, err = runprog(prog, '-c', 'case_reuse.yaml', 'FOO')
+ self.assertEqual(0, rc)
+ rc, out, err = runprog(prog, '-x', '-d', './FOO_DIR', 'FOO')
+ self.assertEqual(0, rc)
+ os.chdir('./FOO_DIR')
+ rc, out, err = runprog(prog, '-c', 'config.yaml', 'BAR')
+ self.assertEqual(0, rc)
+ rc, out, err = runprog('/usr/bin/cmp', '../FOO', 'BAR')
+ self.assertEqual(0, rc)
+ os.chdir('..')
+
+ def tearDown(self):
+ rc, out, err = runprog('/bin/rm', '-rf', './FOO_DIR', 'FOO')
+ self.assertEqual(0, rc)
+
# Run these tests
if __name__ == '__main__':
diff --git a/tests/bitmaps/case_reuse.yaml b/tests/bitmaps/case_reuse.yaml
new file mode 100644
index 00000000..4f62d569
--- /dev/null
+++ b/tests/bitmaps/case_reuse.yaml
@@ -0,0 +1,28 @@
+
+bmpblock: 1.0
+
+images:
+ image0: Background.bmp
+ image1: Word.bmp
+
+screens:
+ scr_a0:
+ - [0, 0, image0]
+
+ scr_b0:
+ - [0, 0, image0]
+
+ scr_c0:
+ - [0, 0, image0]
+
+ scr_d0:
+ - [0, 0, image0]
+
+ scr_z:
+ - [45, 45, image1 ]
+
+localizations:
+ - [ scr_a0, scr_b0, scr_c0, scr_d0 ]
+ - [ scr_a0, scr_b0, scr_c0, scr_z ]
+
+
diff --git a/utility/bmpblk_utility.cc b/utility/bmpblk_utility.cc
index 742bd9bc..8605dde0 100644
--- a/utility/bmpblk_utility.cc
+++ b/utility/bmpblk_utility.cc
@@ -476,7 +476,8 @@ void BmpBlockUtil::pack_bmpblock() {
/* Compute the ImageInfo offsets from start of BMPBLOCK. */
uint32_t current_offset = sizeof(BmpBlockHeader) +
- sizeof(ScreenLayout) * config_.screens_map.size();
+ sizeof(ScreenLayout) * (config_.header.number_of_localizations *
+ config_.header.number_of_screenlayouts);
for (unsigned int i = 0; i < config_.image_names.size(); ++i) {
string image_name = config_.image_names[i];
ImageConfig &img = config_.images_map[image_name];