~om26er/gallery-app/fix_selection_test

« back to all changes in this revision

Viewing changes to tests/autopilot/gallery_app/emulators/gallery_utils.py

  • Committer: Bill Filler
  • Date: 2014-04-04 16:34:27 UTC
  • mfrom: (918.3.27 gallery-app-album-nav)
  • Revision ID: bill.filler@canonical.com-20140404163427-5yjg1t2tkv6ykou1
merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
        return self.app.select_single("Button", objectName="deleteDialogNo",
70
70
                                      visible=True)
71
71
 
72
 
    def get_first_event(self):
73
 
        """Returns the first event in the event view"""
74
 
        return self.app.select_single("OrganicMediaList",
75
 
                                      objectName="organicEventItem0")
76
 
 
77
 
    def number_of_events(self):
78
 
        """Returns the number of events in the event view (might differ to the
79
 
        total number in the model, because of the listview"""
80
 
        return len(self.app.select_many("OrganicMediaList"))
81
 
 
82
 
    def number_of_photos_in_events(self):
83
 
        """Returns the number of events"""
84
 
        photo_delegates = self.app.select_many("QQuickItem",
85
 
                                               objectName="eventPhoto")
86
 
        return len(photo_delegates)
87
 
 
88
 
    def get_first_image_in_event_view(self):
89
 
        """Returns the first photo of the gallery."""
90
 
        event = self.get_first_event()
91
 
        return event.select_many("OrganicItemInteraction",
92
 
                                 objectName='eventsViewPhoto')[1]
93
 
 
94
72
    def get_all_albums(self):
95
73
        """Returns all albums in the albums view"""
96
74
        albums = self.select_many_retry("CheckerboardDelegate",
98
76
        return albums
99
77
 
100
78
    def get_first_album(self):
101
 
        """Returns the first album in the albums view"""
 
79
        """Returns the first album in the albums view."""
 
80
        # For some reasons the albums are returned in inverse order, so
 
81
        # the first album is acutally the last in the array
 
82
        return self.get_album_at(-1)
 
83
 
 
84
    def get_album_at(self, position):
 
85
        """Returns the albums at this position in the albums view"""
102
86
        albums = self.select_many_retry("CheckerboardDelegate",
103
87
                                        objectName="checkerboardDelegate")
104
 
        return albums[-1]
 
88
        return albums[position]
105
89
 
106
90
    def get_edit_album_button(self):
107
91
        """Returns the edit album button in the album popover"""