mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-06 00:09:37 +08:00
feat: FilterTextsByScope
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0+2411161744
|
v5.0.0+2411191057
|
||||||
|
|||||||
@@ -30,6 +30,17 @@ type ScreenResult struct {
|
|||||||
Popup *PopupInfo `json:"popup,omitempty"`
|
Popup *PopupInfo `json:"popup,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *ScreenResult) FilterTextsByScope(x1, y1, x2, y2 float64) OCRTexts {
|
||||||
|
if x1 > 1 || y1 > 1 || x2 > 1 || y2 > 1 {
|
||||||
|
log.Warn().Msg("x1, y1, x2, y2 should be in percentage, skip filter scope")
|
||||||
|
return s.Texts
|
||||||
|
}
|
||||||
|
return s.Texts.FilterScope(AbsScope{
|
||||||
|
int(float64(s.Resolution.Width) * x1), int(float64(s.Resolution.Height) * y1),
|
||||||
|
int(float64(s.Resolution.Width) * x2), int(float64(s.Resolution.Height) * y2),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// GetScreenResult takes a screenshot, returns the image recognition result
|
// GetScreenResult takes a screenshot, returns the image recognition result
|
||||||
func (dExt *DriverExt) GetScreenResult(options ...ActionOption) (screenResult *ScreenResult, err error) {
|
func (dExt *DriverExt) GetScreenResult(options ...ActionOption) (screenResult *ScreenResult, err error) {
|
||||||
actionOptions := NewActionOptions(options...)
|
actionOptions := NewActionOptions(options...)
|
||||||
|
|||||||
Reference in New Issue
Block a user