~phablet-team/camera-app/refactor-and-fix-editor-tests

« back to all changes in this revision

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

  • Committer: Ugo Riboni
  • Date: 2015-02-25 14:37:56 UTC
  • Revision ID: ugo.riboni@canonical.com-20150225143756-e97xsvfi7jshohaz
Add a test for the editor button being disabled for videos

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
        self.assertThat(
29
29
            self.main_window.get_qml_view().visible, Eventually(Equals(True)))
30
30
        self.delete_all_media()
31
 
        self.add_sample_photo()
32
31
 
33
32
    def tearDown(self):
34
33
        super(TestCameraPhotoEditor, self).tearDown()
35
34
 
36
 
    """Tests swiping to the gallery and pressing the back button"""
 
35
    """Tests editor opening and closing correctly for pictures"""
37
36
    def test_editor_appears(self):
 
37
        self.add_sample_photo()
 
38
 
38
39
        viewfinder = self.main_window.get_viewfinder()
39
40
        gallery = self.main_window.get_gallery()
40
41
 
47
48
        self.pointing_device.move_to_object(opt)
48
49
        self.pointing_device.click()
49
50
 
50
 
        # If the editor button is not there when we are viewing a picture, then
 
51
        # If the editor button is not there when in the gallery view, then
51
52
        # we are not on a system that has the UI extras package installed or has
52
53
        # an older version than the one we need. Skip the test in this case.
53
54
        try:
79
80
        except StateNotFoundError:
80
81
            disappeared = True
81
82
        self.assertThat(disappeared, Equals(True))
 
83
 
 
84
    """Tests editor not being available for videos"""
 
85
    def test_editor_not_on_videos(self):
 
86
        self.add_sample_video()
 
87
 
 
88
        viewfinder = self.main_window.get_viewfinder()
 
89
        gallery = self.main_window.get_gallery()
 
90
 
 
91
        self.main_window.swipe_to_gallery(self)
 
92
 
 
93
        self.assertThat(gallery.inView, Eventually(Equals(True)))
 
94
 
 
95
        # open actions drawer
 
96
        opt = gallery.wait_select_single(objectName="additionalActionsButton")
 
97
        self.pointing_device.move_to_object(opt)
 
98
        self.pointing_device.click()
 
99
 
 
100
        # If the editor button is not there when in the gallery view, then
 
101
        # we are not on a system that has the UI extras package installed or has
 
102
        # an older version than the one we need. Skip the test in this case.
 
103
        try:
 
104
            edit = gallery.wait_select_single(objectName="actionButtonEdit")
 
105
        except:
 
106
            return
 
107
 
 
108
        self.assertThat(edit.enabled, Equals(False))