|
17 | 17 | @author: Diego Torres Milano |
18 | 18 | ''' |
19 | 19 |
|
20 | | -__version__ = '5.1.0' |
| 20 | +__version__ = '5.1.1' |
21 | 21 |
|
22 | 22 | import sys |
23 | 23 | import warnings |
@@ -378,14 +378,23 @@ def takeSnapshot(self, reconnect=False): |
378 | 378 | def touch(self, x, y, eventType=DOWN_AND_UP): |
379 | 379 | self.shell('input tap %d %d' % (x, y)) |
380 | 380 |
|
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 | + |
382 | 391 | version = int(self.getProperty('ro.build.version.sdk')) |
383 | 392 | if version <= 15: |
384 | 393 | raise RuntimeError('drag: API <= 15 not supported (version=%d)' % version) |
385 | 394 | elif version <= 17: |
386 | 395 | self.shell('input swipe %d %d %d %d' % (x0, y0, x1, y1)) |
387 | 396 | 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)) |
389 | 398 |
|
390 | 399 | def type(self, text): |
391 | 400 | self.shell(u'input text "%s"' % text) |
|
0 commit comments