Merge lp://qastaging/~3v1n0/unity/panel-p-tests into lp://qastaging/unity
Proposed by
Marco Trevisan (Treviño)
Status: | Merged |
---|---|
Approved by: | Didier Roche-Tolomelli |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2243 |
Proposed branch: | lp://qastaging/~3v1n0/unity/panel-p-tests |
Merge into: | lp://qastaging/unity |
Prerequisite: | lp://qastaging/~3v1n0/unity/panel-p-cleanup |
Diff against target: |
2153 lines (+1763/-69) 18 files modified
manual-tests/Panel.txt (+0/-44) plugins/unityshell/src/DashController.cpp (+2/-1) plugins/unityshell/src/DashView.cpp (+9/-1) plugins/unityshell/src/PanelIndicatorEntryView.cpp (+26/-6) plugins/unityshell/src/PanelIndicatorsView.cpp (+1/-1) plugins/unityshell/src/PanelMenuView.cpp (+7/-1) plugins/unityshell/src/PanelTitlebarGrabAreaView.cpp (+1/-1) plugins/unityshell/src/PanelTray.cpp (+1/-1) plugins/unityshell/src/PanelView.cpp (+1/-1) plugins/unityshell/src/WindowButtons.cpp (+10/-4) tests/autopilot/autopilot/emulators/X11.py (+32/-2) tests/autopilot/autopilot/emulators/bamf.py (+22/-2) tests/autopilot/autopilot/emulators/unity/dash.py (+6/-3) tests/autopilot/autopilot/emulators/unity/panel.py (+338/-0) tests/autopilot/autopilot/keybindings.py (+8/-0) tests/autopilot/autopilot/tests/__init__.py (+8/-1) tests/autopilot/autopilot/tests/test_launcher.py (+88/-0) tests/autopilot/autopilot/tests/test_panel.py (+1203/-0) |
To merge this branch: | bzr merge lp://qastaging/~3v1n0/unity/panel-p-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Penhey (community) | Approve | ||
Thomi Richards (community) | Needs Fixing | ||
Review via email:
|
Commit message
Autopilot: added the testing support for the panel
Description of the change
Tests for the branch lp:~3v1n0/unity/panel-p-cleanup
To post a comment you must log in.
Hi,
16 void PanelIndicatorE ntryView: :AddProperties( GVariantBuilder * builder)
17 {
18 + std::string type_name;
19 +
20 + switch (GetType())
21 + {
22 + case INDICATOR:
23 + type_name = "indicator";
24 + break;
25 + case MENU:
26 + type_name = "menu";
27 + break;
28 + default:
29 + type_name = "other";
30 + }
Can we make this conformant to the OCP? Create a 'virtual std::string GetTypeName() const', and have derived classes return their type string. That way, when you add a new indicator type, this code won't break.
...... on the python side:
220 +from autopilot. keybindings import KeybindingsHelper emulators. X11 import Mouse, ScreenGeometry emulators. unity import UnityIntrospect ionObject
221 +from autopilot.
222 +from autopilot.
Imports must be alphabetical, so like this:
from autopilot. emulators. X11 import Mouse, ScreenGeometry emulators. unity import UnityIntrospect ionObject keybindings import KeybindingsHelper
from autopilot.
from autopilot.
230 + def get_panel_ for_monitor( self, monitor_num): children_ by_type( UnityPanel, monitor= monitor_ num)
231 + """Return an instance of panel for the specified monitor, or None."""
232 + panels = self.get_
233 + return panels[0] if panels else None
Isn't it guaranteed that there will be exactly one panel for every monitor? If so, this code should be:
def get_panel_ for_monitor( self, monitor_num): children_ by_type( UnityPanel, monitor= monitor_ num)
"""Return an instance of panel for the specified monitor."""
panels = self.get_
assert( len(panels) == 1)
return panels[0]
235 + def get_active_ panel(self) : children_ by_type( UnityPanel, active=True)
236 + """Return the active panel, or None."""
237 + panels = self.get_
238 + assert(len(panels) == 1)
239 + return panels[0] if panels else None
You can change the return statement here to be 'return panels[0]'. If panels is empty, the return statement won't ever get hit, thanks to the assert.
241 + def get_panels(self): children_ by_type( UnityPanel)
242 + """Return the available panels, or None."""
243 + return self.get_
This might be nicer as a property? like this:
@property children_ by_type( UnityPanel)
def get_panels(self):
"""Return the available panels, or None."""
return self.get_
244 + UnityIntrospect ionObject, KeybindingsHelper):
245 +class UnityPanel(
PEP8 needs two spaces between items at the module-level, so please add ane xtra blank line here.
293 + if menu_entries and len(menu_entries) > 0:
An empty list evaluates to False, so you can just write 'if menu_entries:'
last_x = menu_entries[ len(menu_ entries) -1].x + menu_entries[ len(menu_ entries) -1].width / 2
this is better written as this:
last_x = menu_entries[-1].x + menu_entries[ -1].width / 2
317 + def get_indicator_ entry(self, id): indicator_ entries( ):
318 + """Returns the indicator entry for the given ID or None"""
319 + for en in self.get_
320 + if en.id == id:
321 + return en
322 +
323 + return None
This can be simplified:
entries = filter(lambda e: e.id == id, self.get_ indicator_ entries( ))
return entries[0] if entries else None
443 + entries = []
You don't need this line ^^
553 +from autopilot.tests import AutopilotTestCase
554 +from autopilot....