Merge lp:~fboucault/camera-app/tap_exits_options into lp:camera-app

Proposed by Florian Boucault
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 328
Merged at revision: 329
Proposed branch: lp:~fboucault/camera-app/tap_exits_options
Merge into: lp:camera-app
Diff against target: 63 lines (+48/-0)
2 files modified
ViewFinderOverlay.qml (+6/-0)
tests/autopilot/camera_app/tests/test_options.py (+42/-0)
To merge this branch: bzr merge lp:~fboucault/camera-app/tap_exits_options
Reviewer Review Type Date Requested Status
Olivier Tilloy Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+228507@code.launchpad.net

Commit message

Exit the options overlay upon tapping anywhere outside the buttons.
It used to work relying on the behaviour of the toolkit's Panel but it recently changed under our feet (rev 1000.119.19 from lp:ubuntu-ui-toolkit).

To post a comment you must log in.
326. By Florian Boucault

Empty commit

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

That looks good. Can you add an autopilot test?

327. By Florian Boucault

Added autopilot test.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

49 + def tearDown(self):
50 + super(TestCameraFlash, self).tearDown()

This is useless and can be safely removed.

Revision history for this message
Olivier Tilloy (osomon) wrote :

31 +from testtools.matchers import Equals, NotEquals
36 +import unittest

NotEquals and unittest are imported but unused.

Revision history for this message
Olivier Tilloy (osomon) wrote :

46 + self.assertThat(
47 + self.main_window.get_qml_view().visible, Eventually(Equals(True)))

This assertion probably belongs in CameraAppTestCase.setUp() (but it’s ok if you address that separately).

328. By Florian Boucault

Removed useless imports. Removed useless tearDown. Renamed class to make sense. Added FIXME.

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

All fixed now, thanks.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Looks good now, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ViewFinderOverlay.qml'
2--- ViewFinderOverlay.qml 2014-07-17 13:39:48 +0000
3+++ ViewFinderOverlay.qml 2014-07-29 16:40:38 +0000
4@@ -75,6 +75,12 @@
5 }
6 }
7
8+ MouseArea {
9+ id: bottomEdgeClose
10+ anchors.fill: parent
11+ onClicked: bottomEdge.close()
12+ }
13+
14 Panel {
15 id: bottomEdge
16 anchors {
17
18=== added file 'tests/autopilot/camera_app/tests/test_options.py'
19--- tests/autopilot/camera_app/tests/test_options.py 1970-01-01 00:00:00 +0000
20+++ tests/autopilot/camera_app/tests/test_options.py 2014-07-29 16:40:38 +0000
21@@ -0,0 +1,42 @@
22+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
23+# Copyright 2014 Canonical
24+#
25+# This program is free software: you can redistribute it and/or modify it
26+# under the terms of the GNU General Public License version 3, as published
27+# by the Free Software Foundation.
28+
29+"""Tests for the Camera App options overlay"""
30+
31+from testtools.matchers import Equals
32+from autopilot.matchers import Eventually
33+
34+from camera_app.tests import CameraAppTestCase
35+
36+class TestCameraOptions(CameraAppTestCase):
37+ """Tests the options overlay"""
38+
39+ """ This is needed to wait for the application to start.
40+ In the testfarm, the application may take some time to show up."""
41+ def setUp(self):
42+ super(TestCameraOptions, self).setUp()
43+ # FIXME: this should be in parent class
44+ self.assertThat(
45+ self.main_window.get_qml_view().visible, Eventually(Equals(True)))
46+
47+ """Test that the options overlay closes properly by tapping"""
48+ def test_overlay_tap_to_close(self):
49+ bottom_edge = self.main_window.get_bottom_edge()
50+ bottom_edge.open()
51+
52+ # check overlay is opened
53+ self.assertThat(bottom_edge.opened, Eventually(Equals(True)))
54+
55+ # tap to close overlay
56+ root = self.main_window.get_root()
57+ x = root.globalRect.x + root.width / 2.0
58+ y = root.globalRect.y + root.height / 4.0
59+ self.pointing_device.move(x, y)
60+ self.pointing_device.click()
61+
62+ # check overlay is closed
63+ self.assertThat(bottom_edge.opened, Eventually(Equals(False)))

Subscribers

People subscribed via source and target branches