mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-10 17:43:00 +08:00
merge v5
This commit is contained in:
@@ -1 +1 @@
|
||||
v5.0.0-beta-2503231006
|
||||
v5.0.0-beta-2503251425
|
||||
|
||||
@@ -157,6 +157,25 @@ func (dExt *XTDriver) FindScreenText(text string, opts ...option.ActionOption) (
|
||||
if options.ScreenShotFileName == "" {
|
||||
opts = append(opts, option.WithScreenShotFileName(fmt.Sprintf("find_screen_text_%s", text)))
|
||||
}
|
||||
|
||||
// convert relative scope to absolute scope
|
||||
if options.AbsScope == nil && len(options.Scope) == 4 {
|
||||
windowSize, err := dExt.WindowSize()
|
||||
if err != nil {
|
||||
return ai.OCRText{}, err
|
||||
}
|
||||
absScope := option.AbsScope{
|
||||
int(options.Scope[0] * float64(windowSize.Width)),
|
||||
int(options.Scope[1] * float64(windowSize.Height)),
|
||||
int(options.Scope[2] * float64(windowSize.Width)),
|
||||
int(options.Scope[3] * float64(windowSize.Height)),
|
||||
}
|
||||
opts = append(opts, option.WithAbsScope(
|
||||
absScope[0], absScope[1], absScope[2], absScope[3]))
|
||||
log.Info().Interface("scope", options.Scope).
|
||||
Interface("absScope", absScope).Msg("convert to abs scope")
|
||||
}
|
||||
|
||||
ocrTexts, err := dExt.GetScreenTexts(opts...)
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
@@ -119,7 +119,7 @@ func TestDriverExt_Seek(t *testing.T) {
|
||||
|
||||
func TestDriverExt_TapByOCR(t *testing.T) {
|
||||
driver := setupDriverExt(t)
|
||||
err := driver.TapByOCR("天气")
|
||||
err := driver.TapByOCR("天气", option.WithScope(0, 0.7, 0.3, 1))
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user