xpresser-team team mailing list archive
-
xpresser-team team
-
Mailing list archive
-
Message #00019
[Merge] lp:~xpresser-team/xpresser/xpresser-with-special-keys into lp:xpresser
Chris Wayne has proposed merging lp:~xpresser-team/xpresser/xpresser-with-special-keys into lp:xpresser.
Requested reviews:
Xpresser (xpresser-team)
For more details, see:
https://code.launchpad.net/~xpresser-team/xpresser/xpresser-with-special-keys/+merge/121060
Adding in special key support!
--
https://code.launchpad.net/~xpresser-team/xpresser/xpresser-with-special-keys/+merge/121060
Your team Xpresser is requested to review the proposed merge of lp:~xpresser-team/xpresser/xpresser-with-special-keys into lp:xpresser.
=== modified file 'debian/changelog'
--- debian/changelog 2012-07-05 13:52:37 +0000
+++ debian/changelog 2012-08-23 17:19:21 +0000
@@ -1,3 +1,29 @@
+xpresser (1.1.3) precise; urgency=low
+
+ * Adding in special key support
+
+ [Chris Gagnon]
+ * reversed keys_to_press for key release so things like ctrl-alt-
+ backspace wont delete a typed key
+
+ [Chris Wayne]
+ * Fixed sleep after each key press
+ * Added some more special keys (all F keys, Function, and others)
+
+ -- Chris Wayne <chris.wayne@xxxxxxxxxxxxx> Sat, 18 Aug 2012 14:36:12 -0400
+
+xpresser (1.1.2) precise; urgency=low
+
+ * Small fix
+
+ -- Chris Wayne <chris.wayne@xxxxxxxxxxxxx> Thu, 19 Jul 2012 21:01:24 -0400
+
+xpresser (1.1.1) precise; urgency=low
+
+ * Adding in python-gi-cairo as a build dependency
+
+ -- Chris Wayne <chris.wayne@xxxxxxxxxxxxx> Thu, 19 Jul 2012 20:29:24 -0400
+
xpresser (1.1) precise; urgency=low
* Initial Precise release into Xpresser PPA
=== modified file 'debian/control'
--- debian/control 2012-07-05 15:56:48 +0000
+++ debian/control 2012-08-23 17:19:21 +0000
@@ -1,12 +1,14 @@
Source: xpresser
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@xxxxxxxxxxxxxxxx>
-XSBC-Original-Maintainer: Xpresser Team <xpresser-team@xxxxxxxxxxxxxxxxxxx>
Section: python
-Priority: optional
+Priority: extra
Build-Depends: python-all (>= 2.6.6-3), debhelper (>= 9)
Standards-Version: 3.9.3
Package: python-xpresser
Architecture: all
-Depends: ${misc:Depends}, ${python:Depends}, python-opencv, python-pyatspi2, python-numpy, python-simplecv
+Depends: ${misc:Depends}, ${python:Depends}, python-opencv, python-pyatspi2, python-numpy, python-simplecv, python-gi-cairo
Description: Python library to script Graphic User Interfaces.
+ Xpresser is a python library to automate GUI testing. It uses screenshot matching
+ to make automation easy, and can emulate actual user testing, rather than through
+ introspection.
=== modified file 'debian/copyright'
--- debian/copyright 2012-07-05 15:56:48 +0000
+++ debian/copyright 2012-08-23 17:19:21 +0000
@@ -1,11 +1,23 @@
-Format: http://dep.debian.net/deps/dep5
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: python-xpresser
Source: http://bazaar.launchpad.net/~xpresser-team/xpresser
Files: *
Copyright: 2012 Canonical Ltd.
-License: LGPL-3.0
+License: LGPL-3
-Files: debian/*
-Copyright: 2012 Canonical Ltd.
-License: LGPL-3.0
+License: LGPL-3
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+ .
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+ .
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the full text of the GNU Lesser General Public License
+ version 3 can be found in the file /usr/share/common-licenses/LGPL-3.
=== added file 'debian/watch'
--- debian/watch 1970-01-01 00:00:00 +0000
+++ debian/watch 2012-08-23 17:19:21 +0000
@@ -0,0 +1,3 @@
+version=3
+http://launchpad.net/xpresser/+download .*/Xpresser-(.+)\.tar\.gz
+
=== added directory 'dist'
=== added file 'dist/Xpresser-1.1.tar.gz'
Binary files dist/Xpresser-1.1.tar.gz 1970-01-01 00:00:00 +0000 and dist/Xpresser-1.1.tar.gz 2012-08-23 17:19:21 +0000 differ
=== modified file 'setup.py'
--- setup.py 2010-07-22 14:04:17 +0000
+++ setup.py 2012-08-23 17:19:21 +0000
@@ -3,7 +3,7 @@
from distutils.core import setup
setup(name='Xpresser',
- version='1.0',
+ version='1.1',
description='Python library to script Graphic User Interfaces.',
author='Gustavo Niemeyer',
author_email='gustavo.niemeyer@xxxxxxxxxxxxx',
=== modified file 'xpresser/tests/test_xutils.py'
--- xpresser/tests/test_xutils.py 2012-05-21 19:57:09 +0000
+++ xpresser/tests/test_xutils.py 2012-08-23 17:19:21 +0000
@@ -86,6 +86,19 @@
finally:
window.destroy()
+ def test_type_special(self):
+ entry = Gtk.Entry()
+ window = self.create_window(entry)
+ try:
+ window.present()
+ entry.grab_focus()
+ self.flush_gtk()
+ xutils.type(["<Shift>", "hi there"])
+ self.flush_gtk()
+ self.assertEquals(entry.get_text(), "HI THERE")
+ finally:
+ window.destroy()
+
def test_take_screenshot(self):
"""Verify that take_screenshot works, with a real screenshot.
=== modified file 'xpresser/xutils.py'
--- xpresser/xutils.py 2012-05-21 19:57:09 +0000
+++ xpresser/xutils.py 2012-08-23 17:19:21 +0000
@@ -19,10 +19,19 @@
#
import pyatspi
import SimpleCV
+import types
+import time
from xpresser.image import Image
from tempfile import NamedTemporaryFile
from gi.repository import Gdk
+specialkeys = {'<Ctrl>' : 37, "<Shift>" : 50, "<Alt>" : 64, "<Meta>" : 133,
+ '<Tab>' : 23, '<Super>' : 133, '<Fn>' : 151, '<PgUp>' : 112,
+ '<PgDn>' : 117, '<Delete>' : 119, '<Home>' : 110, '<Esc>' : 9,
+ '<F1>' : 67, '<F2>' : 68, '<F3>' : 69, '<F4>' : 70, '<F5>' : 71,
+ '<F6>' : 72, '<F7>' : 73, '<F8>' : 74, '<F9>' : 75, '<F10>' : 76,
+ '<F11>' : 95, '<F12>' : 96}
+
def click(x, y):
pyatspi.Registry.generateMouseEvent(x, y, pyatspi.MOUSE_B1C)
@@ -37,10 +46,33 @@
pyatspi.Registry.generateMouseEvent(x, y, pyatspi.MOUSE_ABS)
def type(string):
+ if isinstance(string, types.ListType):
+ keys_to_press = []
+ for string_part in string:
+ if string_part in specialkeys:
+ keys_to_press.append(specialkeys[string_part])
+ __press_key(keys_to_press[-1])
+ else:
+ __type_standard(string_part)
+ keys_to_press.reverse()
+ #hold the key long enough to constitute a hold, not a tap
+ time.sleep(.4)
+ for keys in keys_to_press:
+ __release_key(keys)
+ else:
+ __type_standard(string)
+
+def __type_standard(string):
for char in string:
keyval = Gdk.unicode_to_keyval(ord(char))
pyatspi.Registry.generateKeyboardEvent(keyval, None, pyatspi.KEY_SYM)
+def __press_key(keycode):
+ pyatspi.Registry.generateKeyboardEvent(keycode, None, pyatspi.KEY_PRESS)
+
+def __release_key(keycode):
+ pyatspi.Registry.generateKeyboardEvent(keycode, None, pyatspi.KEY_RELEASE)
+
def take_screenshot():
window = Gdk.get_default_root_window()
surface = Gdk.cairo_create(window).get_target()
Follow ups