~schwann/gallery-app/gallery-no-album-share

398.3.7 by Omer Akram
more tests
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
# Copyright 2012 Canonical
3
#
4
# This program is free software: you can redistribute it and/or modify it
5
# under the terms of the GNU General Public License version 3, as published
6
# by the Free Software Foundation.
7
589.2.1 by Guenter Schwann
Fix the autopilot tests
8
from gallery_utils import GalleryUtils
398.3.7 by Omer Akram
more tests
9
644.1.1 by Guenter Schwann
Fix issues found yb pep8 and pyflakes
10
589.2.1 by Guenter Schwann
Fix the autopilot tests
11
class PhotoViewer(GalleryUtils):
398.3.7 by Omer Akram
more tests
12
13
    def __init__(self, app):
14
        self.app = app
15
623.2.1 by Guenter Schwann
Autopilot test refactoring
16
    def get_toolbar_edit_button(self):
589.2.1 by Guenter Schwann
Fix the autopilot tests
17
        """Return the edit button of the toolbar when photo viewer is shown"""
727.2.4 by tpeeters
fix tests
18
        return self.get_toolbar_named_toolbarbutton("editButton")
398.3.9 by Omer Akram
add objectName for albumviewer and more
19
623.2.1 by Guenter Schwann
Autopilot test refactoring
20
    def get_toolbar_delete_button(self):
644.1.1 by Guenter Schwann
Fix issues found yb pep8 and pyflakes
21
        """Return the delete button of the toolbar when photo viewer is
22
           shown"""
727.2.4 by tpeeters
fix tests
23
        return self.get_toolbar_named_toolbarbutton("deleteButton")
398.3.10 by Omer Akram
add a bunch of photo viewer tests
24
623.2.1 by Guenter Schwann
Autopilot test refactoring
25
    def get_toolbar_share_button(self):
589.2.1 by Guenter Schwann
Fix the autopilot tests
26
        """Return the share button of the toolbar when photo viewer is shown"""
727.2.4 by tpeeters
fix tests
27
        return self.get_toolbar_named_toolbarbutton("shareButton")
398.3.10 by Omer Akram
add a bunch of photo viewer tests
28
398.3.9 by Omer Akram
add objectName for albumviewer and more
29
    def get_delete_dialog(self):
398.3.18 by Omer Akram
add docstrings.
30
        """Returns the photo viewer delete dialog."""
644.1.1 by Guenter Schwann
Fix issues found yb pep8 and pyflakes
31
        return self.select_single_retry("Dialog",
32
                                        objectName="deletePhotoDialog")
398.3.10 by Omer Akram
add a bunch of photo viewer tests
33
34
    def get_popup_album_picker(self):
398.3.18 by Omer Akram
add docstrings.
35
        """Returns the photo viewer album pickers."""
684.1.1 by Guenter Schwann
More robust autopilot tests by using the *_retry functions more often
36
        return self.select_single_retry("PopupAlbumPicker",
742.1.4 by Javier Collado
Fixed indentation
37
                                        objectName="popupAlbumPicker")
398.3.10 by Omer Akram
add a bunch of photo viewer tests
38
39
    def get_share_dialog(self):
398.3.18 by Omer Akram
add docstrings.
40
        """Returns the photo viewer share dialog."""
684.1.1 by Guenter Schwann
More robust autopilot tests by using the *_retry functions more often
41
        return self.select_single_retry("SharePopover",
42
                                        objectName="sharePopover")
398.3.10 by Omer Akram
add a bunch of photo viewer tests
43
44
    def get_photo_edit_dialog(self):
398.3.18 by Omer Akram
add docstrings.
45
        """Returns the photo edit dialog."""
684.1.1 by Guenter Schwann
More robust autopilot tests by using the *_retry functions more often
46
        return self.select_single_retry("EditPopover",
742.1.4 by Javier Collado
Fixed indentation
47
                                        objectName="editPopover")
398.3.10 by Omer Akram
add a bunch of photo viewer tests
48
49
    def get_photo_component(self):
684.1.1 by Guenter Schwann
More robust autopilot tests by using the *_retry functions more often
50
        return self.select_many_retry("ZoomablePhotoComponent",
51
                                      ownerName="photoViewerDelegate")[0]
398.3.10 by Omer Akram
add a bunch of photo viewer tests
52
53
    def get_crop_menu_item(self):
398.3.18 by Omer Akram
add docstrings.
54
        """Returns the crop item of the edit dialog."""
428.6.18 by Omer Akram
fix the crap out of this test thing
55
        return self.app.select_single("Standard", objectName="cropListItem")
398.3.9 by Omer Akram
add objectName for albumviewer and more
56
428.13.20 by Omer Akram
add autopilot tests for the photeditor.
57
    def get_rotate_menu_item(self):
58
        """Returns the rotate item of the edit dialog."""
59
        return self.app.select_single("Standard", objectName="rotateListItem")
60
61
    def get_undo_menu_item(self):
62
        """Returns the undo item of the edit dialog."""
63
        return self.app.select_single("Standard", objectName="undoListItem")
64
65
    def get_redo_menu_item(self):
66
        """Returns the redo item of the edit dialog."""
67
        return self.app.select_single("Standard", objectName="redoListItem")
68
69
    def get_revert_menu_item(self):
70
        """Returns the revert to original menu item in the edit dialog."""
71
        return self.app.select_single("Standard", objectName="revertListItem")
72
731.2.1 by Omer Akram
add test for auto enhance
73
    def get_auto_enhance_menu_item(self):
74
        """Returns the 'auto enhance' menu item in the edit dialog."""
75
        return self.app.select_single("Standard", objectName='enhanceListItem')
76
428.13.13 by Omer Akram
test a bit of delete dialog
77
    def get_delete_popover_delete_item(self):
78
        """Returns the delete button of the delete popover."""
644.1.1 by Guenter Schwann
Fix issues found yb pep8 and pyflakes
79
        return self.app.select_single("Button",
80
                                      objectName="deletePhotoDialogYes",
81
                                      visible=True)
428.13.13 by Omer Akram
test a bit of delete dialog
82
83
    def get_delete_popover_cancel_item(self):
84
        """Returns the cancel button of the delete popover."""
644.1.1 by Guenter Schwann
Fix issues found yb pep8 and pyflakes
85
        return self.app.select_single("Button",
86
                                      objectName="deletePhotoDialogNo",
87
                                      visible=True)
428.13.13 by Omer Akram
test a bit of delete dialog
88
428.13.20 by Omer Akram
add autopilot tests for the photeditor.
89
    def get_opened_photo(self):
90
        """Returns the first opened photo."""
684.1.1 by Guenter Schwann
More robust autopilot tests by using the *_retry functions more often
91
        return self.select_single_retry("ZoomablePhotoComponent",
92
                                        objectName="openedPhoto0")
428.13.20 by Omer Akram
add autopilot tests for the photeditor.
93
617.2.1 by Guenter Schwann
Reenable and polish the crop autopilot test
94
    def get_crop_interactor(self):
95
        """Returns the crop interactor."""
684.1.1 by Guenter Schwann
More robust autopilot tests by using the *_retry functions more often
96
        return self.select_single_retry("CropInteractor",
97
                                        objectName="cropInteractor")
617.2.1 by Guenter Schwann
Reenable and polish the crop autopilot test
98
99
    def get_crop_overlay(self):
100
        """Returns the crop overlay."""
742.1.2 by Javier Collado
Fixed long lines
101
        return self.select_single_retry("CropOverlay",
102
                                        objectName="cropOverlay")
617.2.1 by Guenter Schwann
Reenable and polish the crop autopilot test
103
428.13.20 by Omer Akram
add autopilot tests for the photeditor.
104
    def get_top_left_crop_corner(self):
105
        """Returns the top left corner of the crop overlay for dragging."""
684.1.1 by Guenter Schwann
More robust autopilot tests by using the *_retry functions more often
106
        return self.select_single_retry("CropCorner",
107
                                        objectName="topLeftCropCorner")
428.13.20 by Omer Akram
add autopilot tests for the photeditor.
108
109
    def get_crop_overlays_crop_icon(self):
110
        """Returns the crop icon of the crop overlay."""
684.1.1 by Guenter Schwann
More robust autopilot tests by using the *_retry functions more often
111
        return self.select_single_retry("Button", objectName="centerCropIcon",
112
                                        visible=True)
617.2.1 by Guenter Schwann
Reenable and polish the crop autopilot test
113
114
    def get_edit_preview(self):
115
        """Returns the edit preview."""
742.1.2 by Javier Collado
Fixed long lines
116
        return self.select_single_retry("EditPreview",
117
                                        objectName="editPreview")