mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-02 14:29:44 +08:00
feat: add WithSwipeOffset to set offset for swipe start/end point
This commit is contained in:
@@ -272,6 +272,15 @@ func (ad *adbDriver) Swipe(fromX, fromY, toX, toY int, options ...ActionOption)
|
||||
}
|
||||
|
||||
func (ad *adbDriver) SwipeFloat(fromX, fromY, toX, toY float64, options ...ActionOption) error {
|
||||
actionOptions := NewActionOptions(options...)
|
||||
|
||||
if len(actionOptions.Offset) == 4 {
|
||||
fromX += float64(actionOptions.Offset[0])
|
||||
fromY += float64(actionOptions.Offset[1])
|
||||
toX += float64(actionOptions.Offset[2])
|
||||
toY += float64(actionOptions.Offset[3])
|
||||
}
|
||||
|
||||
// adb shell input swipe fromX fromY toX toY
|
||||
_, err := ad.adbClient.RunShellCommand(
|
||||
"input", "swipe",
|
||||
|
||||
Reference in New Issue
Block a user