mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 15:37:35 +08:00
change: FindTexts WithMatchOne option, found one, skip searching and return
This commit is contained in:
+5
-5
@@ -167,16 +167,16 @@ func (t OCRTexts) FindTexts(texts []string, options ...ActionOption) (results OC
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
results = append(results, ocrText)
|
results = append(results, ocrText)
|
||||||
|
|
||||||
|
// found one, skip searching and return
|
||||||
|
if actionOptions.MatchOne {
|
||||||
|
return results, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(results) == len(texts) {
|
if len(results) == len(texts) {
|
||||||
return results, nil
|
return results, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if actionOptions.MatchOne && len(results) > 0 {
|
|
||||||
return results, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, errors.Wrap(code.CVResultNotFoundError,
|
return nil, errors.Wrap(code.CVResultNotFoundError,
|
||||||
fmt.Sprintf("texts %s not found in %v", texts, t.texts()))
|
fmt.Sprintf("texts %s not found in %v", texts, t.texts()))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user