Added unlocalizable notice; bug 523912

This commit is contained in:
mattbasta 2011-02-18 05:46:57 -05:00
Родитель 17031fad54
Коммит 185109bada
3 изменённых файлов: 26 добавлений и 5 удалений

Двоичные данные
tests/resources/l10n/localizable.xpi Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -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."

Просмотреть файл

@ -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