Merge lp:~elopio/notes-app/dont_click_header into lp:notes-app

Proposed by Leo Arias
Status: Merged
Approved by: Bill Filler
Approved revision: 251
Merged at revision: 250
Proposed branch: lp:~elopio/notes-app/dont_click_header
Merge into: lp:notes-app
Diff against target: 116 lines (+25/-14)
2 files modified
tests/autopilot/notes_app/tests/test_create.py (+15/-9)
tests/autopilot/notes_app/tests/test_parts.py (+10/-5)
To merge this branch: bzr merge lp:~elopio/notes-app/dont_click_header
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+210349@code.launchpad.net

Commit message

Because of bug 1288876, collapse notes clicking under them.

To post a comment you must log in.
250. By Leo Arias

Because of bug 1288876, collapse notes clicking under them.

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)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
251. By Leo Arias

Take into account that the note could be deleted.

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

approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/notes_app/tests/test_create.py'
2--- tests/autopilot/notes_app/tests/test_create.py 2013-12-11 17:29:27 +0000
3+++ tests/autopilot/notes_app/tests/test_create.py 2014-03-11 15:45:24 +0000
4@@ -11,6 +11,7 @@
5
6 from testtools.matchers import Equals
7 from autopilot.matchers import Eventually
8+from autopilot.introspection import dbus
9
10 from notes_app.tests import NotesAppTestCase
11
12@@ -46,15 +47,22 @@
13 return note
14
15 def ensure_one_collapsed_note(self):
16- header = self.main_window.get_header()
17 note = self.focus_note_for_editing(0)
18-
19 self.keyboard.type("Hello", delay=self.TYPING_DELAY)
20- self.pointing_device.click_object(header)
21- self.assert_note_eventually_collapsed(note)
22+ self._collapse_note(note)
23+
24+ def _collapse_note(self, note):
25+ """Collapse a note by clicking outside of it."""
26+ x, y, width, height = note.globalRect
27+ self.pointing_device.move(x + width // 2, y + height + 20)
28+ self.pointing_device.click()
29+ try:
30+ self.assert_note_eventually_collapsed(note)
31+ except dbus.StateNotFoundError:
32+ # The note doesn't have text so it's deleted.
33+ pass
34
35 def test_note_expand_and_unexpand(self):
36- header = self.main_window.get_header()
37 notes = self.main_window.get_notes()
38
39 # When starting with no database there should be one empty note there
40@@ -67,7 +75,7 @@
41
42 # Clicking outside of the note should unexpand it, and this should
43 # cause it to be deleted
44- self.pointing_device.click_object(header)
45+ self._collapse_note(note)
46 self.assertThat(
47 lambda: len(self.main_window.get_notes()), Eventually(Equals(0)))
48
49@@ -122,13 +130,11 @@
50 self.assertThat(content.activeFocus, Eventually(Equals(True)))
51
52 def test_note_unfocused_when_collapsed(self):
53- header = self.main_window.get_header()
54 note = self.focus_note_for_editing(0)
55
56 # Type something so that the note doesn't get deleted then collapse it.
57 self.keyboard.type("Hello", delay=self.TYPING_DELAY)
58- self.pointing_device.click_object(header)
59- self.assert_note_eventually_collapsed(note)
60+ self._collapse_note(note)
61
62 content = self.main_window.get_note_content(note)
63 self.assertThat(content.activeFocus, Equals(False))
64
65=== modified file 'tests/autopilot/notes_app/tests/test_parts.py'
66--- tests/autopilot/notes_app/tests/test_parts.py 2014-01-10 10:37:38 +0000
67+++ tests/autopilot/notes_app/tests/test_parts.py 2014-03-11 15:45:24 +0000
68@@ -49,6 +49,13 @@
69 self.assertThat(len(children), Equals(1))
70 return children[0]
71
72+ def _collapse_note(self, note):
73+ """Collapse a note by clicking outside of it."""
74+ x, y, width, height = note.globalRect
75+ self.pointing_device.move(x + width // 2, y + height + 20)
76+ self.pointing_device.click()
77+ self.assert_note_eventually_collapsed(note)
78+
79 def test_parts_focus(self):
80 note = self.main_window.get_notes()[0]
81
82@@ -114,7 +121,6 @@
83 empty_part.wait_until_destroyed()
84
85 def test_parts_delete_empty_header(self):
86- header = self.main_window.get_header()
87 note = self.main_window.get_notes()[0]
88
89 # Expand the note
90@@ -132,15 +138,14 @@
91 Eventually(Equals(3)))
92 self.assert_osk_eventually_shown()
93
94- # Now verify that clicking on the header (thus collapsing the
95+ # Now verify that clicking outside of a note (thus collapsing the
96 # expanded note) will still cause the new part to disappear
97 empty_part = self.main_window.get_note_parts(note)[-1]
98- self.pointing_device.click_object(header)
99+ self._collapse_note(note)
100 self.assert_note_eventually_collapsed(note)
101 empty_part.wait_until_destroyed()
102
103 def test_parts_no_delete_with_text(self):
104- header = self.main_window.get_header()
105 note = self.main_window.get_notes()[0]
106
107 # Expand the note
108@@ -160,7 +165,7 @@
109 # Verify that after typing something in the note will cause it to stay
110 # when unfocusing
111 self.keyboard.type("Some text", delay=self.TYPING_DELAY)
112- self.pointing_device.click_object(header)
113+ self._collapse_note(note)
114 self.assert_note_eventually_collapsed(note)
115 self.assertThat(
116 lambda: len(self.main_window.get_note_parts(note)),

Subscribers

People subscribed via source and target branches

to all changes: