Merge lp:~nskaggs/ubuntu-ui-toolkit/add-popover-object-support into lp:ubuntu-ui-toolkit

Proposed by Nicholas Skaggs
Status: Work in progress
Proposed branch: lp:~nskaggs/ubuntu-ui-toolkit/add-popover-object-support
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 80 lines (+38/-16)
1 file modified
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py (+38/-16)
To merge this branch: bzr merge lp:~nskaggs/ubuntu-ui-toolkit/add-popover-object-support
Reviewer Review Type Date Requested Status
Zsombor Egri Needs Information
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+225404@code.launchpad.net

Commit message

Add objectname support to ActionSelectionPopover

Description of the change

Add objectname support to ActionSelectionPopover

To post a comment you must log in.
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Needs to add tests . . .

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

So I don't forget :-)

elopio> 56 + if button is None:
<elopio> 57 + raise _common.ToolkitException(
<elopio> 58 + 'Button with text "{0}" not found.'.format(text))
<elopio> that's old autopilot. Now select_single will raise an exception instead of returning None.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Also add logger.warn to deprecated click by text

add a logger.warn('This is dreprecated, please use this other one.')

Revision history for this message
Zsombor Egri (zsombi) wrote :

> Also add logger.warn to deprecated click by text
>
> add a logger.warn('This is dreprecated, please use this other one.')

Nikchiolas, is this MR still valid? If yes, please re-submit to staging! Thx ;)

review: Needs Information
Revision history for this message
Zsombor Egri (zsombi) wrote :

> Also add logger.warn to deprecated click by text
>
> add a logger.warn('This is dreprecated, please use this other one.')

Nikchiolas, is this MR still valid? If yes, please re-submit to staging! Thx ;)

review: Needs Information

Unmerged revisions

1037. By Nicholas Skaggs

add objectname support to ActionSelectionPopover

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py'
2--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py 2014-04-25 18:39:51 +0000
3+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py 2014-07-02 21:36:22 +0000
4@@ -28,39 +28,61 @@
5 class ActionSelectionPopover(_common.UbuntuUIToolkitCustomProxyObjectBase):
6 """ActionSelectionPopover Autopilot emulator."""
7
8+
9+ def click_button(self, object_name):
10+ """Click a button on the popover.
11+
12+ :parameter object_name: The QML objectName property of the button.
13+ :raise ToolkitException: If the object is not found.
14+
15+ """
16+ if not self.visible:
17+ raise _common.ToolkitException('The popover is not open.')
18+ button = self._get_button(object_name)
19+ self._click_button(button)
20+
21+
22 def click_button_by_text(self, text):
23 """Click a button on the popover.
24
25- XXX We are receiving the text because there's no way to set the
26- objectName on the action. This is reported at
27- https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1205144
28- --elopio - 2013-07-25
29-
30 :parameter text: The text of the button.
31 :raise ToolkitException: If the popover is not open.
32
33 """
34 if not self.visible:
35 raise _common.ToolkitException('The popover is not open.')
36- button = self._get_button(text)
37- if button is None:
38- raise _common.ToolkitException(
39- 'Button with text "{0}" not found.'.format(text))
40+ button = self._get_button_by_text(text)
41+ self._click_button(button)
42+
43+ def _get_button_by_text(self, text):
44+ buttons = self.select_many('Empty')
45+ for obj in buttons:
46+ if obj.text == text:
47+ button = obj
48+ break
49+ if button is None:
50+ raise _common.ToolkitException(
51+ 'Button with text "{0}" not found.'.format(text))
52+ return button
53+
54+ def _get_button(self, object_name):
55+ button = self.select_single('Standard', objectName=object_name)
56+ if button is None:
57+ raise _common.ToolkitException(
58+ 'Button with text "{0}" not found.'.format(text))
59+ return button
60+
61+ def _click_button(self, button):
62 self.pointing_device.click_object(button)
63 if self.autoClose:
64 try:
65+ #currently this fails due to
66+ #https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1336945
67 self.visible.wait_for(False)
68 except dbus.StateNotFoundError:
69 # The popover was removed from the tree.
70 pass
71
72- def _get_button(self, text):
73- buttons = self.select_many('Empty')
74- for button in buttons:
75- if button.text == text:
76- return button
77-
78-
79 class ComposerSheet(_common.UbuntuUIToolkitCustomProxyObjectBase):
80 """ComposerSheet Autopilot emulator."""
81

Subscribers

People subscribed via source and target branches

to status/vote changes: