Merge lp:~artmello/gallery-app/gallery-app-fix_1430357 into lp:gallery-app

Proposed by Arthur Mello
Status: Merged
Approved by: Bill Filler
Approved revision: 1187
Merged at revision: 1186
Proposed branch: lp:~artmello/gallery-app/gallery-app-fix_1430357
Merge into: lp:gallery-app
Diff against target: 202 lines (+65/-27)
5 files modified
rc/qml/MediaViewer/SingleMediaViewer.qml (+2/-1)
tests/autopilot/gallery_app/emulators/events_view.py (+18/-15)
tests/autopilot/gallery_app/emulators/picker_screen.py (+8/-3)
tests/autopilot/gallery_app/tests/test_photo_viewer.py (+35/-5)
tests/autopilot/gallery_app/tests/test_picker_mode.py (+2/-3)
To merge this branch: bzr merge lp:~artmello/gallery-app/gallery-app-fix_1430357
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+255314@code.launchpad.net

Commit message

Change thumbnail's image provider header for videos on SingleMediaViewer

Description of the change

Change thumbnail's image provider header for videos on SingleMediaViewer

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1185. By Arthur Mello

Add AP test to make sure the video thumbnail will be always loaded

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1186. By Arthur Mello

Fix AP test

1187. By Arthur Mello

