Merge lp:~jamesh/unity-scope-calculator/preview-image into lp:unity-scope-calculator

Proposed by James Henstridge on 2013-05-10
Status: Merged
Approved by: James Henstridge on 2013-05-13
Approved revision: 37
Merged at revision: 37
Proposed branch: lp:~jamesh/unity-scope-calculator/preview-image
Merge into: lp:unity-scope-calculator
Diff against target: 36 lines (+15/-1)
2 files modified
src/unity_calculator_daemon.py (+2/-1)
tests/test_calculator.py (+13/-0)
To merge this branch: bzr merge lp:~jamesh/unity-scope-calculator/preview-image
Reviewer Review Type Date Requested Status
David Callé 2013-05-10 Approve on 2013-05-13
PS Jenkins bot (community) continuous-integration Approve on 2013-05-10
Review via email: mp+163263@code.launchpad.net

Commit message

Add a calculator image to the scope preview.

Description of the change

Add a calculator image to the scope preview.

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
David Callé (davidc3) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity_calculator_daemon.py'
2--- src/unity_calculator_daemon.py 2013-03-22 14:24:10 +0000
3+++ src/unity_calculator_daemon.py 2013-05-10 05:41:25 +0000
4@@ -146,7 +146,8 @@
5 class Preview (Unity.ResultPreviewer):
6
7 def do_run(self):
8- preview = Unity.GenericPreview.new(self.result.title, '', None)
9+ image = Gio.ThemedIcon.new('gnome-calculator')
10+ preview = Unity.GenericPreview.new(self.result.title, '', image)
11 preview.props.subtitle = self.result.comment
12 open_action = Unity.PreviewAction.new("open", _("Open in calculator"), None)
13 preview.add_action(open_action)
14
15=== modified file 'tests/test_calculator.py'
16--- tests/test_calculator.py 2013-03-22 11:32:08 +0000
17+++ tests/test_calculator.py 2013-05-10 05:41:25 +0000
18@@ -68,5 +68,18 @@
19 self.assertResultTitle('bob', [])
20 self.assertResultTitle('1**1', [])
21
22+ def test_preview(self):
23+ result = Unity.ScopeResult()
24+ result.uri = "3"
25+ result.title = "3"
26+ result.comment = "1+2"
27+ metadata = Unity.SearchMetadata()
28+ previewer = self.scope.create_previewer(result, metadata)
29+ preview = previewer.run()
30+ self.assertEqual(preview.props.title, "3")
31+ self.assertEqual(preview.props.subtitle, "1+2")
32+ self.assertNotEqual(preview.props.image, None)
33+ self.assertEqual(preview.props.image.get_names(), ['gnome-calculator'])
34+
35 if __name__ == '__main__':
36 unittest.main()

Subscribers

People subscribed via source and target branches

to all changes: