~ubuntu-branches/ubuntu/trusty/autopilot-qt/trusty

« back to all changes in this revision

Viewing changes to tests/autopilot/libautopilot_qt/emulators/main_window_qt4.py

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Michael Zanetti, Christopher Lee, Olivier Tilloy, Ubuntu daily release
  • Date: 2013-06-05 07:08:47 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130605070847-cm5heug9bku0q19d
Tags: 1.3daily13.06.05-0ubuntu1
[ Michael Zanetti ]
* update tests to work with AP 1.3.
* make it work with Qt 5.0.2.

[ Christopher Lee ]
* Adding GetVersion so we can check that the version of the DBus
  protocol is as expected.

[ Olivier Tilloy ]
* Do not override an existing property with the value of a parent
  object. (LP: #1170764)

[ Ubuntu daily release ]
* Automatic snapshot from revision 61

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
 
2
# Copyright 2013 Canonical
 
3
#
 
4
# This program is free software: you can redistribute it and/or modify it
 
5
# under the terms of the GNU General Public License version 3, as published
 
6
# by the Free Software Foundation.
 
7
 
 
8
import logging
 
9
logger = logging.getLogger(__name__)
 
10
 
 
11
 
 
12
class MainWindowQt4(object):
 
13
 
 
14
    def __init__(self, app):
 
15
        self.app = app
 
16
 
 
17
    def get_qml_view(self):
 
18
        qml_view = self.app.select_single("QDeclarativeView")
 
19
        if qml_view is None:
 
20
            logger.error("*** select_single(\"QDeclarativeView\") failed ***")
 
21
        return qml_view
 
22
 
 
23
    def get_root_item(self):
 
24
        root_item = self.app.select_single("QDeclarativeItem", objectName="rootItem")
 
25
        if root_item is None:
 
26
            logger.error("*** select_single(\"QDeclarativeItem\", objectName=\rootItem\") failed ***")
 
27
        return root_item
 
28
 
 
29
    def get_test_item(self):
 
30
        test_item = self.app.select_single("QDeclarativeItem", objectName="testItem")
 
31
        if test_item is None:
 
32
            logger.error("*** select_single(\"QDeclarativeItem\", objectName=\"testItem\") failed ***")
 
33
        return test_item
 
34
 
 
35
    def get_test_item_by_objectname(self):
 
36
        test_item = self.app.select_single(objectName="testItem")
 
37
        if test_item is None:
 
38
            logger.error("*** select_single(objectName=\"testItem\") failed ***")
 
39
        return test_item
 
40
 
 
41
    def get_test_rectangle(self):
 
42
        rectangle = self.app.select_single("QDeclarativeRectangle")
 
43
        if rectangle is None:
 
44
            logger.error("*** select_single(\"QDeclarativeRectangle\") failed ***")
 
45
        return rectangle
 
46
 
 
47
    def get_test_rectangle_by_child_search(self):
 
48
        rectangle = self.get_root_item().get_children_by_type("QDeclarativeRectangle")[0]
 
49
        if rectangle is None:
 
50
            logger.error("*** get_children_by_type(\"QDeclarativeRectangle\")[0] failed ***")
 
51
        return rectangle
 
52
 
 
53
    def get_test_mousearea(self):
 
54
        mousearea = self.app.select_single("QDeclarativeMouseArea")
 
55
        if mousearea is None:
 
56
            logger.error("*** select_single(\"QDeclarativeMouseArea\") failed ***")
 
57
        return mousearea