diff --git a/uiautomator2/__init__.py b/uiautomator2/__init__.py index 0aaa3cf..3c89ef5 100644 --- a/uiautomator2/__init__.py +++ b/uiautomator2/__init__.py @@ -425,13 +425,17 @@ def swipe(self, fx, fy, tx, ty, duration: Optional[float] = None, steps: Optiona Links: https://developer.android.com/reference/android/support/test/uiautomator/UiDevice.html#swipe%28int,%20int,%20int,%20int,%20int%29 """ + if duration is not None and steps is not None: + warnings.warn("duration and steps can not be set at the same time, use steps") + duration = None + if duration: + steps = int(duration * 200) + if not steps: + steps = SCROLL_STEPS + logger.debug("swipe from (%s, %s) to (%s, %s), steps: %d", fx, fy, tx, ty, steps) rel2abs = self.pos_rel2abs fx, fy = rel2abs(fx, fy) tx, ty = rel2abs(tx, ty) - if not duration: - steps = SCROLL_STEPS - if not steps: - steps = int(duration * 200) steps = max(2, steps) # step=1 has no swipe effect with self._operation_delay("swipe"): return self.jsonrpc.swipe(fx, fy, tx, ty, steps) diff --git a/uiautomator2/assets/sync.sh b/uiautomator2/assets/sync.sh index 1129dac..29f4454 100755 --- a/uiautomator2/assets/sync.sh +++ b/uiautomator2/assets/sync.sh @@ -3,7 +3,7 @@ set -e -APK_VERSION="2.3.9" +APK_VERSION="2.3.10" # AGENT_VERSION="0.10.1" cd "$(dirname $0)"