~azzar1/unity/fix-1059562-6.0

« back to all changes in this revision

Viewing changes to tests/autopilot/unity/emulators/screen.py

UnityShell: enable closing on middle-click, fix scaled decoration sizes, fix theming issues, added scale autopilot tests. Fixes: https://bugs.launchpad.net/bugs/1052821, https://bugs.launchpad.net/bugs/1053225, https://bugs.launchpad.net/bugs/1055605, https://bugs.launchpad.net/bugs/1055609, https://bugs.launchpad.net/bugs/1055610. Approved by Brandon Schaefer.

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 2012 Canonical
 
3
# Author: Marco Trevisan (Treviño)
 
4
#
 
5
# This program is free software: you can redistribute it and/or modify it
 
6
# under the terms of the GNU General Public License version 3, as published
 
7
# by the Free Software Foundation.
 
8
#
 
9
 
 
10
from __future__ import absolute_import
 
11
 
 
12
import logging
 
13
from unity.emulators import UnityIntrospectionObject
 
14
logger = logging.getLogger(__name__)
 
15
 
 
16
 
 
17
class Screen(UnityIntrospectionObject):
 
18
    """The Screen class."""
 
19
 
 
20
    @property
 
21
    def windows(self):
 
22
        """Return the available windows, or None."""
 
23
        return self.get_children_by_type(Window)
 
24
 
 
25
    @property
 
26
    def scaled_windows(self):
 
27
        """Return the available scaled windows, or None."""
 
28
        return self.get_children_by_type(Window, scaled=True)
 
29
 
 
30
 
 
31
class Window(UnityIntrospectionObject):
 
32
    """An individual window."""
 
33
 
 
34
    @property
 
35
    def geometry(self):
 
36
        """Returns a tuple of (x,y,w,h) for the current window."""
 
37
        return (self.x, self.y, self.width, self.height)
 
38
 
 
39
    @property
 
40
    def scale_close_geometry(self):
 
41
        """Returns a tuple of (x,y,w,h) for the scale close button."""
 
42
        return (self.scaled_close_x, self.scaled_close_y, self.scaled_close_width, self.scaled_close_height)