Merge lp:~nik90/ubuntu-clock-app/remove-optionselector-ap-hack into lp:ubuntu-clock-app/saucy

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 417
Merged at revision: 417
Proposed branch: lp:~nik90/ubuntu-clock-app/remove-optionselector-ap-hack
Merge into: lp:ubuntu-clock-app/saucy
Diff against target: 99 lines (+9/-47)
1 file modified
tests/autopilot/ubuntu_clock_app/emulators.py (+9/-47)
To merge this branch: bzr merge lp:~nik90/ubuntu-clock-app/remove-optionselector-ap-hack
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Nicholas Skaggs (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Leo Arias (community) code review Approve
Nekhelesh Ramananthan Needs Information
Review via email: mp+220727@code.launchpad.net

Commit message

Removed the custom OptionSelector AP emulator function that was written and replaces it with the official SDK AP emualator function.

Description of the change

This MP removes the custom OptionSelector AP emulator function that was written and replaces it with the official SDK AP emualator function. The code is much cleaner now.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

There is just one small thing that I expected in the SDK emulator function. Currently if part of the optionselector is hidden, the emulator does not scroll up before clicking on the optionselector item. As a result, I have had to add,

52 # Wait for the option selector to expand
55 if not day_option_selector.currentlyExpanded:
56 # Click on days option selector to expand it
57 self.pointing_device.click_object(day_option_selector)

59 if not self.main_view.wideAspect:
60 self.drag_page_up()

Should I report a bug about this in the SDK? Or are there any better ideas?

review: Needs Information
416. By Nekhelesh Ramananthan

Added fixme notes where required

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
417. By Nekhelesh Ramananthan

merge trunk

Revision history for this message
Leo Arias (elopio) wrote :

Nice! A lot less code. Thanks for cleaning up.

review: Approve (code review)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

thanks for adding the #fixme comment :)

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntu_clock_app/emulators.py'
2--- tests/autopilot/ubuntu_clock_app/emulators.py 2014-05-22 16:50:45 +0000
3+++ tests/autopilot/ubuntu_clock_app/emulators.py 2014-05-23 07:57:57 +0000
4@@ -284,34 +284,9 @@
5
6 """
7 time_format_selector = self.proxy_object.wait_select_single(
8- 'OptionSelector', objectName='timeFormatSelector')
9-
10- # Wait for the option selector to expand
11- # FIXME: Replace this when the ui toolkit provides option selector
12- # emulator functions. http://pad.lv/1277059 -- nik90 2014-03-06
13- if not time_format_selector.currentlyExpanded:
14- # Click on time format option selector to expand it
15- self.proxy_object.pointing_device.click_object(
16- time_format_selector)
17- sleep(2)
18- time_format_selector.currentlyExpanded.wait_for(True)
19-
20- # Grab the labels after the option selector has expanded
21- time_format_object = time_format_selector.select_single(
22- 'StyledItem', objectName='listContainer')
23- time_formats = time_format_object.select_many('Label', visible=True)
24-
25- for index, format_element in enumerate(time_formats):
26- if format_element.text == format:
27- format_index = index
28- break
29- else:
30- raise ClockEmulatorException(
31- 'Unknown settings option: {}'.format(format))
32-
33- # Click on the time format option
34- self.proxy_object.pointing_device.click_object(
35- time_formats[format_index])
36+ toolkit_emulators.OptionSelector, objectName='timeFormatSelector')
37+
38+ time_format_selector.select_option('Label', text=format)
39
40
41 class StopwatchPage(Page):
42@@ -412,7 +387,7 @@
43 add_alarm_page.set_single_alarm_day(day)
44 # FIXME: The swipe down is a temporary fix which is needed until
45 # https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/ap-header-show
46- # is resolved
47+ # is resolved --nik90 2014-05-23
48 if not self.main_view.wideAspect:
49 self.drag_page_down()
50 self._click_save()
51@@ -434,7 +409,7 @@
52 add_alarm_page.set_recurring_alarm_days(days)
53 # FIXME: The swipe down is a temporary fix which is needed until
54 # https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/ap-header-show
55- # is resolved
56+ # is resolved --nik90 2014-05-23
57 if not self.main_view.wideAspect:
58 self.drag_page_down()
59 self._click_save()
60@@ -600,35 +575,22 @@
61 :param day: single day on which alarm is triggered
62
63 """
64- # TODO: we need a proper UITK emulator for optionSelector
65- # http://pad.lv/1277059 --nik90 2014-02-06
66 day_option_selector = self.select_single(
67- 'OptionSelector', objectName='OccursSelector')
68+ toolkit_emulators.OptionSelector, objectName='OccursSelector')
69
70 # Wait for the option selector to expand
71- # FIXME: Replace this when the ui toolkit provides option selector
72- # emulator functions. -- nik90 2014-03-06
73 if not day_option_selector.currentlyExpanded:
74 # Click on days option selector to expand it
75 self.pointing_device.click_object(day_option_selector)
76 sleep(2)
77 day_option_selector.currentlyExpanded.wait_for(True)
78
79+ # FIXME: This swipe up is not required once
80+ # http://pad.lv/1322472 is fixed. --nik90 2014-05-23
81 if not self.main_view.wideAspect:
82 self.drag_page_up()
83
84- days_object = day_option_selector.select_single(
85- 'StyledItem', objectName='listContainer')
86- dayslist = days_object.select_many('Label', visible=True)
87-
88- for index, day_element in enumerate(dayslist):
89- if day_element.text == day:
90- day_index = index
91- break
92- else:
93- raise ClockEmulatorException('Unknown day: {}'.format(day))
94-
95- self.pointing_device.click_object(dayslist[day_index])
96+ day_option_selector.select_option('Label', text=day)
97
98 @autopilot_logging.log_action(logger.info)
99 def set_recurring_alarm_days(self, days):

Subscribers

People subscribed via source and target branches