Merge lp:~om26er/unity/test_alt_arrowkeys into lp:unity

Proposed by Omer Akram
Status: Merged
Approved by: Omer Akram
Approved revision: no longer in the source branch.
Merged at revision: 2603
Proposed branch: lp:~om26er/unity/test_alt_arrowkeys
Merge into: lp:unity
Diff against target: 60 lines (+25/-15)
2 files modified
manual-tests/Hud.txt (+0/-15)
tests/autopilot/unity/tests/test_hud.py (+25/-0)
To merge this branch: bzr merge lp:~om26er/unity/test_alt_arrowkeys
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) Approve
Thomi Richards (community) Needs Fixing
Review via email: mp+120255@code.launchpad.net

Commit message

Tests that Alt+ArrowKey events are correctly passed to the active window when not interacting with Unity.

Description of the change

Tests that Alt+ArrowKey events are correctly passed to the active window when not interacting with Unity.

since we can't read text from terminal, we are writing it to a text file and reading from there if it matches the expected.

thx Thomi

To post a comment you must log in.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Hi Omer,

42 + self.keyboard.type('echo \"')

I don't think you need the \ here. Python doesn't need it (you can use double quotes inside a single quoted string just fine), and I'm pretty sure the keyboard emulator doesn't need it either...

52 + self.keyboard.type('\" > /tmp/ap_test_alt_keys')

.. same here

Otherwise this test looks good.

review: Needs Fixing
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Looks good to me. Fixed what Thomi wanted fixed :)

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/1094/console reported an error when processing this lp:~om26er/unity/test_alt_arrowkeys branch.
Not merging it.

Revision history for this message
Omer Akram (om26er) wrote :

re-approved looks like autolanding is working again.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'manual-tests/Hud.txt'
2--- manual-tests/Hud.txt 2012-08-18 11:05:32 +0000
3+++ manual-tests/Hud.txt 2012-08-21 21:29:18 +0000
4@@ -33,21 +33,6 @@
5 After pressing escape in step three, the text "test" should be removed from the hud search
6 After step four, the hud should dismiss itself and not be present.
7
8-Alt+Arrow keys not passed to application
9-----------------------------------------
10-Tests that Alt+ArrowKey events are correctly passed to the active window
11-when Unity is not responding to them.
12-
13-Note: Should be automated
14-
15-Setup:
16-#. Open gnome-terminal
17-
18-Actions:
19-#. While holding Alt, tap arrow keys: Up, Down, Right, Left
20-
21-Expected Result:
22- The terminal should show the keycodes were received as text "ABCD".
23
24 Alt+Enter Crash
25 ---------------
26
27=== modified file 'tests/autopilot/unity/tests/test_hud.py'
28--- tests/autopilot/unity/tests/test_hud.py 2012-08-21 12:33:40 +0000
29+++ tests/autopilot/unity/tests/test_hud.py 2012-08-21 21:29:18 +0000
30@@ -278,6 +278,31 @@
31
32 self.assertThat(self.hud.visible, Eventually(Equals(False)))
33
34+ def test_alt_arrow_keys_not_eaten(self):
35+ """Tests that Alt+ArrowKey events are correctly passed to the
36+ active window when Unity is not responding to them."""
37+
38+ self.start_app_window("Terminal")
39+
40+ #There's no easy way to read text from terminal, writing input
41+ #to a text file and then reading from there works.
42+ self.keyboard.type('echo "')
43+
44+ #Terminal is receiving input with Alt+Arrowkeys
45+ self.keyboard.press("Alt")
46+ self.keyboard.press_and_release("Up")
47+ self.keyboard.press_and_release("Down")
48+ self.keyboard.press_and_release("Right")
49+ self.keyboard.press_and_release("Left")
50+ self.keyboard.release("Alt")
51+
52+ self.keyboard.type('" > /tmp/ap_test_alt_keys')
53+ self.addCleanup(remove, '/tmp/ap_test_alt_keys')
54+ self.keyboard.press_and_release("Enter")
55+
56+ file_contents = open('/tmp/ap_test_alt_keys', 'r').read().strip()
57+
58+ self.assertThat(file_contents, Equals('ABCD'))
59
60 class HudLauncherInteractionsTests(HudTestsBase):
61