~fboucault/camera-app/empty_photo_roll

« back to all changes in this revision

Viewing changes to tests/autopilot/camera_app/tests/test_capture.py

  • Committer: Florian Boucault
  • Date: 2014-10-28 20:56:14 UTC
  • mfrom: (403.1.6 photo_roll_hint)
  • Revision ID: florian.boucault@canonical.com-20141028205614-wjt49p9cm2rin14e
Merged photo_roll_hint branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    """ This is needed to wait for the application to start.
25
25
        In the testfarm, the application may take some time to show up."""
26
26
    def setUp(self):
 
27
        # Remove configuration file where knowledge of the photo roll hint's necessity is stored
 
28
        config_file = os.path.expanduser("~/.config/com.ubuntu.camera/com.ubuntu.camera.conf")
 
29
        os.remove(config_file)
 
30
 
27
31
        super(TestCapture, self).setUp()
 
32
 
28
33
        self.assertThat(
29
34
            self.main_window.get_qml_view().visible, Eventually(Equals(True)))
30
35
 
49
54
        # Wait for the camera to have finished focusing
50
55
        # (the exposure button gets enabled when ready)
51
56
        self.assertThat(exposure_button.enabled, Eventually(Equals(True)))
 
57
        self.assertThat(exposure_button.width, Eventually(NotEquals(0)))
 
58
        self.assertThat(exposure_button.height, Eventually(NotEquals(0)))
52
59
 
53
60
        # Now take the picture! (Give it a little time to animate)
54
61
        self.pointing_device.move_to_object(exposure_button)
91
98
        # Click the exposure button to start recording
92
99
        self.pointing_device.move_to_object(exposure_button)
93
100
        self.assertThat(exposure_button.enabled, Eventually(Equals(True)))
 
101
        self.assertThat(exposure_button.width, Eventually(NotEquals(0)))
 
102
        self.assertThat(exposure_button.height, Eventually(NotEquals(0)))
94
103
        self.pointing_device.click()
95
104
 
96
105
        # Record video for 2 seconds and check if the stop watch actually
125
134
 
126
135
        self.assertThat(stop_watch.opacity, Eventually(Equals(0.0)))
127
136
 
 
137
    def test_hint_after_first_picture(self):
 
138
        hint = self.main_window.get_photo_roll_hint()
 
139
        photo_button = self.main_window.get_exposure_button()
 
140
 
 
141
        # Wait for the camera to be ready to take a picture
 
142
        self.assertThat(photo_button.enabled, Eventually(Equals(True)))
 
143
        self.assertThat(photo_button.width, Eventually(NotEquals(0)))
 
144
        self.assertThat(photo_button.height, Eventually(NotEquals(0)))
 
145
 
 
146
        # Check that the photo roll hint is hidden
 
147
        self.assertEquals(hint.visible, False)
 
148
 
 
149
        # Take a picture
 
150
        self.pointing_device.move_to_object(photo_button)
 
151
        self.pointing_device.click()
 
152
 
 
153
        # Check that the photo roll hint is displayed
 
154
        #self.assertEquals(hint.visible, True)
 
155
        self.assertThat(hint.visible, Eventually(Equals(True)))
 
156
 
 
157
        # Swipe to photo roll
 
158
        self.main_window.swipe_to_gallery(self)
 
159
        self.main_window.swipe_to_viewfinder(self)
 
160
 
 
161
        # Check that the photo roll hint is hidden
 
162
        self.assertEquals(hint.visible, False)
 
163
 
128
164
    """Test that the shoot button gets disabled for a while then re-enabled
129
165
    after shooting"""
130
166
    @unittest.skip("Disabled this test due race condition see bug 1227373")