Merge lp://staging/~zsombi/ubuntu-ui-toolkit/70-cpos into lp://staging/ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri
Status: Merged
Approved by: Tim Peeters
Approved revision: 1362
Merged at revision: 1367
Proposed branch: lp://staging/~zsombi/ubuntu-ui-toolkit/70-cpos
Merge into: lp://staging/ubuntu-ui-toolkit/staging
Prerequisite: lp://staging/~zsombi/ubuntu-ui-toolkit/listitem-master
Diff against target: 329 lines (+250/-0)
7 files modified
modules/Ubuntu/Components/Themes/Ambiance/ListItemPanel.qml (+1/-0)
tests/autopilot/ubuntuuitoolkit/__init__.py (+2/-0)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py (+4/-0)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_uclistitem.py (+87/-0)
tests/autopilot/ubuntuuitoolkit/emulators.py (+2/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.ListItemTestCase.qml (+68/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.py (+86/-0)
To merge this branch: bzr merge lp://staging/~zsombi/ubuntu-ui-toolkit/70-cpos
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Tim Peeters Approve
Leo Arias (community) Needs Fixing
Review via email: mp+243506@code.staging.launchpad.net

Commit message

CPOs

To post a comment you must log in.
Revision history for this message
Tim Peeters (tpeeters) wrote :

 + def _click_on_panel_action(self, swipe_direction, action_object):
101 + self._swipe_content(swipe_direction)
102 + try:
103 + button_name = 'actionbutton_' + action_object
104 + action_button = self.select_single(objectName=button_name)
105 + except dbus.StateNotFound:
106 + raise _common.ToolkitException(
107 + 'The requested action not found on leading side')

the exception text is incorrect, swipe direction may be 'left', then you are looking for an action on trailing side.

review: Needs Fixing
Revision history for this message
Tim Peeters (tpeeters) wrote :

swipe_direction is ambiguous. Is it swipe TO this direction or swipe FROM? Perhaps rename the variable to "swipe_to_direction"?

Revision history for this message
Tim Peeters (tpeeters) wrote :

115 + def click_leading_action(self, action_objectName):
120 + def click_trailing_action(self, action_objectName):

Maybe trigger_{leading,trailing}_action(..) is better here. You click on a button to trigger the action.

Revision history for this message
Tim Peeters (tpeeters) wrote :

114 + @autopilot_logging.log_action(logger.info)
115 + def click_leading_action(self, action_objectName):
116 + """Swipe the item in from left to right to open leading actions."""
117 + self._click_on_panel_action('right', action_objectName)
118 +
119 + @autopilot_logging.log_action(logger.info)
120 + def click_trailing_action(self, action_objectName):
121 + """Swipe the item in from right to left to open trailing actions."""
122 + self._click_on_panel_action('left', action_objectName)

You do more than just swipe in these functions.
Add something similar to this to the descriptions: "and click on the button representing the requested action".

Revision history for this message
Tim Peeters (tpeeters) wrote :

244 + Label {
245 + id: triggeredAction
246 + height: paintedHeight
247 + objectName: "triggeredAction"
248 + }

It is better to anchor this somewhere. Who knows where it may end up now?

Revision history for this message
Tim Peeters (tpeeters) wrote :

237 +MainView {

I propose to use a MainView with a Page inside (then there is a header), or simply to use an Item in which you test the ListView with ListItems.

Revision history for this message
Tim Peeters (tpeeters) wrote :

244 + Label {
245 + id: triggeredAction
246 + height: paintedHeight
247 + objectName: "triggeredAction"
248 + }

I prefer an initial label of "no action triggered", and when an action is triggered label.text = objectName + " action triggered". Adds a little bit of clarity when watching the videos of a failed test.

Revision history for this message
Tim Peeters (tpeeters) wrote :

We should also test what happens when you self.test_listitem.click_leading_action('this_action_does_not_exist')

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

> 244 + Label {
> 245 + id: triggeredAction
> 246 + height: paintedHeight
> 247 + objectName: "triggeredAction"
> 248 + }
>
> It is better to anchor this somewhere. Who knows where it may end up now?

Any item unanchored is positioned to (0,0), you should know that. Everyone should know that.

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

> + def _click_on_panel_action(self, swipe_direction, action_object):
> 101 + self._swipe_content(swipe_direction)
> 102 + try:
> 103 + button_name = 'actionbutton_' + action_object
> 104 + action_button =
> self.select_single(objectName=button_name)
> 105 + except dbus.StateNotFound:
> 106 + raise _common.ToolkitException(
> 107 + 'The requested action not found on leading side')
>
>
> the exception text is incorrect, swipe direction may be 'left', then you are
> looking for an action on trailing side.

Aah, right, I forgot to adjust that message when moved the code in one function. Fix in the next revision.

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

> swipe_direction is ambiguous. Is it swipe TO this direction or swipe FROM?
> Perhaps rename the variable to "swipe_to_direction"?

Uhm... I think this naming is widely used and means always the destination direction. You specify "to" and "from" only if you have both parameters in a function.

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

> 115 + def click_leading_action(self, action_objectName):
> 120 + def click_trailing_action(self, action_objectName):
>
> Maybe trigger_{leading,trailing}_action(..) is better here. You click on a
> button to trigger the action.

Ack, changed.

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

> > swipe_direction is ambiguous. Is it swipe TO this direction or swipe FROM?
> > Perhaps rename the variable to "swipe_to_direction"?
>
> Uhm... I think this naming is widely used and means always the destination
> direction. You specify "to" and "from" only if you have both parameters in a
> function.

Actually I reformatted that part so now it uses panel_item (leading/trailing) to identify which panel to be swiped in.

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

> 237 +MainView {
>
> I propose to use a MainView with a Page inside (then there is a header), or
> simply to use an Item in which you test the ListView with ListItems.

Ok, I'll do that. But then having a label in a view and under it the list view makes not much sense, we can use the app title to store the action triggered.

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

> We should also test what happens when you
> self.test_listitem.click_leading_action('this_action_does_not_exist')

Done.

Revision history for this message
Tim Peeters (tpeeters) wrote :

> > 244 + Label {
> > 245 + id: triggeredAction
> > 246 + height: paintedHeight
> > 247 + objectName: "triggeredAction"
> > 248 + }
> >
> > It is better to anchor this somewhere. Who knows where it may end up now?
>
> Any item unanchored is positioned to (0,0), you should know that. Everyone
> should know that.

Do you have a reference for that?

Revision history for this message
Tim Peeters (tpeeters) wrote :

should we rename _click_on_panel_action() to _trigger_action() or _click_on_panel_button() ?

Revision history for this message
Tim Peeters (tpeeters) wrote :

good

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

Looks pretty good. Just, please change the last two tests to something like this:

def test_trigger_nonexistent_leading_action(self):
    error = self.assertRaises(
       ubuntuuitoolkit.ToolkitException,
       self.test_listitem.trigger_leading_action,
       'this_action_does_not_exist')
    self.assertEqual(
        str(error),
       'The requested action not found on leading side')

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

thanks

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
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches