Merge lp:~fboucault/camera-app/timer_disable_camera into lp:camera-app/staging

Proposed by Florian Boucault
Status: Merged
Approved by: Ugo Riboni
Approved revision: 661
Merged at revision: 663
Proposed branch: lp:~fboucault/camera-app/timer_disable_camera
Merge into: lp:camera-app/staging
Diff against target: 197 lines (+75/-7)
5 files modified
ViewFinderOverlay.qml (+11/-6)
ViewFinderView.qml (+1/-0)
camera-app.qml (+3/-1)
tests/autopilot/camera_app/emulators/main_window.py (+4/-0)
tests/autopilot/camera_app/tests/test_capture.py (+56/-0)
To merge this branch: bzr merge lp:~fboucault/camera-app/timer_disable_camera
Reviewer Review Type Date Requested Status
Ugo Riboni (community) Needs Fixing
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+288304@code.launchpad.net

Commit message

Disable controls and prevent navigation while a delayed/timed shoot is ongoing.

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
Ugo Riboni (uriboni) wrote :

I have to swipe twice while the timer is running to reach the photo roll. The first swipe stops the counter, the second moves to the photo roll. This sounds confusing to me and I am not sure if it is what you intended.

You added an AP test for timed shooting, which is good, but you did not add a test for the feature in this MR.

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

> I have to swipe twice while the timer is running to reach the photo roll. The
> first swipe stops the counter, the second moves to the photo roll. This sounds
> confusing to me and I am not sure if it is what you intended.
>

It is. We don't have (yet) a cancellation button for the timer.

> You added an AP test for timed shooting, which is good, but you did not add a
> test for the feature in this MR.

I did add tests for most of the features in this MR (disabling the various) controls. Not being able to swipe is not tested indeed.

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

> > I have to swipe twice while the timer is running to reach the photo roll.
> The
> > first swipe stops the counter, the second moves to the photo roll. This
> sounds
> > confusing to me and I am not sure if it is what you intended.
> >
>
> It is. We don't have (yet) a cancellation button for the timer.
>
>
> > You added an AP test for timed shooting, which is good, but you did not add
> a
> > test for the feature in this MR.
>
> I did add tests for most of the features in this MR (disabling the various)
> controls. Not being able to swipe is not tested indeed.

