mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 00:21:46 +00:00
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
This commit is contained in:
@@ -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__':
|
||||
|
||||
28
tests/bitmaps/case_reuse.yaml
Normal file
28
tests/bitmaps/case_reuse.yaml
Normal file
@@ -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 ]
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user