Skip to content

Commit 3e77e5a

Browse files
author
gzliuxin
committed
fix adb.swipe & add swipe in test_blackjack
1 parent 117e710 commit 3e77e5a

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

airtest/core/android/android.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,9 @@ def swipe(self, p1, p2, duration=0.5, steps=5):
299299
None
300300
301301
"""
302-
p1 = self._touch_point_by_orientation(p1)
303-
p2 = self._touch_point_by_orientation(p2)
304302
if self.touch_method == TOUCH_METHOD.MINITOUCH:
303+
p1 = self._touch_point_by_orientation(p1)
304+
p2 = self._touch_point_by_orientation(p2)
305305
self.minitouch.swipe(p1, p2, duration=duration, steps=steps)
306306
else:
307307
duration *= 1000 # adb的swipe操作时间是以毫秒为单位的。

playground/test_blackjack.air/test_blackjack.py

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
p = wait(Template(r"tpl1499240490986.png", record_pos=(-0.443, -0.273), resolution=(2560, 1536)))
2626

2727
touch(p)
28+
29+
swipe(Template(r"tpl1523932626575.png", record_pos=(-0.266, 0.105), resolution=(1920, 1080)), vector=[0.0005, -0.4023])
30+
assert_exists(Template(r"tpl1523933150565.png", record_pos=(-0.213, 0.103), resolution=(1920, 1080)), "Swipe succeed")
31+
32+
2833
sleep(2)
2934
stop_app(PKG)
3035

Loading
Loading

0 commit comments

Comments
 (0)