Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add icon warnings and whatever (bug 905356)

  • Loading branch information...
commit 4de749c89ab75b2fb18164c4bebb943535ce5e78 1 parent e24a023
@mattbasta authored
View
30 appvalidator/specs/webapps.py
@@ -19,6 +19,8 @@
_FULL_PERMISSIONS = ("readonly", "readwrite", "readcreate", "createonly")
+FXOS_ICON_SIZES = (60, 90, 120)
+
class WebappSpec(Spec):
"""This object parses and subsequently validates webapp manifest files."""
@@ -329,14 +331,26 @@ def process_icons(self, node):
description="An icon with a minimum size of 128x128 must "
"be provided by each app.")
- if "60" not in node:
- self.warning(
- err_id=("spec", "webapp", "fxos_icon"),
- warning="60x60px icon should be provided for Firefox OS.",
- description=["An icon of size 60x60 should be provided "
- "for the app. Firefox OS will look for this "
- "icon size before any other.",
- STYLEGUIDE_URL + "icons/"])
+ for size in FXOS_ICON_SIZES:
+ if str(size) not in node:
+ size_str = "%sx%s" % (size, size)
+ self.warning(
+ err_id=("spec", "webapp", "fxos_icon"),
+ warning="%spx icon should be provided for Firefox OS." %
+ size_str,
+ description=["An icon of size %s should be provided "
+ "for the app. Firefox OS will look for this "
+ "icon size before any other." % size_str,
+ STYLEGUIDE_URL + "icons/"])
+
+ if "32" not in node or "256" not in node:
+ self.notice(
+ err_id=("spec", "webapp", "other_sizes"),
+ notice="Suggested icon sizes not included.",
+ description="It is recommended that you include icons of "
+ "size 32x32 and 256x256 for your app. This will "
+ "allow it to display without scaling on most "
+ "operating systems.")
def process_dev_url(self, node):
if not self._path_valid(node, can_have_protocol=True):
View
BIN  tests/resources/packaged_app.zip
Binary file not shown
View
6 tests/resources/testwebapp.webapp
@@ -4,9 +4,13 @@
"version":"1.0",
"icons":{
"16":"http://testmanifest.com/icon-16.png",
+ "32":"http://testmanifest.com/icon-32.png",
"48":"http://testmanifest.com/icon-48.png",
"60":"http://testmanifest.com/icon-60.png",
- "128":"http://testmanifest.com/icon-128.png"
+ "90":"http://testmanifest.com/icon-90.png",
+ "120":"http://testmanifest.com/icon-120.png",
+ "128":"http://testmanifest.com/icon-128.png",
+ "256":"http://testmanifest.com/icon-256.png"
},
"installs_allowed_from":[
"*"
View
12 tests/test_webapp.py
@@ -57,9 +57,13 @@ def setUp(self):
"description": descr,
"icons": {
"16": "/img/icon-16.png",
+ "32": "/img/icon-32.png",
"48": "/img/icon-48.png",
"60": "/img/icon-60.png",
- "128": "/img/icon-128.png"
+ "90": "/img/icon-90.png",
+ "120": "/img/icon-120.png",
+ "128": "/img/icon-128.png",
+ "256": "/img/icon-256.png",
},
"developer": {
"name": "Mozilla Labs",
@@ -246,9 +250,15 @@ def test_icons_has_min_listed(self):
self.data["installs_allowed_from"] = \
appvalidator.constants.DEFAULT_WEBAPP_MRKT_URLS
del self.data["icons"]["128"]
+ del self.data["icons"]["256"]
self.analyze()
self.assert_failed(with_errors=True)
+ def test_icons_has_os_sizes(self):
+ del self.data["icons"]["256"]
+ self.analyze()
+ self.assert_notices()
+
def test_no_locales(self):
"""Test that locales are not required."""
del self.data["locales"]
Please sign in to comment.
Something went wrong with that request. Please try again.