Merge lp:~sil2100/unity/autopilot_add_menu_settle_for_test into lp:unity

Proposed by Łukasz Zemczak
Status: Merged
Approved by: Didier Roche-Tolomelli
Approved revision: no longer in the source branch.
Merged at revision: 3306
Proposed branch: lp:~sil2100/unity/autopilot_add_menu_settle_for_test
Merge into: lp:unity
Diff against target: 11 lines (+1/-0)
1 file modified
tests/autopilot/unity/tests/test_panel.py (+1/-0)
To merge this branch: bzr merge lp:~sil2100/unity/autopilot_add_menu_settle_for_test
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Francis Ginther Approve
Review via email: mp+159156@code.launchpad.net

Commit message

During the test_window_buttons_show_when_holding_show_menu_key, wait for a menu settle period before continuing. The reason for this is that when by any chance the gedit application is already maximized on start, there is a timing condition that causes things to happen 'too fast' - and in the end, instead of a Alt press we get an Alt tap.

Description of the change

- Problem:

unity.tests.test_panel.PanelWindowButtonsTests.test_window_buttons_show_when_holding_show_menu_key causes some trouble, it fails in a specific way opening the HUD while it shouldn't.

Log from IRC not to repeat myself:
14:52 < sil2100> seb128: so, heh, the open_new_application_window() method in test_panel
                 is a bit broken when we don't have to 'maximize' or 'restore'
14:54 < sil2100> seb128: in our case, somehow gedit gets remembered as maximized and
                 starts off maximized, which sometimes causes a strange timing problem
                 that in the end results in a funny thing: the application is being
                 started (but still not visible), Alt is pressed (as we want to keep
                 pressing it until the menu's appear on the panel), application then
                 appears (and when an app appears, the menus appear instantly as well),
                 the test thinks that the menu appeared because of our Alt press and
                 releases Alt (which unity treats as a Alt-tap)
14:55 < sil2100> And HUD appears, even though we didn't ask it to
14:55 < sil2100> Phew

- Fix:

Actually, we don't have to fix open_new_application_window() as it works more or less correctly. Since it's good that it doesn't introduce any unnecessary waits.
What we do to fix is is use sleep_menu_settle_period() after application start. This way we're sure that the application menu did the 'appear and disappear' animation - if it's not enough, there's the Eventually assertion later on which guards if all is good.

This way we eliminate the timing condition.

- Tests:

N/A

To post a comment you must log in.
Revision history for this message
Francis Ginther (fginther) wrote :

Confirmed that this fixed the issue for me.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

Intermittent build failure on armhf: https://bugs.launchpad.net/unity/+bug/1169714

Retrying.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Failure on armhf again. Reapproving.

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

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 2013-04-08 20:27:29 +0000
3+++ tests/autopilot/unity/tests/test_panel.py 2013-04-16 13:33:32 +0000
4@@ -626,6 +626,7 @@
5 maximized=True,
6 move_to_monitor=True)
7
8+ self.sleep_menu_settle_period()
9 self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False)))
10
11 self.keybinding_hold("panel/show_menus")