/usr/lib/python2.7/dist-packages/libautopilot_qt/tests/test_main.py is in libautopilot-qt-autopilot 1.4+15.10.20150825-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 109 110 111 112 113 114 115 116 | # -*- 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.
from __future__ import absolute_import
from testtools.matchers import Equals, NotEquals
from autopilot.matchers import Eventually
from libautopilot_qt.tests import AutopilotQtTestCase
class TestQueries(AutopilotQtTestCase):
def setUp(self):
super(TestQueries, self).setUp()
self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True)))
def tearDown(self):
super(TestQueries, self).tearDown()
def test_find_select_single(self):
root_item = self.main_window.get_root_item()
self.assertThat(root_item, NotEquals(None))
def test_find_by_objectname(self):
test_item = self.main_window.get_test_item_by_objectname()
self.assertThat(test_item, NotEquals(None))
def test_find_by_child_search(self):
rectangle = self.main_window.get_test_rectangle_by_child_search()
self.assertThat(rectangle, NotEquals(None))
class TestProperties(AutopilotQtTestCase):
def setUp(self):
super(TestProperties, self).setUp()
self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True)))
def tearDown(self):
super(TestProperties, self).tearDown()
def test_basic_properties(self):
test_item = self.main_window.get_test_item()
self.assertThat(test_item.stringProperty, Equals("Testing rocks, debugging sucks!"))
self.assertThat(test_item.intProperty, Equals(42))
self.assertThat(test_item.boolProperty, Equals(False))
self.assertThat(test_item.realProperty, Equals(0.42))
self.assertThat(test_item.doubleProperty, Equals(0.42))
rectangle = self.main_window.get_test_rectangle()
self.assertThat(rectangle.color, Equals([0, 0, 255, 255]))
def test_mouse_interaction(self):
rectangle = self.main_window.get_test_rectangle()
self.assertThat(rectangle.color, Equals([0, 0, 255, 255]))
mousearea = self.main_window.get_test_mousearea()
self.pointing_device.move_to_object(mousearea)
self.pointing_device.click()
self.assertThat(rectangle.color, Eventually(Equals([255, 0, 0, 255])))
class TestAppNameQtDefault(AutopilotQtTestCase):
def setUp(self):
super(TestAppNameQtDefault, self).setUp("--appname", "untitled1")
def test_connection(self):
self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True)))
class TestAppNameTech(AutopilotQtTestCase):
def setUp(self):
super(TestAppNameTech, self).setUp("--appname", "qt-test-app")
def test_connection(self):
self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True)))
class TestAppNameUserfriendly(AutopilotQtTestCase):
def setUp(self):
super(TestAppNameUserfriendly, self).setUp("--appname", "Qt Test App")
def test_connection(self):
self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True)))
class TestAppNameFqdn(AutopilotQtTestCase):
def setUp(self):
super(TestAppNameFqdn, self).setUp("--appname", "com.ubuntu.qttestapp")
def test_connection(self):
self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True)))
class TestSlots(AutopilotQtTestCase):
def setUp(self):
super(TestSlots, self).setUp()
def test_callSlot(self):
TEST_DATA = "testdata for test_callSlot"
root_item = self.main_window.get_root_item()
self.assertThat(len(root_item.get_slots()), NotEquals(0))
root_item.slots.testSlot(TEST_DATA)
self.assertThat(self.main_window.get_test_item().stringProperty, Equals(TEST_DATA))
|