Skip to content

Commit

Permalink
Add support for new environment attribute for screenshots
Browse files Browse the repository at this point in the history
... and remove support for custom x-kde-os attribute for screenshots

appstream now officially supports an environment attribute for screenshots.
  • Loading branch information
ingokloecker authored and PhuNH committed Oct 4, 2023
1 parent ccf85f7 commit 1697240
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions py_appstream/subcomponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,12 @@ def __init__(self):
self.caption = {}
self.thumbnails = []
self.source = None
self.os = ''
self.environment = ''

def parse_tree(self, node, lang_code_func=None):
""" Parse a <screenshot> object """
self.default = node.get('type', '') == 'default'
self.os = node.get('x-kde-os', '')
self.environment = node.get('environment', '')
for c3 in node:
if c3.tag == 'caption':
utils.localize(self.caption, c3, lang_code_func=lang_code_func)
Expand Down
2 changes: 1 addition & 1 deletion tests/test.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<caption xml:lang="x-test">xx"Mixing color of paint" activityxx</caption>
<image width="1600" height="1040">https://gcompris.net/screenshots_qt/large/color_mix.png</image>
</screenshot>
<screenshot x-kde-os="windows">
<screenshot environment="windows">
<caption>Main view with room list, chat, and room information pane</caption>
<image>https://cdn.kde.org/screenshots/neochat/NeoChat-Windows-Timeline.png</image>
</screenshot>
Expand Down
6 changes: 3 additions & 3 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ def test_screenshots(self):
self.assertEqual('O l\'actiu La comunitat d\'artistes del Krita anchor', screenshots[2].caption['ca'])
# Exclude empty string
self.assertEqual({'C', 'ca'}, set(screenshots[2].caption.keys()))
# x-kde-os attribute
self.assertEqual('windows', self.component.screenshots[4].os)
# environment attribute
self.assertEqual('windows', self.component.screenshots[4].environment)
# serialization
self.assertIn('source-image', self.obj['Screenshots'][0])
self.assertEqual('https://gcompris.net/screenshots_qt/large/color_mix.png',
self.obj['Screenshots'][3]['source-image']['url'])
self.assertEqual('windows', self.obj['Screenshots'][4]['os'])
self.assertEqual('windows', self.obj['Screenshots'][4]['environment'])

def test_provide(self):
provide = self.component.provides
Expand Down

0 comments on commit 1697240

Please sign in to comment.