mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 07:49:44 +08:00
optimize FindTexts return
This commit is contained in:
@@ -163,16 +163,16 @@ func (t OCRTexts) FindTexts(texts []string, options ...ActionOption) (results OC
|
||||
results = append(results, ocrText)
|
||||
}
|
||||
|
||||
if actionOptions.MatchOne && len(results) == 0 {
|
||||
return nil, errors.Wrap(code.CVResultNotFoundError,
|
||||
fmt.Sprintf("texts %s not found in %v", texts, t.texts()))
|
||||
if len(results) == len(texts) {
|
||||
return results, nil
|
||||
}
|
||||
|
||||
if !actionOptions.MatchOne && len(results) != len(texts) {
|
||||
return nil, errors.Wrap(code.CVResultNotFoundError,
|
||||
fmt.Sprintf("texts %s not found in %v", texts, t.texts()))
|
||||
if actionOptions.MatchOne && len(results) > 0 {
|
||||
return results, nil
|
||||
}
|
||||
return results, nil
|
||||
|
||||
return nil, errors.Wrap(code.CVResultNotFoundError,
|
||||
fmt.Sprintf("texts %s not found in %v", texts, t.texts()))
|
||||
}
|
||||
|
||||
func newVEDEMImageService() (*veDEMImageService, error) {
|
||||
|
||||
Reference in New Issue
Block a user