mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-10 23:12:41 +08:00
refactor: move uixt from hrp internal to pkg
This commit is contained in:
33
hrp/pkg/uixt/touch.go
Normal file
33
hrp/pkg/uixt/touch.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package uixt
|
||||
|
||||
func (dExt *DriverExt) ForceTouch(pathname string, pressure float64, duration ...float64) (err error) {
|
||||
return dExt.ForceTouchOffset(pathname, pressure, 0.5, 0.5, duration...)
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) ForceTouchOffset(pathname string, pressure, xOffset, yOffset float64, duration ...float64) (err error) {
|
||||
if len(duration) == 0 {
|
||||
duration = []float64{1.0}
|
||||
}
|
||||
var x, y, width, height float64
|
||||
if x, y, width, height, err = dExt.FindUIRectInUIKit(pathname); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return dExt.Driver.ForceTouchFloat(x+width*xOffset, y+height*yOffset, pressure, duration[0])
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) TouchAndHold(pathname string, duration ...float64) (err error) {
|
||||
return dExt.TouchAndHoldOffset(pathname, 0.5, 0.5, duration...)
|
||||
}
|
||||
|
||||
func (dExt *DriverExt) TouchAndHoldOffset(pathname string, xOffset, yOffset float64, duration ...float64) (err error) {
|
||||
if len(duration) == 0 {
|
||||
duration = []float64{1.0}
|
||||
}
|
||||
var x, y, width, height float64
|
||||
if x, y, width, height, err = dExt.FindUIRectInUIKit(pathname); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return dExt.Driver.TouchAndHoldFloat(x+width*xOffset, y+height*yOffset, duration[0])
|
||||
}
|
||||
Reference in New Issue
Block a user