mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-01 13:59:37 +08:00
change: convertToAbsolutePoint, convertToAbsoluteCoordinates
This commit is contained in:
@@ -255,11 +255,9 @@ func (ud *UIA2Driver) Orientation() (orientation types.Orientation, err error) {
|
||||
func (ud *UIA2Driver) DoubleTap(x, y float64, opts ...option.ActionOption) error {
|
||||
var err error
|
||||
actionOptions := option.NewActionOptions(opts...)
|
||||
if actionOptions.Relative {
|
||||
x, y, err = convertToAbsolutePoint(ud, x, y)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
x, y, err = convertToAbsolutePoint(ud, x, y)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
x, y = actionOptions.ApplyOffset(x, y)
|
||||
|
||||
@@ -351,12 +349,9 @@ func (ud *UIA2Driver) TouchAndHold(x, y float64, opts ...option.ActionOption) (e
|
||||
// steps, the swipe will take around 0.5 seconds to complete.
|
||||
func (ud *UIA2Driver) Drag(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error {
|
||||
var err error
|
||||
actionOptions := option.NewActionOptions(opts...)
|
||||
if actionOptions.Relative {
|
||||
fromX, fromY, toX, toY, err = convertToAbsoluteCoordinates(ud, fromX, fromY, toX, toY)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fromX, fromY, toX, toY, err = convertToAbsoluteCoordinates(ud, fromX, fromY, toX, toY)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
data := map[string]interface{}{
|
||||
"startX": fromX,
|
||||
@@ -381,11 +376,9 @@ func (ud *UIA2Driver) Swipe(fromX, fromY, toX, toY float64, opts ...option.Actio
|
||||
// register(postHandler, new Swipe("/wd/hub/session/:sessionId/touch/perform"))
|
||||
var err error
|
||||
actionOptions := option.NewActionOptions(opts...)
|
||||
if actionOptions.Relative {
|
||||
fromX, fromY, toX, toY, err = convertToAbsoluteCoordinates(ud, fromX, fromY, toX, toY)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fromX, fromY, toX, toY, err = convertToAbsoluteCoordinates(ud, fromX, fromY, toX, toY)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
duration := 200.0
|
||||
|
||||
Reference in New Issue
Block a user