Fix AP test

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'rc/qml/MediaViewer/SingleMediaViewer.qml'
2--- rc/qml/MediaViewer/SingleMediaViewer.qml 2015-03-18 00:16:08 +0000
3+++ rc/qml/MediaViewer/SingleMediaViewer.qml 2015-04-08 16:43:02 +0000
4@@ -36,6 +36,7 @@
5 property bool fullyZoomed: flickable.sizeScale == zoomPinchArea.maximumZoom
6 property bool fullyUnzoomed: flickable.sizeScale == zoomPinchArea.minimumZoom
7 property bool animateMediaOnHeight: false
8+ property bool imageReady: image.status == Image.Ready
9
10 property alias paintedHeight: image.paintedHeight
11 property alias paintedWidth: image.paintedWidth
12@@ -152,7 +153,7 @@
13 anchors.fill: parent
14 asynchronous: true
15 cache: false
16- source: "image://photo/" + mediaSource.path
17+ source: viewer.isVideo ? "image://thumbnailer/" + mediaSource.path : "image://photo/" + mediaSource.path
18 sourceSize {
19 width: viewer.maxDimension
20 height: viewer.maxDimension
21
22=== modified file 'tests/autopilot/gallery_app/emulators/events_view.py'
23--- tests/autopilot/gallery_app/emulators/events_view.py 2015-02-27 19:17:38 +0000
24+++ tests/autopilot/gallery_app/emulators/events_view.py 2015-04-08 16:43:02 +0000
25@@ -46,20 +46,23 @@
26 photo_delegates = event.select_many(objectName='eventPhoto')
27 return len(photo_delegates)
28
29- def _get_image_in_event_view(self, image_name, event_index_num=0):
30+ def _get_image_in_event_view(self, image_name):
31 """Return the photo of the gallery based on image name.
32
33 :param image_name: the name of the photo in the event to return"""
34- event = self.get_event(event_index_num)
35- photos = event.select_many(
36- 'QQuickItem',
37- objectName='eventPhoto'
38- )
39- for photo in photos:
40- images = photo.select_many('QQuickImage')
41- for image in images:
42- if str(image.source).endswith(image_name):
43- return image
44+ events = self.app.select_many('OrganicMediaList')
45+ for event in events:
46+ photos = event.select_many(
47+ 'QQuickItem',
48+ objectName='eventPhoto'
49+ )
50+ for photo in photos:
51+ images = photo.select_many('QQuickImage')
52+ for image in images:
53+ image.status.wait_for(1)
54+ src = image.source.split('?')[0]
55+ if str(src).endswith(image_name):
56+ return image
57 raise GalleryAppException(
58 'Photo with image name {} could not be found'.format(image_name))
59
60@@ -75,18 +78,18 @@
61 for photo in photos:
62 images = photo.select_many('QQuickImage')
63 for image in images:
64- if str(image.source).endswith(image_name):
65+ src = image.source.split('?')[0]
66+ if str(src).endswith(image_name):
67 return photo
68 raise GalleryAppException(
69 'Photo with image name {} could not be found'.format(image_name))
70
71- def click_photo(self, photo_name, event_index_num=0):
72+ def click_photo(self, photo_name):
73 """Click photo with name and event
74
75 :param photo_name: name of file to click
76- :param event_index_num: index of event to click
77 """
78- photo = self._get_image_in_event_view(photo_name, event_index_num)
79+ photo = self._get_image_in_event_view(photo_name)
80 self.pointing_device.click_object(photo)
81
82 def select_photo(self, photo_name, event_index_num=0):
83
84=== modified file 'tests/autopilot/gallery_app/emulators/picker_screen.py'
85--- tests/autopilot/gallery_app/emulators/picker_screen.py 2015-02-16 22:30:28 +0000
86+++ tests/autopilot/gallery_app/emulators/picker_screen.py 2015-04-08 16:43:02 +0000
87@@ -53,9 +53,14 @@
88 Return the ShapeItem container object for the named photo.
89 This object can be clicked to enable the photo to be selected.
90 """
91- photo_element = self.grid_view().wait_select_single(
92- 'QQuickImage', source=photo_name)
93- return photo_element.get_parent()
94+ elements = self.grid_view().select_many('QQuickImage')
95+ for element in elements:
96+ element.status.wait_for(1)
97+ src = element.source.split('?')[0]
98+ if str(src).endswith(photo_name):
99+ return element.get_parent()
100+ raise GalleryAppException(
101+ 'Photo with image name {} could not be found'.format(photo_name))
102
103 def select_named_photo(self, photo_name):
104 """Select the named photo from the picker view."""
105
106=== modified file 'tests/autopilot/gallery_app/tests/test_photo_viewer.py'
107--- tests/autopilot/gallery_app/tests/test_photo_viewer.py 2015-03-02 14:57:45 +0000
108+++ tests/autopilot/gallery_app/tests/test_photo_viewer.py 2015-04-08 16:43:02 +0000
109@@ -19,6 +19,7 @@
110 from gallery_app.tests import GalleryTestCase
111
112 import os
113+import shutil
114 from time import sleep
115 import unittest
116
117@@ -27,7 +28,7 @@
118 """
119
120
121-class TestPhotoViewerBase(GalleryTestCase):
122+class TestMediaViewerBase(GalleryTestCase):
123 @property
124 def photo_viewer(self):
125 return PhotoViewer(self.app)
126@@ -38,9 +39,8 @@
127
128 def setUp(self):
129 self.ARGS = []
130- super(TestPhotoViewerBase, self).setUp()
131+ super(TestMediaViewerBase, self).setUp()
132 self.main_view.switch_to_tab("eventsTab")
133- self.open_first_photo()
134
135 def open_first_photo(self):
136 self.assertThat(
137@@ -57,7 +57,10 @@
138 self.assertThat(photo_viewer.visible, Eventually(Equals(True)))
139
140
141-class TestPhotoViewer(TestPhotoViewerBase):
142+class TestPhotoViewer(TestMediaViewerBase):
143+ def setUp(self):
144+ super(TestPhotoViewer, self).setUp()
145+ self.open_first_photo()
146
147 @unittest.skip("Temporarily disable as it fails in some cases, "
148 "supposedly due to problems with the infrastructure")
149@@ -198,10 +201,37 @@
150 self.assertThat(list.currentIndex, Eventually(Equals(0)))
151
152
153-class TestPhotoEditor(TestPhotoViewerBase):
154+class TestVideoViewer(TestMediaViewerBase):
155+ def test_video_loads_thumbnail(self):
156+ num_events = self.events_view.number_of_events()
157+
158+ video_file = "video.mp4"
159+ shutil.copyfile(self.sample_dir+"/option01/"+video_file,
160+ self.sample_destination_dir+"/"+video_file)
161+
162+ self.assertThat(
163+ lambda: self.events_view.number_of_events(),
164+ Eventually(Equals(num_events + 1))
165+ )
166+
167+ self.events_view.click_photo(video_file)
168+
169+ photo_viewer_loader = self.photo_viewer.get_main_photo_viewer_loader()
170+ self.assertThat(photo_viewer_loader.loaded, Eventually(Equals(True)))
171+ sleep(1)
172+ photo_viewer = self.photo_viewer.get_main_photo_viewer()
173+ self.assertThat(photo_viewer.visible, Eventually(Equals(True)))
174+ photo_component = self.photo_viewer.get_photo_component()
175+ self.assertThat(photo_component.imageReady, Eventually(Equals(True)))
176+
177+ os.remove(self.sample_destination_dir+"/"+video_file)
178+
179+
180+class TestPhotoEditor(TestMediaViewerBase):
181
182 def setUp(self):
183 super(TestPhotoEditor, self).setUp()
184+ self.open_first_photo()
185 self.click_edit_button()
186 self.media_view = self.app.select_single(MediaViewer)
187
188
189=== modified file 'tests/autopilot/gallery_app/tests/test_picker_mode.py'
190--- tests/autopilot/gallery_app/tests/test_picker_mode.py 2015-02-27 18:47:12 +0000
191+++ tests/autopilot/gallery_app/tests/test_picker_mode.py 2015-04-08 16:43:02 +0000
192@@ -70,9 +70,8 @@
193 self.assertFalse(pick_button.enabled)
194
195 # create the image location path based on sample location
196- image_path = 'image://thumbnailer/file://{}/sample02.jpg'.format(
197- self.sample_destination_dir)
198- photos_page.select_named_photo(image_path)
199+ image_file = 'sample02.jpg'
200+ photos_page.select_named_photo(image_file)
201 self.assertThat(pick_button.enabled, Eventually(Equals(True)))
202 self.picker_view.click_pick_button()
203

Subscribers

People subscribed via source and target branches