refactor: move ios options to pkg/uixt/options

This commit is contained in:
lilong.129
2025-02-06 14:54:10 +08:00
parent 0c5b60b94a
commit 14c81ea142
25 changed files with 203 additions and 186 deletions

View File

@@ -0,0 +1,29 @@
package uixt
import (
"fmt"
"github.com/httprunner/httprunner/v5/code"
"github.com/pkg/errors"
)
func (dExt *DriverExt) Drag(fromX, fromY, toX, toY float64, options ...ActionOption) (err error) {
windowSize, err := dExt.Driver.WindowSize()
if err != nil {
return errors.Wrap(code.DeviceGetInfoError, err.Error())
}
width := windowSize.Width
height := windowSize.Height
if !assertRelative(fromX) || !assertRelative(fromY) ||
!assertRelative(toX) || !assertRelative(toY) {
return fmt.Errorf("fromX(%f), fromY(%f), toX(%f), toY(%f) must be less than 1",
fromX, fromY, toX, toY)
}
fromX = float64(width) * fromX
fromY = float64(height) * fromY
toX = float64(width) * toX
toY = float64(height) * toY
return dExt.Driver.Drag(fromX, fromY, toX, toY, options...)
}