mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 15:37:35 +08:00
fix: failed to swipe up
This commit is contained in:
@@ -11,10 +11,30 @@ import (
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/code"
|
||||
)
|
||||
|
||||
var (
|
||||
directionSlice = [][]float64{
|
||||
{0.85, 0.83, 0.85, 0.1},
|
||||
{0.9, 0.75, 0.9, 0.1},
|
||||
{0.6, 0.5, 0.6, 0.1},
|
||||
}
|
||||
)
|
||||
|
||||
func assertRelative(p float64) bool {
|
||||
return p >= 0 && p <= 1
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) SwipeUpUtil(count int64, options ...ActionOption) error {
|
||||
width := dExt.windowSize.Width
|
||||
height := dExt.windowSize.Height
|
||||
|
||||
fromX := float64(width) * directionSlice[count%3][0]
|
||||
fromY := float64(height) * directionSlice[count%3][1]
|
||||
toX := float64(width) * directionSlice[count%3][2]
|
||||
toY := float64(height) * directionSlice[count%3][3]
|
||||
|
||||
return dExt.Driver.SwipeFloat(fromX, fromY, toX, toY, options...)
|
||||
}
|
||||
|
||||
// SwipeRelative swipe from relative position [fromX, fromY] to relative position [toX, toY]
|
||||
func (dExt *DriverExt) SwipeRelative(fromX, fromY, toX, toY float64, options ...ActionOption) error {
|
||||
width := dExt.windowSize.Width
|
||||
|
||||
Reference in New Issue
Block a user