Merge lp:~mvo/software-center/fix-lp1023777 into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 3070
Proposed branch: lp:~mvo/software-center/fix-lp1023777
Merge into: lp:software-center
Diff against target: 45 lines (+24/-0)
2 files modified
softwarecenter/ui/gtk3/widgets/exhibits.py (+1/-0)
tests/gtk3/test_catview.py (+23/-0)
To merge this branch: bzr merge lp:~mvo/software-center/fix-lp1023777
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+114789@code.launchpad.net

Description of the change

Bugfix for trunk with regression test for click_url crash with the FeaturedExhibits banner inspired on the original branch: lp:~gary-lasker/software-center/fix-lp1023777-for-5.2

To post a comment you must log in.
Revision history for this message
Gary Lasker (gary-lasker) wrote :

Thanks Michael! Nice simple fix and it does the trick. And thanks for the unit test!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/ui/gtk3/widgets/exhibits.py'
2--- softwarecenter/ui/gtk3/widgets/exhibits.py 2012-07-10 03:23:44 +0000
3+++ softwarecenter/ui/gtk3/widgets/exhibits.py 2012-07-13 07:44:32 +0000
4@@ -93,6 +93,7 @@
5 'title': _("Our star apps"),
6 'subtitle': _("Come and explore our favourites"),
7 }
8+ self.click_url = ""
9 # we should extract this automatically from the html
10 #self.atk_name = _("Default Banner")
11 #self.atk_description = _("You see this banner because you have no "
12
13=== modified file 'tests/gtk3/test_catview.py'
14--- tests/gtk3/test_catview.py 2012-07-10 03:23:44 +0000
15+++ tests/gtk3/test_catview.py 2012-07-13 07:44:32 +0000
16@@ -356,6 +356,29 @@
17 call_exhibit = mock_emit.call_args[0][1]
18 self.assertEqual(signal_name, "show-exhibits-clicked")
19 self.assertEqual(call_exhibit.click_url, "http://example.com")
20+
21+ def test_exhibit_with_featured_exhibit(self):
22+ """ regression test for bug #1023777 """
23+ sca = ObjectWithSignals()
24+ sca.query_exhibits = lambda: sca.emit('exhibits', sca,
25+ [catview_gtk.FeaturedExhibit()])
26+
27+ with patch.object(catview_gtk, 'SoftwareCenterAgent', lambda: sca):
28+ # add the banners
29+ self.lobby._append_banner_ads()
30+ # fake click
31+ alloc = self.lobby.exhibit_banner.get_allocation()
32+ mock_event = Mock()
33+ mock_event.x = alloc.x
34+ mock_event.y = alloc.y
35+ with patch.object(self.lobby, 'emit') as mock_emit:
36+ self.lobby.exhibit_banner.on_button_press(None, mock_event)
37+ self.lobby.exhibit_banner.on_button_release(None, mock_event)
38+ mock_emit.assert_called()
39+ signal_name = mock_emit.call_args[0][0]
40+ call_category = mock_emit.call_args[0][1]
41+ self.assertEqual(signal_name, "category-selected")
42+ self.assertEqual(call_category.name, "Our star apps")
43
44 if __name__ == "__main__":
45 unittest.main()

Subscribers

People subscribed via source and target branches