Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Unified Diff: grit/node/misc_unittest.py

Issue 1212703002: grit: Ignore empty file paths when generating input file list (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: replace backslash in Win paths Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « grit/node/misc.py ('k') | grit/testdata/default_100_percent/a.png » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/node/misc_unittest.py
diff --git a/grit/node/misc_unittest.py b/grit/node/misc_unittest.py
index b353edb0b7a889271b8e0becf91d0e7f2483e342..569ec18d5049ee7b00c080a7fc26c548fe68f18d 100644
--- a/grit/node/misc_unittest.py
+++ b/grit/node/misc_unittest.py
@@ -53,6 +53,30 @@ class GritNodeUnittest(unittest.TestCase):
})
self.assertEqual({}, id_dict.get('devtools.grd', None))
+ # Verifies that GetInputFiles() returns the correct list of files
+ # corresponding to ChromeScaledImage nodes when assets are missing.
+ def testGetInputFilesChromeScaledImage(self):
+ xml = '''<?xml version="1.0" encoding="utf-8"?>
+ <grit latest_public_release="0" current_release="1">
+ <outputs>
+ <output filename="default.pak" type="data_package" context="default_100_percent" />
+ <output filename="special.pak" type="data_package" context="special_100_percent" fallback_to_default_layout="false" />
+ </outputs>
+ <release seq="1">
+ <structures fallback_to_low_resolution="true">
+ <structure type="chrome_scaled_image" name="IDR_A" file="a.png" />
+ <structure type="chrome_scaled_image" name="IDR_B" file="b.png" />
+ </structures>
+ </release>
+ </grit>'''
+
+ grd = grd_reader.Parse(StringIO.StringIO(xml), util.PathFromRoot('grit/testdata'))
+ expected = ['default_100_percent/a.png', 'default_100_percent/b.png', 'special_100_percent/a.png']
+ actual = [os.path.relpath(path, 'testdata') for path in grd.GetInputFiles()]
flackr 2015/06/26 23:10:32 This seems to be dependent on where you're running
tdanderson 2015/06/29 15:34:13 Done.
+ actual = [path.replace('\\', '/') for path in actual]
flackr 2015/06/26 23:10:32 nit: add comment that this is to convert windows p
tdanderson 2015/06/29 15:34:13 Done.
+ self.assertEquals(expected, actual)
+
+
class IfNodeUnittest(unittest.TestCase):
def testIffyness(self):
grd = grd_reader.Parse(StringIO.StringIO('''
« no previous file with comments | « grit/node/misc.py ('k') | grit/testdata/default_100_percent/a.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698