/usr/lib/python2.7/dist-packages/address_book_app/tests/test_single_pick_mode.py is in address-book-app-autopilot 0.2+14.04.20140408.3-0ubuntu2.
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 | # -*- 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 the Addressbook App"""
from __future__ import absolute_import
from testtools.matchers import Equals
from autopilot.matchers import Eventually
from address_book_app.tests import AddressBookAppTestCase
class TestSinglePickerMode(AddressBookAppTestCase):
""" Tests app in single picker mode"""
def setUp(self):
AddressBookAppTestCase.ARGS.append("addressbook:///pick?single=true")
AddressBookAppTestCase.PRELOAD_VCARD = True
super(TestSinglePickerMode, self).setUp()
def test_select_single_contact(self):
pick_page = self.main_window.get_contact_list_pick_page()
contacts = pick_page.select_many("ContactDelegate")
# all selection marks should be visible
selection_marks = []
mark_to_contacts = {}
for contact in contacts:
if (contact.visible):
mark = contact.select_single("QQuickRectangle", objectName="selectionMark")
self.assertThat(mark.visible, Eventually(Equals(True)))
selection_marks.append(mark)
mark_to_contacts[mark] = contact
# click on mark 1
selected_mark = selection_marks[1]
self.pointing_device.click_object(selected_mark)
for mark in selection_marks:
if mark == selected_mark:
self.assertThat(mark_to_contacts[mark].selected, Eventually(Equals(True)))
else:
self.assertThat(mark_to_contacts[mark].selected, Eventually(Equals(False)))
# click on mark 2
selected_mark = selection_marks[2]
self.pointing_device.click_object(selected_mark)
for mark in selection_marks:
if mark == selected_mark:
self.assertThat(mark_to_contacts[mark].selected, Eventually(Equals(True)))
else:
self.assertThat(mark_to_contacts[mark].selected, Eventually(Equals(False)))
# click on mark 0
selected_mark = selection_marks[0]
self.pointing_device.click_object(selected_mark)
for mark in selection_marks:
if mark == selected_mark:
self.assertThat(mark_to_contacts[mark].selected, Eventually(Equals(True)))
else:
self.assertThat(mark_to_contacts[mark].selected, Eventually(Equals(False)))
buttons = pick_page.select_many("Button", objectName="DialogButtons.acceptButton")
for b in buttons:
if b.visible:
self.pointing_device.click_object(b)
|