/usr/lib/python3/dist-packages/notes_app/tests/test_expand_collapse.py is in notes-app-autopilot 1.4+14.10.20140711-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2013 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
"""Tests for Notes app"""
from __future__ import absolute_import
from testtools.matchers import Equals
from autopilot.matchers import Eventually
from notes_app.tests import NotesAppTestCase
import sqlite3
class TestExpandCollapse(NotesAppTestCase):
"""Tests deleting notes"""
def setUp(self):
# Setup the database before starting the app
self.setup_db()
super(TestExpandCollapse, self).setUp()
def setup_db(self):
notes = [
"""{ "elements" : [
{"content":"This is a note.","type":"text"}
]}""",
"""{ "elements" : [
{"content":"This is another note.","type":"text"}
]}"""
]
path = self.ensure_db()
conn = sqlite3.connect(path)
cursor = conn.cursor()
cursor.execute("DELETE FROM notes")
for note in notes:
cursor.execute("INSERT INTO notes (date, note) "
"VALUES ('2013-04-07', '" + note + "')")
conn.commit()
conn.close()
def test_expand_and_collapse_many(self):
notes = self.main_window.get_notes()
first = notes[0]
second = notes[1]
self.assert_note_eventually_collapsed(first)
self.assert_note_eventually_collapsed(second)
self.pointing_device.click_object(first)
self.assert_note_eventually_expanded(first)
self.pointing_device.click_object(second)
self.assert_note_eventually_collapsed(first)
self.assert_note_eventually_expanded(second)
self.pointing_device.click_object(first)
self.assert_note_eventually_expanded(first)
self.assert_note_eventually_collapsed(second)
def test_collapse_header(self):
# Skipping the test for now because in order to release qt5.2 we want
# to match the results as much as possible to what we get in the
# current image. As the notes app is going to be deprecated, and this
# bug has a low impact on the user experience, it's not critical and
# won't be fixed before the qt5.2 release. -- elopio - 2014-03-14
self.skipTest('The test is failing because of bug #1288876')
first = self.main_window.get_notes()[0]
header = self.main_window.get_header()
self.pointing_device.click_object(first)
self.assert_note_eventually_expanded(first)
self.pointing_device.click_object(header)
self.assert_note_eventually_collapsed(first)
def test_collapse_bottom(self):
notes = self.main_window.get_notes()
first = notes[0]
second = notes[1]
self.pointing_device.click_object(first)
self.assert_note_eventually_expanded(first)
# click in the empty space after all the notes
note_x, note_y, note_w, note_h = second.globalRect
self.pointing_device.move(note_x + note_w / 2, note_y + note_h + 20)
self.pointing_device.click()
self.assert_note_eventually_collapsed(first)
def test_collapse_between(self):
first = self.main_window.get_notes()[0]
self.pointing_device.click_object(first)
self.assert_note_eventually_expanded(first)
# click in the empty space between notes
note_x, note_y, note_w, note_h = first.globalRect
self.pointing_device.move(note_x + note_w / 2, note_y + note_h + 2)
self.pointing_device.click()
self.assert_note_eventually_collapsed(first)
|