Code review comment for lp:~ralsina/ubuntuone-control-panel/alerted

Revision history for this message
Roberto Alsina (ralsina) wrote :

> Question, why would you patch self.patch(self.ui, "focusInEvent", lambda ev:
> False) in the set_urgent test?

Doesn't seem necessary anymore. In a previous version of this, when you create the window, that widget got focus and focusInEvent removed the urgent flag. Will remove.

> Also, can we change this code:
>
> self.ui.switch_to("devices")
> self.assertEqual(
> self.ui.ui.control_panel.ui.tab_widget.currentIndex(),
> 2)
>
> to use something like:
>
> self.ui.switch_to("devices")
> self.assertEqual(
> self.ui.ui.control_panel.ui.tab_widget.currentIndex(),
> self.ui.ui.control_panel.ui.tab_widget.indexOf(self.ui.ui.control_
> panel.ui.devices))
>
> which in turn allows us to do something like:
>
> for tab_name in self.ui.tabs:
> tab = getattr(self.ui.ui.control_panel.ui, tab_name)
> self.ui.switch_to(tab_name)
> self.assertEqual(
> self.ui.ui.control_panel.ui.tab_widget.currentIndex(),
> self.ui.ui.control_panel.ui.tab_widget.indexOf(tab))
>
> What do you think?

It's a bit verbose, and it has a problem in that we don't want to test the tab switching in order, but something similar is doable.

« Back to merge proposal