~nskaggs/ubuntu-ui-toolkit/add-popover-object-support

« back to all changes in this revision

Viewing changes to tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/listitems.py

  • Committer: CI bot
  • Author(s): Zsombor Egri, Tarmac, Zoltán Balogh
  • Date: 2014-06-18 17:10:31 UTC
  • mfrom: (1000.76.9 landing_04-06)
  • Revision ID: ps-jenkins@lists.canonical.com-20140618171031-1s026ulaxymh2e9f
  [Leo Arias ]
  * On the autopilot helper for the header, fix the swipe to show
    when hidden.
  * Added a fixture for autopilot tests to use a fake home directory.
    Fixes: https://bugs.launchpad.net/bugs/1317639
  * Cleaned the containers in unity test using the alternate
    launcher.

  [ Christian Dywan ]   
  * Add a launcher with a switch for the QQMLEngine.

  [ Tim Peeters ]
  * Anchor the internal PageTreeNode of PageStack to fill its parent.
    Fixes: https://bugs.launchpad.net/bugs/1322527
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
    def swipe_to_delete(self, direction='right'):
43
43
        """Swipe the item in a specific direction."""
44
44
        if self.removable:
 
45
            # Swipe to delete is always right to left
 
46
            if direction == 'left':
 
47
                direction = 'right'
45
48
            self._drag_pointing_device_to_delete(direction)
46
49
            if self.confirmRemoval:
47
50
                self.waitingConfirmationForRemoval.wait_for(True)
52
55
                'The item "{0}" is not removable'.format(self.objectName))
53
56
 
54
57
    def _drag_pointing_device_to_delete(self, direction):
55
 
        x, y, w, h = self.globalRect
56
 
        tx = x + (w // 8)
57
 
        ty = y + (h // 2)
 
58
        x, y, width, height = self.globalRect
 
59
        left_x = x + (width * 0.2)
 
60
        right_x = x + (width * 0.8)
 
61
        start_y = stop_y = y + (height // 2)
58
62
 
59
63
        if direction == 'right':
60
 
            self.pointing_device.drag(tx, ty, w, ty)
 
64
            start_x = left_x
 
65
            stop_x = right_x
 
66
            self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
61
67
        elif direction == 'left':
62
 
            self.pointing_device.drag(w - (w*0.1), ty, x, ty)
 
68
            start_x = right_x
 
69
            stop_x = left_x
 
70
            self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
63
71
        else:
64
72
            raise _common.ToolkitException(
65
73
                'Invalid direction "{0}" used on swipe to delete function'