Update web-platform-tests to revision 30a08266e1951b16ab2587068de64041095bbc2f

This commit is contained in:
WPT Sync Bot 2020-04-08 08:19:32 +00:00
parent 7b5ec99d25
commit 19a2b8047d
185 changed files with 3858 additions and 329 deletions

View file

@ -21,6 +21,12 @@ const imageElementTests =
mockTestName: "BarcodeDetectionTest",
detectionResultTest: BarcodeDetectorDetectionResultTest,
name: "Barcode - detect(HTMLImageElement)",
},
{
createDetector: () => { return new TextDetector(); },
mockTestName: "TextDetectionTest",
detectionResultTest: TextDetectorDetectionResultTest,
name: "Text - detect(HTMLImageElement)"
}
];
@ -62,4 +68,19 @@ function BarcodeDetectorDetectionResultTest(detectionResult, mockTest) {
assert_equals(detectionResult[1].format, "code_128", "barcode 2 format");
}
function TextDetectorDetectionResultTest(detectionResult, mockTest) {
assert_equals(detectionResult.length, 2, "Number of textBlocks");
assert_equals(detectionResult[0].rawValue, "cats", "textBlock 1");
assert_equals(detectionResult[1].rawValue, "dogs", "textBlock 2");
for (let i = 0; i < detectionResult.length; i++) {
assert_equals(detectionResult[i].boundingBox.x, detectionResult[i].cornerPoints[0].x);
assert_equals(detectionResult[i].boundingBox.y, detectionResult[i].cornerPoints[0].y);
assert_equals(detectionResult[i].boundingBox.width,
detectionResult[i].cornerPoints[2].x - detectionResult[i].cornerPoints[3].x);
assert_equals(detectionResult[i].boundingBox.height,
detectionResult[i].cornerPoints[2].y - detectionResult[i].cornerPoints[1].y);
}
}
</script>