~ubuntu-branches/ubuntu/trusty/notes-app/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/autopilot/notes_app/tests/test_delete.py

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Bill Filler, Olivier Tilloy, Ubuntu daily release
  • Date: 2013-12-04 10:22:47 UTC
  • mfrom: (1.1.20)
  • Revision ID: package-import@ubuntu.com-20131204102247-r3ofl006h53ve8qm
Tags: 1.4+14.04.20131204-0ubuntu1
[ Bill Filler ]
* Use a different port for the test server when a zombie process
  doesn’t release the default one, and use a cleanup function instead
  of tearDown() for improved robustness.
* Make sure that clicking outside of the note on the header is
  recognized by enabling the flag that makes the InverseMouseArea the
  topmost item

[ Olivier Tilloy ]
* Use the standard UITK emulator for swipe-to-delete gesture and
  confirmation.
* Unskip some tests on desktop where they work just fine. (LP:
  #1190630)

[ Ubuntu daily release ]
* Automatic snapshot from revision 232

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 
10
10
from __future__ import absolute_import
11
11
 
12
 
from testtools.matchers import Equals, GreaterThan, LessThan
 
12
from testtools.matchers import Equals
13
13
from autopilot.matchers import Eventually
14
14
 
15
15
from notes_app.tests import NotesAppTestCase
40
40
 
41
41
    def test_slide_to_delete_right(self):
42
42
        note = self.main_window.get_notes()[0]
43
 
 
44
 
        # Verify that sliding the note right removes the note
45
 
        x, y, w, h = note.globalRect
46
 
        ty = int(y + h / 2)
47
 
        self.pointing_device.drag(int(x + 0.1 * w), ty, int(x + 0.9 * w), ty)
48
 
        confirm = self.main_window.get_note_delete_confirmation_button(note)
49
 
        xmax = note.globalRect[0] + note.globalRect[2] / 4
50
 
        self.assertThat(lambda: confirm.globalRect[0],
51
 
                        Eventually(LessThan(xmax)))
52
 
        self.pointing_device.click_object(confirm)
53
 
 
 
43
        listitem = self.main_window.get_note_listitem(note)
 
44
        listitem.swipe_to_delete('right')
 
45
        listitem.confirm_removal()
54
46
        self.assertThat(
55
47
            lambda: len(self.main_window.get_notes()), Eventually(Equals(0)))
56
48
 
57
49
    def test_slide_to_delete_left(self):
58
50
        note = self.main_window.get_notes()[0]
59
 
 
60
 
        # Verify that sliding the note left removes the note
61
 
        x, y, w, h = note.globalRect
62
 
        ty = int(y + h / 2)
63
 
        self.pointing_device.drag(int(x + 0.9 * w), ty, int(x + 0.1 * w), ty)
64
 
        confirm = self.main_window.get_note_delete_confirmation_button(note)
65
 
        xmin = note.globalRect[0] + note.globalRect[2] / 2
66
 
        self.assertThat(lambda: confirm.globalRect[0],
67
 
                        Eventually(GreaterThan(xmin)))
68
 
        self.pointing_device.click_object(confirm)
69
 
 
 
51
        listitem = self.main_window.get_note_listitem(note)
 
52
        listitem.swipe_to_delete('left')
 
53
        listitem.confirm_removal()
70
54
        self.assertThat(
71
55
            lambda: len(self.main_window.get_notes()), Eventually(Equals(0)))
72
56
 
81
65
            note_x + note_w / 2 + 10, note_y + note_h / 2)
82
66
        self.pointing_device.release()
83
67
 
84
 
        self.app.select_single("Empty").swipingState.wait_for("")
 
68
        self.main_window.get_note_listitem(note).swipingState.wait_for("")
85
69
        self.assertThat(
86
70
            lambda: len(self.main_window.get_notes()), Eventually(Equals(1)))
87
71
 
97
81
        self.pointing_device.move(note_x + note_w / 2, note_y + note_h / 2)
98
82
        self.pointing_device.release()
99
83
 
100
 
        self.app.select_single("Empty").swipingState.wait_for("")
 
84
        self.main_window.get_note_listitem(note).swipingState.wait_for("")
101
85
        self.assertThat(
102
86
            lambda: len(self.main_window.get_notes()), Eventually(Equals(1)))