Merge lp:~om26er/gallery-app/add_test_for_auto_enhance into lp:gallery-app

Proposed by Omer Akram
Status: Merged
Approved by: Omer Akram
Approved revision: 735
Merged at revision: 746
Proposed branch: lp:~om26er/gallery-app/add_test_for_auto_enhance
Merge into: lp:gallery-app
Diff against target: 110 lines (+32/-3)
4 files modified
src/photo/photo.cpp (+1/-1)
tests/autopilot/gallery_app/emulators/photo_viewer.py (+4/-0)
tests/autopilot/gallery_app/tests/__init__.py (+1/-1)
tests/autopilot/gallery_app/tests/test_photo_viewer.py (+26/-1)
To merge this branch: bzr merge lp:~om26er/gallery-app/add_test_for_auto_enhance
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Günter Schwann (community) Approve
Review via email: mp+170054@code.launchpad.net

Commit message

Add autopilot test for the auto-enhance feature in the edit dialog. Also add a test to make sure that deleting the last photo in the gallery take you back to the main view

Description of the change

Add autopilot test for the auto-enhance feature in the edit dialog. Also add a test to make sure that deleting the last photo in the gallery take you back to the main view, this test fails as the bug needs to be fixed.

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
Günter Schwann (schwann) wrote :

once the fix is merged, it's fine

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
735. By Omer Akram

fix failing tests

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/photo/photo.cpp'
2--- src/photo/photo.cpp 2013-06-17 12:57:21 +0000
3+++ src/photo/photo.cpp 2013-06-24 11:17:26 +0000
4@@ -802,7 +802,7 @@
5 QImage enhanced_image(width, height, dest_format);
6
7 for (int j = 0; j < height; j++) {
8- QApplication::processEvents();
9+ //QApplication::processEvents();
10 for (int i = 0; i < width; i++) {
11 QColor px = enhance_txn.transformPixel(
12 QColor(unenhanced_img.pixel(i, j)));
13
14=== modified file 'tests/autopilot/gallery_app/emulators/photo_viewer.py'
15--- tests/autopilot/gallery_app/emulators/photo_viewer.py 2013-06-18 13:22:53 +0000
16+++ tests/autopilot/gallery_app/emulators/photo_viewer.py 2013-06-24 11:17:26 +0000
17@@ -70,6 +70,10 @@
18 """Returns the revert to original menu item in the edit dialog."""
19 return self.app.select_single("Standard", objectName="revertListItem")
20
21+ def get_auto_enhance_menu_item(self):
22+ """Returns the 'auto enhance' menu item in the edit dialog."""
23+ return self.app.select_single("Standard", objectName='enhanceListItem')
24+
25 def get_delete_popover_delete_item(self):
26 """Returns the delete button of the delete popover."""
27 return self.app.select_single("Button",
28
29=== modified file 'tests/autopilot/gallery_app/tests/__init__.py'
30--- tests/autopilot/gallery_app/tests/__init__.py 2013-06-18 07:56:00 +0000
31+++ tests/autopilot/gallery_app/tests/__init__.py 2013-06-24 11:17:26 +0000
32@@ -162,7 +162,7 @@
33
34 self.pointing_device.drag(tx, ty, tx / 8, ty)
35 else:
36- self.click_item(tabs_bar)
37+ self.click_item(tabs_bar, delay=0.5)
38
39 albums_tab_button = self.gallery_utils.get_albums_tab_button()
40 # Due to some timing issues sometimes mouse moves to the location a bit
41
42=== modified file 'tests/autopilot/gallery_app/tests/test_photo_viewer.py'
43--- tests/autopilot/gallery_app/tests/test_photo_viewer.py 2013-06-19 15:47:39 +0000
44+++ tests/autopilot/gallery_app/tests/test_photo_viewer.py 2013-06-24 11:17:26 +0000
45@@ -62,6 +62,7 @@
46 def test_photo_delete_works(self):
47 """Clicking the trash button must show the delete dialog."""
48 trash_button = self.photo_viewer.get_toolbar_delete_button()
49+ photo_viewer = self.photo_viewer.get_main_photo_viewer()
50
51 self.pointing_device.move_to_object(trash_button)
52 self.pointing_device.click()
53@@ -89,6 +90,17 @@
54 self.assertThat(lambda: exists(self.sample_file),
55 Eventually(Equals(False)))
56
57+ self.reveal_toolbar()
58+ self.pointing_device.click_object(trash_button)
59+
60+ delete_dialog = self.photo_viewer.get_delete_dialog()
61+ self.assertThat(delete_dialog.visible, Eventually(Equals(True)))
62+
63+ delete_item = self.photo_viewer.get_delete_popover_delete_item()
64+ self.click_item(delete_item)
65+
66+ self.assertThat(photo_viewer.visible, Eventually(Equals(False)))
67+
68 # def test_nav_bar_album_picker_button(self):
69 # """Clicking the album picker must show the picker dialog."""
70 # album_button = self.photo_viewer.get_toolbar_album_button()
71@@ -165,6 +177,10 @@
72 revert_item = self.photo_viewer.get_revert_menu_item()
73 self.click_item(revert_item)
74
75+ def click_enhance_item(self):
76+ enhance_item = self.photo_viewer.get_auto_enhance_menu_item()
77+ self.click_item(enhance_item)
78+
79 def test_photo_editor_crop(self):
80 """Cropping a photo must crop it."""
81 old_file_size = os.path.getsize(self.sample_file)
82@@ -176,6 +192,7 @@
83 self.click_crop_item()
84
85 self.assertThat(crop_box.state, Eventually(Equals("shown")))
86+ self.assertThat(crop_box.opacity, Eventually(Equals(1)))
87
88 crop_corner = self.photo_viewer.get_top_left_crop_corner()
89 x, y, h, w = crop_corner.globalRect
90@@ -254,7 +271,7 @@
91 # implemented properly
92 sleep(1)
93
94- def test_photo_editor_redo_undo_revert_to_original_states(self):
95+ def test_photo_editor_redo_undo_revert_enhance_states(self):
96 undo_item = self.photo_viewer.get_undo_menu_item()
97 redo_item = self.photo_viewer.get_redo_menu_item()
98 revert_item = self.photo_viewer.get_revert_menu_item()
99@@ -310,3 +327,11 @@
100 self.assertThat(undo_item.enabled, Eventually(Equals(True)))
101 self.assertThat(redo_item.enabled, Eventually(Equals(False)))
102 self.assertThat(revert_item.enabled, Eventually(Equals(False)))
103+
104+ self.click_enhance_item()
105+
106+ self.reveal_toolbar()
107+ self.click_edit_button()
108+
109+ revert_item = self.photo_viewer.get_revert_menu_item()
110+ self.assertThat(lambda: revert_item.enabled, Eventually(Equals(True)))

Subscribers

People subscribed via source and target branches