~nick-dedekind/unity8/indicators.hint-interval

« back to all changes in this revision

Viewing changes to tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py

  • Committer: Nick Dedekind
  • Date: 2014-03-07 15:54:57 UTC
  • mfrom: (638.1.118 unity8)
  • Revision ID: nicholas.dedekind@gmail.com-20140307155457-f0s1zu5ll2czt3rq
merged with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
2
#
3
3
# Unity Autopilot Test Suite
4
 
# Copyright (C) 2013 Canonical
 
4
# Copyright (C) 2013, 2014 Canonical
5
5
#
6
6
# This program is free software: you can redistribute it and/or modify
7
7
# it under the terms of the GNU General Public License as published by
44
44
            self.skipTest("Test cannot be run on the desktop.")
45
45
 
46
46
    def swipe_screen_from_right(self):
47
 
        qml_view = self.main_window.get_qml_view()
48
 
        width = qml_view.width
49
 
        height = qml_view.height
 
47
        width = self.main_window.width
 
48
        height = self.main_window.height
50
49
        start_x = width
51
50
        start_y = int(height/2)
52
51
        end_x = int(width/2)
55
54
        logger.info("Swiping screen from the right edge")
56
55
        self.touch.drag(start_x, start_y, end_x, end_y)
57
56
 
58
 
    def _get_current_focused_app_id(self):
59
 
        return self._proxy.select_single("Shell").currentFocusedAppId
60
 
 
61
57
    def _launch_app(self, app_name):
62
58
        """Launches the application *app_name*
63
59
 
86
82
 
87
83
        self.assertThat(app, NotEquals(None))
88
84
        self.assertThat(
89
 
            self._get_current_focused_app_id(),
 
85
            self.main_window.get_current_focused_app_id(),
90
86
            Eventually(Equals("messaging-app"))
91
87
        )
92
88
 
98
94
 
99
95
        self._launch_app("messaging-app")
100
96
        self.assertThat(
101
 
            self._get_current_focused_app_id(),
 
97
            self.main_window.get_current_focused_app_id(),
102
98
            Eventually(Equals("messaging-app"))
103
99
        )
104
100
 
105
101
        self._launch_app("address-book-app")
106
102
        self.assertThat(
107
 
            self._get_current_focused_app_id(),
 
103
            self.main_window.get_current_focused_app_id(),
108
104
            Eventually(Equals("address-book-app"))
109
105
        )
110
106
 
119
115
 
120
116
        self._launch_app("messaging-app")
121
117
        self.assertThat(
122
 
            self._get_current_focused_app_id(),
 
118
            self.main_window.get_current_focused_app_id(),
123
119
            Eventually(Equals("messaging-app"))
124
120
        )
125
121
 
126
122
        self._launch_app("address-book-app")
127
123
        self.assertThat(
128
 
            self._get_current_focused_app_id(),
 
124
            self.main_window.get_current_focused_app_id(),
129
125
            Eventually(Equals("address-book-app"))
130
126
        )
131
127
 
132
128
        self.swipe_screen_from_right()
133
129
 
134
130
        self.assertThat(
135
 
            self._get_current_focused_app_id(),
 
131
            self.main_window.get_current_focused_app_id(),
136
132
            Eventually(Equals("messaging-app"))
137
133
        )