Skip to content

Commit 27b1dc8

Browse files
committed
adbclient: changed drag() duration parameter units
- Version 5.1.1
1 parent 5f63239 commit 27b1dc8

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

AndroidViewClient/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from setuptools import setup, find_packages
44

55
setup(name='androidviewclient',
6-
version='5.1.0',
6+
version='5.1.1',
77
description='''AndroidViewClient is a 100% pure python tool that
88
simplifies test script creation providing higher level operations and the ability of
99
obtaining the tree of Views present at any given moment on the device or emulator screen.

AndroidViewClient/src/com/dtmilano/android/adb/adbclient.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
@author: Diego Torres Milano
1818
'''
1919

20-
__version__ = '5.1.0'
20+
__version__ = '5.1.1'
2121

2222
import sys
2323
import warnings
@@ -378,14 +378,23 @@ def takeSnapshot(self, reconnect=False):
378378
def touch(self, x, y, eventType=DOWN_AND_UP):
379379
self.shell('input tap %d %d' % (x, y))
380380

381-
def drag(self, (x0, y0), (x1, y1), duration, steps):
381+
def drag(self, (x0, y0), (x1, y1), duration, steps=1):
382+
'''
383+
Sends drag event (actually it's using C{input swipe} command.
384+
385+
@param (x0, y0): starting point
386+
@param (x1, y1): ending point
387+
@param duration: duration of the event in ms
388+
@param steps: number of steps (currently ignored by @{input swipe}
389+
'''
390+
382391
version = int(self.getProperty('ro.build.version.sdk'))
383392
if version <= 15:
384393
raise RuntimeError('drag: API <= 15 not supported (version=%d)' % version)
385394
elif version <= 17:
386395
self.shell('input swipe %d %d %d %d' % (x0, y0, x1, y1))
387396
else:
388-
self.shell('input swipe %d %d %d %d %d' % (x0, y0, x1, y1, duration * 1000))
397+
self.shell('input swipe %d %d %d %d %d' % (x0, y0, x1, y1, duration))
389398

390399
def type(self, text):
391400
self.shell(u'input text "%s"' % text)

0 commit comments

Comments
 (0)