Actually, scrap that, the test also checks that swipe is disabled.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ViewFinderOverlay.qml'
--- ViewFinderOverlay.qml 2016-02-23 11:46:52 +0000
+++ ViewFinderOverlay.qml 2016-03-07 15:00:51 +0000
@@ -289,6 +289,7 @@
289 id: bottomEdgeClose289 id: bottomEdgeClose
290 anchors.fill: parent290 anchors.fill: parent
291 onClicked: optionsOverlayClose()291 onClicked: optionsOverlayClose()
292 enabled: !camera.timedCaptureInProgress
292 }293 }
293294
294 OrientationHelper {295 OrientationHelper {
@@ -305,7 +306,7 @@
305 height: optionsOverlayLoader.height306 height: optionsOverlayLoader.height
306 onOpenedChanged: optionsOverlayLoader.item.closeValueSelector()307 onOpenedChanged: optionsOverlayLoader.item.closeValueSelector()
307 enabled: camera.videoRecorder.recorderState == CameraRecorder.StoppedState308 enabled: camera.videoRecorder.recorderState == CameraRecorder.StoppedState
308 && !camera.photoCaptureInProgress309 && !camera.photoCaptureInProgress && !camera.timedCaptureInProgress
309 opacity: enabled ? 1.0 : 0.3310 opacity: enabled ? 1.0 : 0.3
310311
311 /* At startup, opened is false and 'bottomEdge.height' is 0 until312 /* At startup, opened is false and 'bottomEdge.height' is 0 until
@@ -652,13 +653,15 @@
652 enabled: visible653 enabled: visible
653654
654 function timedShoot(secs) {655 function timedShoot(secs) {
656 camera.timedCaptureInProgress = true;
655 timedShootFeedback.start();657 timedShootFeedback.start();
656 shootingTimer.remainingSecs = secs;658 shootingTimer.remainingSecs = secs;
657 shootingTimer.start();659 shootingTimer.start();
658 }660 }
659661
660 function cancelTimedShoot() {662 function cancelTimedShoot() {
661 if (shootingTimer.running) {663 if (camera.timedCaptureInProgress) {
664 camera.timedCaptureInProgress = false;
662 shootingTimer.stop();665 shootingTimer.stop();
663 timedShootFeedback.stop();666 timedShootFeedback.stop();
664 }667 }
@@ -774,6 +777,7 @@
774 onTriggered: {777 onTriggered: {
775 if (remainingSecs == 0) {778 if (remainingSecs == 0) {
776 running = false;779 running = false;
780 camera.timedCaptureInProgress = false;
777 controls.shoot();781 controls.shoot();
778 timedShootFeedback.stop();782 timedShootFeedback.stop();
779 } else {783 } else {
@@ -819,7 +823,7 @@
819 iconName: (camera.captureMode == Camera.CaptureStillImage) ? "camcorder" : "camera-symbolic"823 iconName: (camera.captureMode == Camera.CaptureStillImage) ? "camcorder" : "camera-symbolic"
820 onClicked: controls.changeRecordMode()824 onClicked: controls.changeRecordMode()
821 enabled: camera.videoRecorder.recorderState == CameraRecorder.StoppedState && !main.contentExportMode825 enabled: camera.videoRecorder.recorderState == CameraRecorder.StoppedState && !main.contentExportMode
822 && !camera.photoCaptureInProgress826 && !camera.photoCaptureInProgress && !camera.timedCaptureInProgress
823 }827 }
824828
825 ShootButton {829 ShootButton {
@@ -833,6 +837,7 @@
833 }837 }
834838
835 enabled: viewFinderOverlay.readyForCapture && !storageMonitor.diskSpaceCriticallyLow839 enabled: viewFinderOverlay.readyForCapture && !storageMonitor.diskSpaceCriticallyLow
840 && !camera.timedCaptureInProgress
836 state: (camera.captureMode == Camera.CaptureVideo) ?841 state: (camera.captureMode == Camera.CaptureVideo) ?
837 ((camera.videoRecorder.recorderState == CameraRecorder.StoppedState) ? "record_off" : "record_on") :842 ((camera.videoRecorder.recorderState == CameraRecorder.StoppedState) ? "record_off" : "record_on") :
838 "camera"843 "camera"
@@ -869,7 +874,7 @@
869 }874 }
870875
871 enabled: !camera.switchInProgress && camera.videoRecorder.recorderState == CameraRecorder.StoppedState876 enabled: !camera.switchInProgress && camera.videoRecorder.recorderState == CameraRecorder.StoppedState
872 && !camera.photoCaptureInProgress877 && !camera.photoCaptureInProgress && !camera.timedCaptureInProgress
873 iconName: "camera-flip"878 iconName: "camera-flip"
874 onClicked: controls.switchCamera()879 onClicked: controls.switchCamera()
875 }880 }
@@ -892,7 +897,7 @@
892 property real maximumScale: 3.0897 property real maximumScale: 3.0
893 property bool active: false898 property bool active: false
894899
895 enabled: !camera.photoCaptureInProgress900 enabled: !camera.photoCaptureInProgress && !camera.timedCaptureInProgress
896 onPinchStarted: {901 onPinchStarted: {
897 active = true;902 active = true;
898 initialZoom = zoomControl.value;903 initialZoom = zoomControl.value;
@@ -918,7 +923,7 @@
918 rightMargin: -bottomEdgeIndicators.height923 rightMargin: -bottomEdgeIndicators.height
919 }924 }
920 enabled: camera.focus.isFocusPointModeSupported(Camera.FocusPointCustom) &&925 enabled: camera.focus.isFocusPointModeSupported(Camera.FocusPointCustom) &&
921 !camera.photoCaptureInProgress926 !camera.photoCaptureInProgress && !camera.timedCaptureInProgress
922 onClicked: {927 onClicked: {
923 camera.manualFocus(mouse.x, mouse.y);928 camera.manualFocus(mouse.x, mouse.y);
924 mouse.accepted = false;929 mouse.accepted = false;
925930
=== modified file 'ViewFinderView.qml'
--- ViewFinderView.qml 2016-02-23 11:46:52 +0000
+++ ViewFinderView.qml 2016-03-07 15:00:51 +0000
@@ -96,6 +96,7 @@
96 property alias maximumZoom: camera.maximumDigitalZoom96 property alias maximumZoom: camera.maximumDigitalZoom
97 property bool switchInProgress: false97 property bool switchInProgress: false
98 property bool photoCaptureInProgress: false98 property bool photoCaptureInProgress: false
99 property bool timedCaptureInProgress: false
99100
100 onPhotoCaptureInProgressChanged: {101 onPhotoCaptureInProgressChanged: {
101 if (main.contentExportMode && camera.photoCaptureInProgress) {102 if (main.contentExportMode && camera.photoCaptureInProgress) {
102103
=== modified file 'camera-app.qml'
--- camera-app.qml 2016-02-23 11:46:52 +0000
+++ camera-app.qml 2016-03-07 15:00:51 +0000
@@ -135,7 +135,9 @@
135 }135 }
136 }136 }
137 ]137 ]
138 interactive: !viewFinderView.touchAcquired && !galleryView.touchAcquired && !viewFinderView.camera.photoCaptureInProgress138 interactive: !viewFinderView.touchAcquired && !galleryView.touchAcquired
139 && !viewFinderView.camera.photoCaptureInProgress
140 && !viewFinderView.camera.timedCaptureInProgress
139141
140 Component.onCompleted: {142 Component.onCompleted: {
141 // FIXME: workaround for qtubuntu not returning values depending on the grid unit definition143 // FIXME: workaround for qtubuntu not returning values depending on the grid unit definition
142144
=== modified file 'tests/autopilot/camera_app/emulators/main_window.py'
--- tests/autopilot/camera_app/emulators/main_window.py 2015-11-25 17:00:31 +0000
+++ tests/autopilot/camera_app/emulators/main_window.py 2016-03-07 15:00:51 +0000
@@ -90,6 +90,10 @@
90 """Returns the video resolution button of the camera"""90 """Returns the video resolution button of the camera"""
91 return self.get_option_button("videoResolution")91 return self.get_option_button("videoResolution")
9292
93 def get_timer_delay_button(self):
94 """Returns the timer delay option button of the camera"""
95 return self.get_option_button("selfTimerDelay")
96
93 def get_stop_watch(self):97 def get_stop_watch(self):
94 """Returns the stop watch when using the record button of the camera"""98 """Returns the stop watch when using the record button of the camera"""
95 return self.app.wait_select_single("StopWatch")99 return self.app.wait_select_single("StopWatch")
96100
=== modified file 'tests/autopilot/camera_app/tests/test_capture.py'
--- tests/autopilot/camera_app/tests/test_capture.py 2015-12-01 09:03:34 +0000
+++ tests/autopilot/camera_app/tests/test_capture.py 2016-03-07 15:00:51 +0000
@@ -83,6 +83,62 @@
83 # check that the camera is able to capture another photo83 # check that the camera is able to capture another photo
84 self.assertThat(exposure_button.enabled, Eventually(Equals(True)))84 self.assertThat(exposure_button.enabled, Eventually(Equals(True)))
8585
86 """Test taking a picture with a timer set"""
87 def test_take_picture_with_timer(self):
88 delay = 5
89 self.enable_timer("%s seconds" % str(delay))
90
91 # start timed shoot
92 shoot_button = self.main_window.get_exposure_button()
93 self.assertThat(shoot_button.enabled, Eventually(Equals(True)))
94 self.pointing_device.move_to_object(shoot_button)
95 self.pointing_device.click()
96
97 switch_cameras_button = self.main_window.get_swap_camera_button()
98 record_mode_button = self.main_window.get_record_control()
99 view_switcher = self.main_window.get_view_switcher()
100
101 # controls and navigation should be disabled at this point
102 self.assertThat(shoot_button.enabled,
103 Eventually(Equals(True)))
104 self.assertThat(switch_cameras_button.enabled,
105 Eventually(Equals(True)))
106 self.assertThat(record_mode_button.enabled,
107 Eventually(Equals(True)))
108 self.assertThat(view_switcher.interactive,
109 Eventually(Equals(True)))
110
111 # after the delay controls and navigation should be re-enabled
112 self.assertThat(shoot_button.enabled,
113 Eventually(Equals(True), timeout=delay))
114 self.assertThat(switch_cameras_button.enabled,
115 Eventually(Equals(True), timeout=delay))
116 self.assertThat(record_mode_button.enabled,
117 Eventually(Equals(True), timeout=delay))
118 self.assertThat(view_switcher.interactive,
119 Eventually(Equals(True), timeout=delay))
120
121 def enable_timer(self, label_value):
122 # open bottom edge
123 bottom_edge = self.main_window.get_bottom_edge()
124 bottom_edge.open()
125
126 # open video resolution option value selector showing the possible
127 # values
128 timer_delay_button = self.main_window.get_timer_delay_button()
129 self.pointing_device.move_to_object(timer_delay_button)
130 self.pointing_device.click()
131 option_value_selector = self.main_window.get_option_value_selector()
132 self.assertThat(
133 option_value_selector.visible, Eventually(Equals(True)))
134
135 # select a 5 seconds delay
136 option = self.main_window.get_option_value_button(label_value)
137 self.pointing_device.move_to_object(option)
138 self.pointing_device.click()
139
140 bottom_edge.close()
141
86 def test_record_video(self):142 def test_record_video(self):
87 """Test clicking on the record control.143 """Test clicking on the record control.
88144

Subscribers

People subscribed via source and target branches