Merge lp://qastaging/~3v1n0/unity/quicklist-keynav-fixes into lp://qastaging/unity
Proposed by
Marco Trevisan (Treviño)
Status: | Merged | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Marco Trevisan (Treviño) | ||||||||||||
Approved revision: | no longer in the source branch. | ||||||||||||
Merged at revision: | 2310 | ||||||||||||
Proposed branch: | lp://qastaging/~3v1n0/unity/quicklist-keynav-fixes | ||||||||||||
Merge into: | lp://qastaging/unity | ||||||||||||
Diff against target: |
1067 lines (+461/-148) 14 files modified
plugins/unityshell/src/AbstractLauncherIcon.h (+1/-1) plugins/unityshell/src/LauncherIcon.cpp (+3/-3) plugins/unityshell/src/LauncherIcon.h (+1/-1) plugins/unityshell/src/MockLauncherIcon.h (+1/-1) plugins/unityshell/src/QuicklistMenuItem.cpp (+9/-23) plugins/unityshell/src/QuicklistMenuItem.h (+3/-4) plugins/unityshell/src/QuicklistMenuItemSeparator.cpp (+6/-0) plugins/unityshell/src/QuicklistMenuItemSeparator.h (+2/-0) plugins/unityshell/src/QuicklistView.cpp (+165/-95) plugins/unityshell/src/QuicklistView.h (+4/-2) tests/autopilot/autopilot/emulators/unity/quicklist.py (+46/-7) tests/autopilot/autopilot/keybindings.py (+11/-4) tests/autopilot/autopilot/tests/test_quicklist.py (+205/-7) tests/unit/TestQuicklistMenuitems.cpp (+4/-0) |
||||||||||||
To merge this branch: | bzr merge lp://qastaging/~3v1n0/unity/quicklist-keynav-fixes | ||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Thomi Richards (community) | Approve | ||
Review via email:
|
Commit message
QuicklistView: fixed the quicklist key navigation, to make it consistent with Gtk menus navigation.
The prelight of the items is now completely controlled by QuicklistView and never by QuicklistMenuItem, the children can define now when they are slectable.
Description of the change
Quicklist key navigation was broken in multiple aspect, fixed the attached bugs to make it consistent with Gtk menu navigation.
The prelight of the items is now completely controlled by QuicklistView and never by QuicklistMenuItem, the children can define now when they are slectable.
Included Autopilot tests for the QL key navigation, and updated unit-tests for QuicklistMenuItem.
To post a comment you must log in.
Hi,
82 +bool tem::GetSelecta ble()
83 +QuicklistMenuI
199 +bool temSeparator: :GetSelectable( )
200 +QuicklistMenuI
238 +void :SelectItem( int index)
239 +QuicklistView:
263 bool :IsMenuItemSepe rator(int index) :IsMenuItemSele ctable( int index)
264 -QuicklistView:
265 +QuicklistView:
Coding style says these should be on the same name.
667 + def get_items(self, visible_only=True): children_ by_type( QuicklistMenuIt em, visible=True) children_ by_type( QuicklistMenuIt em) children_ by_type( QuicklistMenuIt em) items(self) :
668 + """Returns the quicklist items"""
669 + if visible_only:
670 + return self.get_
671 + else:
672 + return self.get_
673 +
674 @property
675 def items(self):
676 """Individual items in the quicklist."""
677 - return self.get_
678 + return self.get_items()
679 +
680 + @property
681 + def selectable_
682 + """Items that can be selected in the quicklist"""
683 + return filter(lambda it: it.selectable == True, self.items)
This is a bit inconsistent - you have 'get_items' and 'selectable_items' - one a method, one a property. Please make them both the same (either methods or properties, I don't mind which). Also, please don't use 'filter' in autopilot. In most places, list comprehensions are clearer. However, in this case, you don't need either - just pass more keyword filters to get_children_ by_type (like this):
@property items(self) : children_ by_type( QuicklistMenuIt em, visible=True, selectable=True)
def selectable_
return self.get_
704 + Mouse() .move(target_ x, target_y, animate=False)
Unless you have good reason to, please don't pass 'animate=false'
- this is only intended to be used in exceptional circumstances.
856 + self.assertThat (self.quicklist , Not(Is(None))) (self.quicklist .selected_ item, Not(Is(None)))
857 + self.assertThat
Please avoid negative assertions. Instead of saying "make sure foo is not None", say "Make sure foo is XYZ" - it makes your tests more specific and robust.
A few notes on docstrings: www.python. org/dev/ peps/pep- 0257/
1. All your docstrings need a full-stop (period) at the end.
2. Please try and make your docstrings PEP257 compliant: http://
3. You can rewrite many of your docstrings to be shorter, and more forceful. For example, instead of writing this:
"""Tests that the quicklist Home key selects the first valid item when
no item is selected
"""
write this:
"""Home key MUST select the first selectable item in a quicklist."""
Note that this uses the word "must" which is better than "should", "might", or "will", and follows more closely the code of the tests themselves.
Other than that, these look good.