Merge lp:~aacid/unity-2d/dashlossfocusbug into lp:unity-2d

Proposed by Albert Astals Cid
Status: Merged
Approved by: Michał Sawicz
Approved revision: 1050
Merged at revision: 1048
Proposed branch: lp:~aacid/unity-2d/dashlossfocusbug
Merge into: lp:unity-2d
Diff against target: 86 lines (+50/-3)
2 files modified
shell/dash/Dash.qml (+7/-3)
tests/dash/dash-tests.rb (+43/-0)
To merge this branch: bzr merge lp:~aacid/unity-2d/dashlossfocusbug
Reviewer Review Type Date Requested Status
Michał Sawicz Pending
Review via email: mp+100964@code.launchpad.net

Commit message

[Dash] Really give the focus to the search entry on lens change

Description of the change

[Dash] Really give the focus to the search entry on lens change

To post a comment you must log in.
lp:~aacid/unity-2d/dashlossfocusbug updated
1049. By Albert Astals Cid

Move the focus earlier so we don't need a forceActiveFocus call

1050. By Albert Astals Cid

Give the focus too if we are using the custom Home.qml hack

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'shell/dash/Dash.qml'
2--- shell/dash/Dash.qml 2012-04-04 10:16:36 +0000
3+++ shell/dash/Dash.qml 2012-04-05 13:28:19 +0000
4@@ -87,9 +87,6 @@
5 }
6
7 function activatePage(page) {
8- /* Always give the focus to the search entry when switching pages */
9- search_entry.focus = true
10-
11 if (page == currentPage) {
12 return
13 }
14@@ -102,6 +99,9 @@
15 }
16
17 function buildLensPage(lens) {
18+ /* Always give the focus to the search entry when switching pages */
19+ search_entry.focus = true
20+
21 pageLoader.setSource("LensView.qml")
22 /* Take advantage of the fact that the loaded qml is local and setting
23 the source loads it immediately making pageLoader.item valid */
24@@ -169,6 +169,10 @@
25 for (var i=0; i<lenses.rowCount(); i++) {
26 lenses.get(i).viewType = Lens.Hidden
27 }
28+
29+ /* Give the focus to the search entry when switching pages */
30+ search_entry.focus = true
31+
32 pageLoader.setSource("Home.qml")
33 /* Take advantage of the fact that the loaded qml is local and setting
34 the source loads it immediately making pageLoader.item valid */
35
36=== modified file 'tests/dash/dash-tests.rb'
37--- tests/dash/dash-tests.rb 2012-04-03 08:34:46 +0000
38+++ tests/dash/dash-tests.rb 2012-04-05 13:28:19 +0000
39@@ -541,4 +541,47 @@
40 @app.TextCustom( { :objectName => "noResultsText" } )
41 }
42 end
43+
44+ # Test case objectives:
45+ # * Check focus goes to the search bar on lens switch
46+ # Pre-conditions
47+ # Test steps
48+ # * Invoke dash
49+ # * Verify dash shows
50+ # * Verify search entry has focus
51+ # * Change to the second lens (clicking on it)
52+ # * Press key down
53+ # * Verify search entry does not have focus
54+ # * Change to the first lens (clicking on it)
55+ # * Verify search entry does has focus
56+ # Post-conditions
57+ # * None
58+ # References
59+ # * https://bugs.launchpad.net/unity-2d/+bug/974235
60+ test "Check focus goes to the search bar on lens switch" do
61+ XDo::Keyboard.super
62+
63+ verify_equal("true", TIMEOUT, 'There should be a Dash declarative view after pressing Super') {
64+ @app.Dash()['active']
65+ }
66+
67+ verify_equal("true", TIMEOUT, 'Search entry should have focus after starting') {
68+ @app.Dash().SearchEntry()['activeFocus']
69+ }
70+
71+ buttons = @app.LensBar().children( { :type => "LensButton" } )
72+ buttons[1].move_mouse
73+ buttons[1].tap
74+ XDo::Keyboard.down
75+ verify_equal("false", TIMEOUT, 'Search entry should not have focus after key down') {
76+ @app.Dash().SearchEntry()['activeFocus']
77+ }
78+ buttons[0].move_mouse
79+ buttons[0].tap
80+ verify_equal("true", TIMEOUT, 'Search entry should have focus after lens change') {
81+ @app.Dash().SearchEntry()['activeFocus']
82+ }
83+
84+ end
85+
86 end

Subscribers

People subscribed via source and target branches