Merge lp:~pitti/autopilot/fix-gdk-display into lp:autopilot

Proposed by Martin Pitt
Status: Merged
Approved by: Thomi Richards
Approved revision: 391
Merged at revision: 392
Proposed branch: lp:~pitti/autopilot/fix-gdk-display
Merge into: lp:autopilot
Diff against target: 64 lines (+24/-2)
2 files modified
autopilot/process/_bamf.py (+2/-2)
autopilot/tests/functional/test_introspection_features.py (+22/-0)
To merge this branch: bzr merge lp:~pitti/autopilot/fix-gdk-display
Reviewer Review Type Date Requested Status
Thomi Richards (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+198288@code.launchpad.net

Commit message

Fix initialization of GdkDisplay, to fix crash when accessing Window.geometry.

Description of the change

Fix initialization of GdkDisplay, see bzr changelog.

To post a comment you must log in.
Revision history for this message
Martin Pitt (pitti) wrote :

I ran this with

PYTHONPATH=. python -m autopilot.run run autopilot.tests.functional.test_introspection_features.IntrospectionFeatureTests

as the full functional test suite currently seems to be in a rather sorry state -- I get 97 failures :(

Revision history for this message
Martin Pitt (pitti) wrote :

> as the full functional test suite currently seems to be in a rather sorry
> state -- I get 97 failures :(

Fixing in https://code.launchpad.net/~pitti/autopilot/fix-run.py/+merge/198292

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'autopilot/process/_bamf.py'
--- autopilot/process/_bamf.py 2013-11-07 05:53:36 +0000
+++ autopilot/process/_bamf.py 2013-12-09 16:35:58 +0000
@@ -487,11 +487,11 @@
487 # builder.487 # builder.
488 from gi import require_version488 from gi import require_version
489 require_version('GdkX11', '3.0')489 require_version('GdkX11', '3.0')
490 from gi.repository import GdkX11490 from gi.repository import Gdk, GdkX11
491 # FIXME: We need to use the gdk window here to get the real coordinates491 # FIXME: We need to use the gdk window here to get the real coordinates
492 geometry = self._x_win.get_geometry()492 geometry = self._x_win.get_geometry()
493 origin = GdkX11.X11Window.foreign_new_for_display(493 origin = GdkX11.X11Window.foreign_new_for_display(
494 GdkX11.X11Display(), self._xid).get_origin()494 Gdk.Display().get_default(), self._xid).get_origin()
495 return (origin[0], origin[1], geometry.width, geometry.height)495 return (origin[0], origin[1], geometry.width, geometry.height)
496496
497 @property497 @property
498498
=== modified file 'autopilot/tests/functional/test_introspection_features.py'
--- autopilot/tests/functional/test_introspection_features.py 2013-12-06 00:43:23 +0000
+++ autopilot/tests/functional/test_introspection_features.py 2013-12-09 16:35:58 +0000
@@ -26,6 +26,7 @@
26import tempfile26import tempfile
27from tempfile import mktemp27from tempfile import mktemp
28from testtools.matchers import Equals, IsInstance, MatchesRegex, Not, Contains28from testtools.matchers import Equals, IsInstance, MatchesRegex, Not, Contains
29from testtools.matchers import LessThan, GreaterThan
29from textwrap import dedent30from textwrap import dedent
30from six import StringIO31from six import StringIO
3132
@@ -33,6 +34,7 @@
33from autopilot.testcase import AutopilotTestCase34from autopilot.testcase import AutopilotTestCase
34from autopilot.introspection.dbus import CustomEmulatorBase35from autopilot.introspection.dbus import CustomEmulatorBase
35from autopilot.introspection import _connection_matches_pid36from autopilot.introspection import _connection_matches_pid
37from autopilot.display import Display
3638
3739
38class EmulatorBase(CustomEmulatorBase):40class EmulatorBase(CustomEmulatorBase):
@@ -179,6 +181,26 @@
179 self.assertThat(out, Not(Contains(181 self.assertThat(out, Not(Contains(
180 "/Root/QMainWindow/QMenuBar/QToolButton")))182 "/Root/QMainWindow/QMenuBar/QToolButton")))
181183
184 def test_window_geometry(self):
185 """Window.geometry property
186
187 Check that all Window geometry properties work and have a plausible
188 range.
189 """
190 # ensure we have at least one open app window
191 app = self.start_mock_app(EmulatorBase)
192
193 display = Display.create()
194 for monitor in range(display.get_num_screens()):
195 (_, _, swidth, sheight) = Display.create().get_screen_geometry(0)
196 for win in self.process_manager.get_open_windows():
197 geom = win.geometry
198 self.assertThat(len(geom), Equals(4))
199 self.assertThat(geom[0], GreaterThan(-1)) # no GreaterEquals
200 self.assertThat(geom[1], GreaterThan(-1))
201 self.assertThat(geom[2], LessThan(swidth + 1))
202 self.assertThat(geom[3], LessThan(sheight + 1))
203
182204
183class QMLCustomEmulatorTestCase(AutopilotTestCase):205class QMLCustomEmulatorTestCase(AutopilotTestCase):
184 """Test the introspection of a QML application with a custom emulator."""206 """Test the introspection of a QML application with a custom emulator."""

Subscribers

People subscribed via source and target branches