From 185109bada119646a9fc9b2cb574f7e7ee9bdab6 Mon Sep 17 00:00:00 2001 From: mattbasta Date: Fri, 18 Feb 2011 05:46:57 -0500 Subject: [PATCH] Added unlocalizable notice; bug 523912 --- tests/resources/l10n/localizable.xpi | Bin 0 -> 1305 bytes tests/test_l10n.py | 19 +++++++++++++++---- validator/testcases/l10ncompleteness.py | 12 +++++++++++- 3 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 tests/resources/l10n/localizable.xpi diff --git a/tests/resources/l10n/localizable.xpi b/tests/resources/l10n/localizable.xpi new file mode 100644 index 0000000000000000000000000000000000000000..b8fce56f504fa75193a786b1187068d0ff6b4903 GIT binary patch literal 1305 zcmbVM&2G~`5Dra2iaBuU1GwoCt=E6h+DcrIst73@qM&k(HqIt7ve(vn^HVAgeE{w} zKo8uIIP(UGcVc#JlWl21>PG9Go%z1m*~#pThVA`>mK-4(M?b%R`*jJjoX=p!OP*)c z$_Pv5v=nI`la!h;QpaWjG$v)}{GIuM@UX(-#$ti)5LXPWP}rE<;ehb}vI)n==ue!_ zAd&bH$EGfU}0syyA+}b zG2U!8*2c4PzQ9fp1lV@5>mqQ0$_pmQ7P0cEYjiq_71HbmG0Q(DX-X8^wQV2MOj3`! za8{>xM$4Edg@6!DGR;?_-(7JQ)}*iw7d3eWQU_Qx3&ll2Bew_MDzVWgvuH}-jxy(@ zD4bVnXEjm8d8Rl3tNhgWj~vUjJj++cMpq#i$!H`$lQl_KR3VhEGS7B5h%{LPYuftI zm{THh9@VRcZ7h}VCDc?w7W91lHUe3SlNC=jypE9hgmlC?6Fix&)B!tr;%GD-^KX{> zAeQ$amVZC%5FvAra5~7hCPH-@1>p-SUKd50#6*@5=x>yi+Cxg<-@c^riS60*V-&kK zLHe4M1T;AIPW(^1+EA&?6864&ACYI-mQ&T6rj_S`|BP&RxMT97;8mGu zdWpnZwaY80;{E#$vTYdhbBmz#Jq+(N8Vw)q9klOnNAS|sxW1Cht>&bY@9Gg1wbi=5 X`U;}fF-F73Po!}Vers4i@5|k95Qmwe literal 0 HcmV?d00001 diff --git a/tests/test_l10n.py b/tests/test_l10n.py index 2bed3cc..f9c5671 100644 --- a/tests/test_l10n.py +++ b/tests/test_l10n.py @@ -17,10 +17,21 @@ def test_unlocalizable(): "Test a package without localization data." l10n.LOCALE_CACHE = {} - _do_test("tests/resources/l10n/unlocalizable.xpi", - l10n.test_xpi, - failure=False, - set_type=PACKAGE_EXTENSION) + output = _do_test("tests/resources/l10n/unlocalizable.xpi", + l10n.test_xpi, + failure=False, + set_type=PACKAGE_EXTENSION) + assert output.notices # Should alert about lack of locales + +def test_localizable(): + "Tests a package with minimal localization data." + + l10n.LOCALE_CACHE = {} + output = _do_test("tests/resources/l10n/localizable.xpi", + l10n.test_xpi, + failure=False, + set_type=PACKAGE_EXTENSION) + assert not output.notices def test_missing(): "Test a package with missing localization entities." diff --git a/validator/testcases/l10ncompleteness.py b/validator/testcases/l10ncompleteness.py index d81b631..8eea0e9 100644 --- a/validator/testcases/l10ncompleteness.py +++ b/validator/testcases/l10ncompleteness.py @@ -103,7 +103,17 @@ def test_xpi(err, package_contents, xpi_package): locales = _get_locales(err, xpi_package); # We need at least a reference and a target. - if len(locales) < 2: + num_locales = len(locales) + if num_locales < 2: + if num_locales == 0: + err.notice(("testcases_l10ncompleteness", + "test_xpi", + "no_locales"), + "Add-on cannot be localized", + "In order to localize this add-on, at least one " + "'locale' entry needs to be present in the chrome." + "manifest file.", + filename="chrome.manifest") return # Use the first locale by default