Merge lp:~townsend/unity/fix-lp1287745 into lp:unity

Proposed by Christopher Townsend
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3698
Proposed branch: lp:~townsend/unity/fix-lp1287745
Merge into: lp:unity
Diff against target: 51 lines (+15/-4)
1 file modified
tests/autopilot/unity/tests/test_panel.py (+15/-4)
To merge this branch: bzr merge lp:~townsend/unity/fix-lp1287745
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+209290@code.launchpad.net

Commit message

Fix more Panel Autopilot test failures.

Description of the change

This MP fixes the following failures:

1. Some Panel tests will fail if the previous test leaves the system with only the Launcher on the primary monitor. * To fix this, make sure the Launcher is in all monitors before the tests run.

2. test_window_buttons_show_when_holding_show_menu_key can fail due to a race when pressing and releasing the Alt key. This sometimes opens the Hud during the test which is not expected.
* Add a short delay before the test releases the Alt key to avoid the Hud opening.

3. test_hovering_indicators_on_multiple_monitors fails due to a change in how multi-monitor Panels are handled. The test needs fixed to account for the new behavior.
* Move the chunk of code to open the session indicator to the loop so this will occur for each monitor.
* At the end of the loop, add a mouse click to close the last indicator opened so the next iteration can open the indicator on its monitor.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/unity/tests/test_panel.py'
2--- tests/autopilot/unity/tests/test_panel.py 2014-02-27 15:49:20 +0000
3+++ tests/autopilot/unity/tests/test_panel.py 2014-03-04 15:43:33 +0000
4@@ -154,6 +154,12 @@
5
6 scenarios = _make_monitor_scenarios()
7
8+ def setUp(self):
9+ super(PanelTitleTests, self).setUp()
10+ # Locked Launchers on all monitors
11+ self.set_unity_option('num_launchers', 0)
12+ self.set_unity_option('launcher_hide_mode', 0)
13+
14 def test_panel_title_on_empty_desktop(self):
15 """With no windows shown, the panel must display the default title."""
16 gettext.install("unity", unicode=True)
17@@ -648,6 +654,8 @@
18
19 self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(True)))
20
21+ # Sleep a bit to avoid a race with the Hud showing
22+ sleep(0.5)
23 self.keybinding_release("panel/show_menus")
24 self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False)))
25
26@@ -1307,14 +1315,14 @@
27
28 def test_hovering_indicators_on_multiple_monitors(self):
29 """Opening an indicator entry and then hovering others entries must open them."""
30- text_win = self.open_new_application_window("Text Editor")
31- panel = self.unity.panels.get_panel_for_monitor(text_win.monitor)
32- indicator = panel.indicators.get_indicator_by_name_hint("indicator-session")
33- self.mouse_open_indicator(indicator)
34+ self.open_new_application_window("Text Editor")
35
36 for monitor in range(0, self.display.get_num_screens()):
37 panel = self.unity.panels.get_panel_for_monitor(monitor)
38
39+ indicator = panel.indicators.get_indicator_by_name_hint("indicator-session")
40+ self.mouse_open_indicator(indicator)
41+
42 entries = panel.get_indicator_entries(include_hidden_menus=True)
43 self.assertThat(len(entries), GreaterThan(0))
44
45@@ -1330,3 +1338,6 @@
46 self.assertThat(entry.visible, Eventually(Equals(True)))
47 self.assertThat(entry.active, Eventually(Equals(True)))
48 self.assertThat(entry.menu_y, Eventually(NotEquals(0)))
49+
50+ # Close the last indicator on the monitor
51+ self.mouse.click()