Merge lp:~uriboni/camera-app/broken-video-icon into lp:camera-app/staging

Proposed by Ugo Riboni
Status: Merged
Approved by: Florian Boucault
Approved revision: 665
Merged at revision: 664
Proposed branch: lp:~uriboni/camera-app/broken-video-icon
Merge into: lp:camera-app/staging
Diff against target: 153 lines (+76/-12)
5 files modified
PhotogridView.qml (+10/-0)
SlideshowView.qml (+11/-0)
tests/autopilot/camera_app/emulators/main_window.py (+5/-0)
tests/autopilot/camera_app/tests/__init__.py (+8/-3)
tests/autopilot/camera_app/tests/test_gallery_view.py (+42/-9)
To merge this branch: bzr merge lp:~uriboni/camera-app/broken-video-icon
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Florian Boucault (community) Needs Fixing
Review via email: mp+287795@code.launchpad.net

Commit message

Display a stock icon as the video thumbnail when thumbnailer fails (which it will do now if it can't process a video)

Description of the change

Display a stock icon as the video thumbnail when thumbnailer fails (which it will do now if it can't process a video)

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

Grid view also needs an icon.

review: Needs Fixing
Revision history for this message
Florian Boucault (fboucault) wrote :

Icon needs to be a fixed size

review: Needs Fixing
Revision history for this message
Florian Boucault (fboucault) wrote :

opacity should not be 0.8

review: Needs Fixing
Revision history for this message
Florian Boucault (fboucault) wrote :

 enabled: !media.isVideo should not be part of this MR, but I guess it will fly

663. By Ugo Riboni

Adjust size and opacity, and make sure the icon appears also in case images have broken thumbnails

664. By Ugo Riboni

Add the same feature to the grid view

665. By Ugo Riboni

Rename the icon so it's clear it's not just for videos

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 'PhotogridView.qml'
2--- PhotogridView.qml 2016-02-23 11:46:52 +0000
3+++ PhotogridView.qml 2016-03-03 14:12:40 +0000
4@@ -139,6 +139,16 @@
5 visible: isVideo
6 }
7
8+ Icon {
9+ objectName: "thumbnailLoadingErrorIcon"
10+ anchors.centerIn: parent
11+ width: units.gu(6)
12+ height: width
13+ name: cellDelegate.isVideo ? "stock_video" : "stock_image"
14+ color: "white"
15+ opacity: thumbnail.status == Image.Error ? 1.0 : 0.0
16+ }
17+
18 MouseArea {
19 anchors.fill: parent
20 onClicked: photogridView.photoClicked(index)
21
22=== modified file 'SlideshowView.qml'
23--- SlideshowView.qml 2016-02-23 11:46:52 +0000
24+++ SlideshowView.qml 2016-03-03 14:12:40 +0000
25@@ -183,6 +183,7 @@
26 property real maximumZoom: 3.0
27 property bool active: false
28 property var center
29+ enabled: !media.isVideo
30
31 onPinchStarted: {
32 active = true;
33@@ -258,6 +259,16 @@
34 }
35 fillMode: Image.PreserveAspectFit
36 }
37+
38+ Icon {
39+ objectName: "thumbnailLoadingErrorIcon"
40+ anchors.centerIn: parent
41+ width: units.gu(30)
42+ height: width
43+ name: media.isVideo ? "stock_video" : "stock_image"
44+ color: "white"
45+ opacity: image.status == Image.Error ? 1.0 : 0.0
46+ }
47 }
48
49 Icon {
50
51=== modified file 'tests/autopilot/camera_app/emulators/main_window.py'
52--- tests/autopilot/camera_app/emulators/main_window.py 2015-11-25 17:00:31 +0000
53+++ tests/autopilot/camera_app/emulators/main_window.py 2016-03-03 14:12:40 +0000
54@@ -36,6 +36,11 @@
55 """Returns the gallery view"""
56 return self.app.wait_select_single("GalleryView")
57
58+ def get_broken_video_icon(self):
59+ """Returns the gallery view"""
60+ name = "thumbnailLoadingErrorIcon"
61+ return self.app.wait_select_single(objectName=name)
62+
63 def get_no_media_hint(self):
64 """Returns the Item representing the hint that no media is available"""
65 return self.app.wait_select_single(objectName="noMediaHint")
66
67=== modified file 'tests/autopilot/camera_app/tests/__init__.py'
68--- tests/autopilot/camera_app/tests/__init__.py 2015-05-15 07:29:16 +0000
69+++ tests/autopilot/camera_app/tests/__init__.py 2016-03-03 14:12:40 +0000
70@@ -107,6 +107,11 @@
71 shutil.copyfile(os.path.join(self.sample_dir, "sample.jpg"),
72 os.path.join(self.pictures_dir, "sample.jpg"))
73
74- def add_sample_video(self):
75- shutil.copyfile(os.path.join(self.sample_dir, "sample.mp4"),
76- os.path.join(self.videos_dir, "sample.mp4"))
77+ def add_sample_video(self, broken=False):
78+ if broken:
79+ path = os.path.join(self.videos_dir, "sample_broken.mp4")
80+ with open(path, "w") as video:
81+ video.write("I AM NOT A VIDEO")
82+ else:
83+ shutil.copyfile(os.path.join(self.sample_dir, "sample.mp4"),
84+ os.path.join(self.videos_dir, "sample.mp4"))
85
86=== modified file 'tests/autopilot/camera_app/tests/test_gallery_view.py'
87--- tests/autopilot/camera_app/tests/test_gallery_view.py 2015-04-29 15:56:44 +0000
88+++ tests/autopilot/camera_app/tests/test_gallery_view.py 2016-03-03 14:12:40 +0000
89@@ -7,7 +7,7 @@
90
91 """Tests for the Camera App zoom"""
92
93-from testtools.matchers import Equals
94+from testtools.matchers import Equals, NotEquals
95 from autopilot.matchers import Eventually
96
97 from camera_app.tests import CameraAppTestCase
98@@ -124,14 +124,47 @@
99 def test_video_thumbnails(self):
100 viewfinder = self.main_window.get_viewfinder()
101 gallery = self.main_window.get_gallery()
102-
103- self.main_window.swipe_to_gallery(self)
104-
105- self.assertThat(viewfinder.inView, Eventually(Equals(False)))
106- self.assertThat(gallery.inView, Eventually(Equals(True)))
107-
108- spinner = gallery.wait_select_single("ActivityIndicator")
109- self.assertThat(spinner.running, Eventually(Equals(False)))
110+ thumb_error = self.main_window.get_broken_video_icon()
111+
112+ self.main_window.swipe_to_gallery(self)
113+
114+ self.assertThat(viewfinder.inView, Eventually(Equals(False)))
115+ self.assertThat(gallery.inView, Eventually(Equals(True)))
116+
117+ spinner = gallery.wait_select_single("ActivityIndicator")
118+ self.assertThat(spinner.running, Eventually(Equals(False)))
119+ self.assertThat(thumb_error.opacity, Eventually(Equals(0.0)))
120+
121+
122+class TestCameraGalleryViewWithBrokenVideo(
123+ TestCameraGalleryViewMixin, CameraAppTestCase):
124+ """Tests the camera gallery view with a broken video already present"""
125+
126+ def setUp(self):
127+ self.delete_all_media()
128+ self.add_sample_video(broken=True)
129+
130+ super(TestCameraGalleryViewWithBrokenVideo, self).setUp()
131+ self.assertThat(
132+ self.main_window.get_qml_view().visible, Eventually(Equals(True)))
133+
134+ def tearDown(self):
135+ super(TestCameraGalleryViewWithBrokenVideo, self).tearDown()
136+
137+ """Tests the placeholder thumnails for broken video loads correctly"""
138+ def test_video_thumbnails(self):
139+ viewfinder = self.main_window.get_viewfinder()
140+ gallery = self.main_window.get_gallery()
141+ thumb_error = self.main_window.get_broken_video_icon()
142+
143+ self.main_window.swipe_to_gallery(self)
144+
145+ self.assertThat(viewfinder.inView, Eventually(Equals(False)))
146+ self.assertThat(gallery.inView, Eventually(Equals(True)))
147+
148+ spinner = gallery.wait_select_single("ActivityIndicator")
149+ self.assertThat(spinner.running, Eventually(Equals(False)))
150+ self.assertThat(thumb_error.opacity, Eventually(NotEquals(0.0)))
151
152
153 class TestCameraGalleryViewWithPhoto(

Subscribers

People subscribed via source and target branches