AirtestProject / AirtestProject/Airtest

airtest.core.api.swipe的向量参数不能为负吗(反向拉取)

未关闭
#784 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
9.6k
派生
1.5k
PR 合并指标
30 天内没有已合并 PR

描述

**描述问题bug**
使用`airtest.core.api.swipe`的`vector`参数时想反向操作,设值为负,但是操作后出问题看了下代码为啥只判断了<=1的情况,如果改成相对坐标的负值的操作话是没问题的,不知道是bug还是啥。。。

```
# airtest.core.api.swipe部分源代码, Version: 1.1.4
elif vector:
if vector[0] <= 1 and vector[1] <= 1:
w, h = G.DEVICE.get_current_resolution()
vector = (int(vector[0] * w), int(vector[1] * h))
pos2 = (pos1[0] + vector[0], pos1[1] + vector[1])

# 我使用的代码
from airtest.core.api import swipe

swipe([200.0, 110.0], vector=[0.0, -100.0]) # bug代码,会被强制乘上分辨率
swipe([200.0, 110.0], vector=[0.0, -0.3]) # 这个没问题

```

**python 版本:** `python3.8.5`

**airtest 版本:** `1.1.4`

**其他相关环境信息**
MacBook Pro (13-inch, 2018, Four Thunderbolt 3 Ports)

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。