~vthompson/ubuntu-weather-app/fix-1452499

« back to all changes in this revision

Viewing changes to tests/autopilot/ubuntu_weather_app/__init__.py

  • Committer: Victor Thompson
  • Date: 2015-08-07 23:50:08 UTC
  • Revision ID: victor.thompson@gmail.com-20150807235008-t2oshg8hud15lkux
* Create autopilot test which removes a single location

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
        return self.select_single(WeatherListItem,
140
140
                                  objectName="location" + str(index))
141
141
 
 
142
    def remove_single_location(self, index):
 
143
        list_item = self.get_location(0)
 
144
        x, y, width, height = list_item.globalRect
 
145
        start_x = x + (width * 0.2)
 
146
        stop_x = x + (width * 0.8)
 
147
        start_y = stop_y = y + (height // 2)
 
148
 
 
149
        self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
 
150
 
 
151
        list_item.select_remove()
 
152
 
142
153
 
143
154
class MainView(MainView):
144
155
    """Autopilot custom proxy object for the MainView."""
152
163
class WeatherListItem(UbuntuUIToolkitCustomProxyObjectBase):
153
164
    def get_name(self):
154
165
        return self.select_single("Label", objectName="name").text
 
166
 
 
167
    @click_object
 
168
    def select_remove(self):
 
169
        return self.select_single(objectName="swipeDeleteAction")