~phablet-team/gallery-app/trunk

« back to all changes in this revision

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

  • Committer: CI Train Bot
  • Author(s): Arthur Mello
  • Date: 2015-04-09 17:57:18 UTC
  • mfrom: (1183.1.4 gallery-app-fix_1430357)
  • Revision ID: ci-train-bot@canonical.com-20150409175718-1rlojfmcn1fo6f1v
Change thumbnail's image provider header for videos on SingleMediaViewer Fixes: #1430357

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        photo_delegates = event.select_many(objectName='eventPhoto')
47
47
        return len(photo_delegates)
48
48
 
49
 
    def _get_image_in_event_view(self, image_name, event_index_num=0):
 
49
    def _get_image_in_event_view(self, image_name):
50
50
        """Return the photo of the gallery based on image name.
51
51
 
52
52
        :param image_name: the name of the photo in the event to return"""
53
 
        event = self.get_event(event_index_num)
54
 
        photos = event.select_many(
55
 
            'QQuickItem',
56
 
            objectName='eventPhoto'
57
 
        )
58
 
        for photo in photos:
59
 
            images = photo.select_many('QQuickImage')
60
 
            for image in images:
61
 
                if str(image.source).endswith(image_name):
62
 
                    return image
 
53
        events = self.app.select_many('OrganicMediaList')
 
54
        for event in events:
 
55
            photos = event.select_many(
 
56
                'QQuickItem',
 
57
                objectName='eventPhoto'
 
58
            )
 
59
            for photo in photos:
 
60
                images = photo.select_many('QQuickImage')
 
61
                for image in images:
 
62
                    image.status.wait_for(1)
 
63
                    src = image.source.split('?')[0]
 
64
                    if str(src).endswith(image_name):
 
65
                        return image
63
66
        raise GalleryAppException(
64
67
            'Photo with image name {} could not be found'.format(image_name))
65
68
 
75
78
        for photo in photos:
76
79
            images = photo.select_many('QQuickImage')
77
80
            for image in images:
78
 
                if str(image.source).endswith(image_name):
 
81
                src = image.source.split('?')[0]
 
82
                if str(src).endswith(image_name):
79
83
                    return photo
80
84
        raise GalleryAppException(
81
85
            'Photo with image name {} could not be found'.format(image_name))
82
86
 
83
 
    def click_photo(self, photo_name, event_index_num=0):
 
87
    def click_photo(self, photo_name):
84
88
        """Click photo with name and event
85
89
 
86
90
        :param photo_name: name of file to click
87
 
        :param event_index_num: index of event to click
88
91
        """
89
 
        photo = self._get_image_in_event_view(photo_name, event_index_num)
 
92
        photo = self._get_image_in_event_view(photo_name)
90
93
        self.pointing_device.click_object(photo)
91
94
 
92
95
    def select_photo(self, photo_name, event_index_num=0):