mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 08:19:44 +08:00
fix: handle offset
This commit is contained in:
@@ -5,7 +5,7 @@ func (dExt *DriverExt) Drag(pathname string, toX, toY int, pressForDuration ...f
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) DragFloat(pathname string, toX, toY float64, pressForDuration ...float64) (err error) {
|
||||
return dExt.DragOffsetFloat(pathname, toX, toY, 0.5, 0.5, pressForDuration...)
|
||||
return dExt.DragOffsetFloat(pathname, toX, toY, 0, 0, pressForDuration...)
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) DragOffset(pathname string, toX, toY int, xOffset, yOffset float64, pressForDuration ...float64) (err error) {
|
||||
@@ -22,7 +22,6 @@ func (dExt *DriverExt) DragOffsetFloat(pathname string, toX, toY, xOffset, yOffs
|
||||
return err
|
||||
}
|
||||
|
||||
// FIXME: handle offset
|
||||
return dExt.Driver.DragFloat(point.X+xOffset, point.Y+yOffset, toX, toY,
|
||||
WithPressDuration(pressForDuration[0]))
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ func (dExt *DriverExt) TapByCV(imagePath string, options ...ActionOption) error
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) Tap(param string, options ...ActionOption) error {
|
||||
return dExt.TapOffset(param, 0.5, 0.5, options...)
|
||||
return dExt.TapOffset(param, 0, 0, options...)
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) TapOffset(param string, xOffset, yOffset float64, options ...ActionOption) (err error) {
|
||||
@@ -64,7 +64,6 @@ func (dExt *DriverExt) TapOffset(param string, xOffset, yOffset float64, options
|
||||
return err
|
||||
}
|
||||
|
||||
// FIXME: handle offset
|
||||
return dExt.TapAbsXY(point.X+xOffset, point.Y+yOffset, options...)
|
||||
}
|
||||
|
||||
@@ -80,7 +79,7 @@ func (dExt *DriverExt) DoubleTapXY(x, y float64) error {
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) DoubleTap(param string) (err error) {
|
||||
return dExt.DoubleTapOffset(param, 0.5, 0.5)
|
||||
return dExt.DoubleTapOffset(param, 0, 0)
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) DoubleTapOffset(param string, xOffset, yOffset float64) (err error) {
|
||||
@@ -89,6 +88,5 @@ func (dExt *DriverExt) DoubleTapOffset(param string, xOffset, yOffset float64) (
|
||||
return err
|
||||
}
|
||||
|
||||
// FIXME: handle offset
|
||||
return dExt.Driver.DoubleTapFloat(point.X+xOffset, point.Y+yOffset)
|
||||
}
|
||||
|
||||
@@ -43,6 +43,6 @@ func TestDriverExt_TapWithOCR(t *testing.T) {
|
||||
checkErr(t, err)
|
||||
|
||||
// 需要点击文字上方的图标
|
||||
err = driverExt.TapOffset("抖音", 0.5, -1)
|
||||
err = driverExt.TapOffset("抖音", 0, -20)
|
||||
checkErr(t, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user