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
=== modified file 'softwarecenter/ui/gtk3/widgets/exhibits.py'
--- softwarecenter/ui/gtk3/widgets/exhibits.py 2012-07-10 03:23:44 +0000
+++ softwarecenter/ui/gtk3/widgets/exhibits.py 2012-07-13 07:44:32 +0000
@@ -93,6 +93,7 @@
93 'title': _("Our star apps"),93 'title': _("Our star apps"),
94 'subtitle': _("Come and explore our favourites"),94 'subtitle': _("Come and explore our favourites"),
95 }95 }
96 self.click_url = ""
96 # we should extract this automatically from the html97 # we should extract this automatically from the html
97 #self.atk_name = _("Default Banner")98 #self.atk_name = _("Default Banner")
98 #self.atk_description = _("You see this banner because you have no "99 #self.atk_description = _("You see this banner because you have no "
99100
=== modified file 'tests/gtk3/test_catview.py'
--- tests/gtk3/test_catview.py 2012-07-10 03:23:44 +0000
+++ tests/gtk3/test_catview.py 2012-07-13 07:44:32 +0000
@@ -356,6 +356,29 @@
356 call_exhibit = mock_emit.call_args[0][1]356 call_exhibit = mock_emit.call_args[0][1]
357 self.assertEqual(signal_name, "show-exhibits-clicked")357 self.assertEqual(signal_name, "show-exhibits-clicked")
358 self.assertEqual(call_exhibit.click_url, "http://example.com")358 self.assertEqual(call_exhibit.click_url, "http://example.com")
359
360 def test_exhibit_with_featured_exhibit(self):
361 """ regression test for bug #1023777 """
362 sca = ObjectWithSignals()
363 sca.query_exhibits = lambda: sca.emit('exhibits', sca,
364 [catview_gtk.FeaturedExhibit()])
365
366 with patch.object(catview_gtk, 'SoftwareCenterAgent', lambda: sca):
367 # add the banners
368 self.lobby._append_banner_ads()
369 # fake click
370 alloc = self.lobby.exhibit_banner.get_allocation()
371 mock_event = Mock()
372 mock_event.x = alloc.x
373 mock_event.y = alloc.y
374 with patch.object(self.lobby, 'emit') as mock_emit:
375 self.lobby.exhibit_banner.on_button_press(None, mock_event)
376 self.lobby.exhibit_banner.on_button_release(None, mock_event)
377 mock_emit.assert_called()
378 signal_name = mock_emit.call_args[0][0]
379 call_category = mock_emit.call_args[0][1]
380 self.assertEqual(signal_name, "category-selected")
381 self.assertEqual(call_category.name, "Our star apps")
359 382
360if __name__ == "__main__":383if __name__ == "__main__":
361 unittest.main()384 unittest.main()

Subscribers

People subscribed via source and target branches