We can't set the objectName to a ActionSelectionPopover Action

Bug #1205144 reported by Leo Arias
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Ubuntu UI Toolkit
Fix Committed
Undecided
Unassigned
ubuntu-ui-toolkit (Ubuntu)
Fix Released
High
Cris Dywan

Bug Description

I'm writing tests to the ubuntu-filemanager-app. It has an ActionSelectionPopover with the actions you can do execute on a file, like rename, delete, etc.

I'd like autopilot to click the rename button, but currently I can only do it selecting the object by its text. This is bad as the text can change and it will fail on a machine with a different language. It would be better to select it by objectName.

But, if I do something like this:

Action {
                objectName: "rename"
                text: i18n.tr("Rename")
}

The objectName I assigned is not present on the element.

Related branches

Leo Arias (elopio)
Changed in ubuntu-ui-toolkit:
status: New → Confirmed
Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

ActionSelectionPopover uses a delegate to create the actual visual component that represents the Action.

If you set the objectName to the Action, it's not directly available in the ActionSelectionPopover elements if you don't set a unique objectName to the delegate element as well.

If you are using ListItems.Standard as your delegate the Action is available from Standard.action property, so in theory at least you should be able to access the objectName you set to the Action through:

    <delegate>.action.objectName

I'm only guessing here right now, so please provide some example code what you are trying to do.

Changed in ubuntu-ui-toolkit:
status: Confirmed → Incomplete
Revision history for this message
Leo Arias (elopio) wrote :

Great. So, with a qml like the attached I get an element with the objectName.
I think this will work :)

Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

elopio: ok. Will mark Invalid (not a bug) for now. Feel free to reopen if necessary.

Changed in ubuntu-ui-toolkit:
status: Incomplete → Invalid
Revision history for this message
Tim Peeters (tpeeters) wrote :

I solved the same issue with the header (which has buttons defined by actions) by adding the following to the AbstractButton for each action:

                objectName: action.objectName + "_header_button"

and the AP CPO has a click_action_button(action_object_name) function that knows which object to select

Changed in ubuntu-ui-toolkit:
status: Invalid → Confirmed
Revision history for this message
Tim Peeters (tpeeters) wrote :

Perhaps we can solve it for all cases by setting the objectName for ActionItem to action.objectName + "_item"?

Zoltan Balogh (bzoltan)
Changed in ubuntu-ui-toolkit (Ubuntu):
status: New → Confirmed
Revision history for this message
Cris Dywan (kalikiana) wrote :

I thought about this a bit more as there just was a question on how to handle this. And it also applies to TextInputPopover, albeit internal it currently relies on labels which mismatch as soon as localization isn't English.

I think _item makes sense - at first it seemed to me as tho it might be insufficient because actions can be re-used, but the same container surely won't have more than one ActionItem.

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

I think action.objectName + "_item" will work. But the correct way to make it accessible to the app developers would be to create an ActionSelectionPopover autopilot CPO that has a trigger_action() function (so it will be more work than just updating the ActionSelectionPopover delegate).

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

^it turns out we don't need to create an ActionSelectionPopover CPO. There is already one in _custom_proxy_objects/popups.py that we can extend.

Cris Dywan (kalikiana)
Changed in ubuntu-ui-toolkit (Ubuntu):
assignee: nobody → Christian Dywan (kalikiana)
status: Confirmed → In Progress
importance: Undecided → High
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:ubuntu-ui-toolkit/staging at revision None, scheduled for release in ubuntu-ui-toolkit, milestone Unknown

Changed in ubuntu-ui-toolkit:
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-ui-toolkit - 1.3.1688+15.10.20151018.1-0ubuntu1

---------------
ubuntu-ui-toolkit (1.3.1688+15.10.20151018.1-0ubuntu1) wily; urgency=medium

  [ Tim Peeters ]
  * Add delegate property to ActionBar.
  * Introduce PageHeader component.
  * Add header property to Page.
    Fixes LP: #1248898, LP: #1350893, LP: #1445016, LP: #1492328
  * Use the correct navigation overflow icon in PageHeader.

  [ Loïc Molinari ]
  * Fixed OpenGL ES 2 mipmap fallback. OpenGL ES 2 doesn't support
    GL_TEXTURE_MAX_LEVEL by default, it is only available via an extension. It
    was working on the devices where this extension is available but not on
    the emulator. Fixes LP: #1505221.

  [ Christian Dywan ]
  * Handle incubateObject returning null in PageWrapperUtils.
    Fixes LP: #1505197
  * Add module header to PageWrapperUtils.

  [ Zoltan Balogh ]
  * Improve test plan
    - Ad -q parameter to provision the device for normal use with a PPA
    - Fix up the camera and clock app on the device to acces services
    - Replace phablet tools with manual enabling writable image
    - Fix PPA pin up for staging and other regular PPAs.

  [ Zsombor Egri ]
  * Emit Dropped event for live ListItem drag'n'drop. Fixes LP: #1500118.

  [ Timo Jyrinki ]
  * Build dep on libinput-dev and libxkbcommon-dev (LP: #1437192).

  [ Benjamon Zeller ]
  * Remove unused variables.

  [ CI Train Bot ]
  * No-change rebuild.

 -- Zoltan Balogh <email address hidden> Sun, 18 Oct 2015 03:47:27 +0000

Changed in ubuntu-ui-toolkit (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.