Merge lp:~stolowski/unity-2d/dash-hud-esc-handling-fix into lp:unity-2d

Proposed by Paweł Stołowski
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 1033
Merged at revision: 1035
Proposed branch: lp:~stolowski/unity-2d/dash-hud-esc-handling-fix
Merge into: lp:unity-2d
Diff against target: 143 lines (+111/-0)
3 files modified
shell/common/SearchEntry.qml (+6/-0)
tests/dash/dash-tests.rb (+53/-0)
tests/hud/hud_show_hide_tests.rb (+52/-0)
To merge this branch: bzr merge lp:~stolowski/unity-2d/dash-hud-esc-handling-fix
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
Review via email: mp+100569@code.launchpad.net

Commit message

[dash][hud] Hitting Escape clears search query first. Hitting Escape with empty search query closes Dash/Hud. This makes Esc behavior consistent with Unity.

Description of the change

[dash][hud] Hitting Escape clears search query first. Hitting Escape with empty search query closes Dash/Hud. This makes Esc behavior consistent with Unity.
  - Modified SearchEntry keyboard handling to clear input text on Escape and accept key event.
  - Modified Dash and Hud keyboard handling to close the view only if search query is empty.

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) wrote :

Seems to me you don't need all the extra code in Shell.qml nor Hud.qml since you are already eating the event and it won't get propagated unless the text is already "", no?

review: Needs Fixing
1033. By Paweł Stołowski

The chnages to Shell and Hud qml are not needed since SearchEntry accepts Esc key event if search text was not empty. Removed.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Works great :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'shell/common/SearchEntry.qml'
--- shell/common/SearchEntry.qml 2012-03-13 11:24:33 +0000
+++ shell/common/SearchEntry.qml 2012-04-03 10:19:19 +0000
@@ -114,6 +114,12 @@
114 activateFirstResult()114 activateFirstResult()
115 event.accepted = true;115 event.accepted = true;
116 }116 }
117 if (event.key == Qt.Key_Escape) {
118 if (searchInput.text != "") {
119 searchInput.text = ""
120 event.accepted = true;
121 }
122 }
117 }123 }
118124
119 Component {125 Component {
120126
=== modified file 'tests/dash/dash-tests.rb'
--- tests/dash/dash-tests.rb 2012-03-20 18:01:52 +0000
+++ tests/dash/dash-tests.rb 2012-04-03 10:19:19 +0000
@@ -381,6 +381,59 @@
381 end381 end
382382
383 # Test case objectives:383 # Test case objectives:
384 # * Check that Esc clears dash search entry first, tapping Esc for the 2nd time closes dash
385 # Pre-conditions
386 # * Desktop with no running applications
387 # Test steps
388 # * Verify dash is not showing
389 # * Press Super
390 # * Verify dash is showing
391 # * Type search query
392 # * Verify dash search entry is populated
393 # * Press Esc
394 # * Verify dash search entry is cleared
395 # * Verify dash is still showing
396 # * Press Esc
397 # * Verify dash is not showing
398 # Post-conditions
399 # * None
400 # References
401 # * https://bugs.launchpad.net/unity-2d/+bug/966121
402 test "Esc clears dash search query first, then closes dash" do
403 verify_equal("false", TIMEOUT, 'There should not be a Dash declarative view on startup') {
404 @app.Dash()['active']
405 }
406
407 XDo::Keyboard.super
408 verify_equal("true", TIMEOUT, 'There should be a Dash declarative view after pressing Super') {
409 @app.Dash()['active']
410 }
411
412 # type search string
413 XDo::Keyboard.a
414 XDo::Keyboard.b
415 XDo::Keyboard.c
416
417 verify_equal('abc', TIMEOUT, 'Search query should be populated') {
418 @app.Dash().QDeclarativeItem.SearchEntry()['searchQuery']
419 }
420
421 XDo::Keyboard.escape
422 verify_equal("true", TIMEOUT, 'Dash should still be visible') {
423 @app.Dash()['active']
424 }
425
426 verify_equal('', TIMEOUT, 'Search query should be empty') {
427 @app.Dash().QDeclarativeItem.SearchEntry()['searchQuery']
428 }
429
430 XDo::Keyboard.escape
431 verify_equal("false", TIMEOUT, 'There should not be a Dash declarative') {
432 @app.Dash()['active']
433 }
434 end
435
436 # Test case objectives:
384 # * Check navigation to and in lens bar437 # * Check navigation to and in lens bar
385 # Pre-conditions438 # Pre-conditions
386 # Test steps439 # Test steps
387440
=== modified file 'tests/hud/hud_show_hide_tests.rb'
--- tests/hud/hud_show_hide_tests.rb 2012-04-01 09:26:54 +0000
+++ tests/hud/hud_show_hide_tests.rb 2012-04-03 10:19:19 +0000
@@ -128,6 +128,58 @@
128 end128 end
129 129
130 # Test case objectives:130 # Test case objectives:
131 # * Check Escape key clears search query first, then closes HUD
132 # Pre-conditions
133 # * None
134 # Test steps
135 # * Check HUD closed
136 # * Tap the Alt key
137 # * Check HUD open
138 # * Type search string
139 # * Verify that search string appears in the HUD
140 # * Tap Escape key
141 # * Verify that search string was cleared
142 # * Tap Escape key
143 # * Check that HUD was closed
144 # Post-conditions
145 # * None
146 # References
147 # * https://bugs.launchpad.net/unity-2d/+bug/966121
148 test "Esc clears HUD search query, then hides HUD" do
149 verify_not(1, 'HUD should be hidden at startup') {
150 @app.Hud()
151 }
152
153 XDo::Keyboard.alt
154 verify_equal('true', TIMEOUT, 'HUD should be visible, as the Alt key was tapped') {
155 @app.Hud()['active']
156 }
157
158 # type search string
159 XDo::Keyboard.a
160 XDo::Keyboard.b
161 XDo::Keyboard.c
162
163 verify_equal('abc', TIMEOUT, 'HUD search text should be "abc"') {
164 @app.Hud().SearchEntry()['searchQuery']
165 }
166
167 XDo::Keyboard.escape
168 verify_equal('true', TIMEOUT, 'HUD should still be visible') {
169 @app.Hud()['active']
170 }
171
172 verify_equal('', TIMEOUT, 'HUD search text should be empty') {
173 @app.Hud().SearchEntry()['searchQuery']
174 }
175
176 XDo::Keyboard.escape
177 verify_not(1, 'HUD should be hidden, as the Escape key should dismiss it') {
178 @app.Hud()
179 }
180 end
181
182 # Test case objectives:
131 # * Check Alt+F4 key closes HUD183 # * Check Alt+F4 key closes HUD
132 # Pre-conditions184 # Pre-conditions
133 # * None185 # * None

Subscribers

People subscribed via source and target branches