mirror of
https://github.com/servo/servo.git
synced 2025-08-14 01:45:33 +01:00
Update web-platform-tests to revision 0a28ecf697d96db228f8382db0e41f1c54314dad
This commit is contained in:
parent
1ff56aa84f
commit
52045cb370
106 changed files with 1208 additions and 778 deletions
|
@ -23,4 +23,44 @@ detection_test("FaceDetectionTest", async (t, detectionTest) => {
|
|||
assert_equals(mock.getFastMode(), true, "maxDetectedFaces");
|
||||
}, "Test that FaceDetectionOptions are correctly propagated");
|
||||
|
||||
detection_test("BarcodeDetectionTest", async (t, detectionTest) => {
|
||||
const img = document.getElementById("img");
|
||||
const mock = detectionTest.MockBarcodeDetectionProvider();
|
||||
|
||||
const detectorWithNoOptions = new BarcodeDetector();
|
||||
let barcodeDetectionResult = await detectorWithNoOptions.detect(img);
|
||||
assert_array_equals(mock.getFormats(), [], "formats");
|
||||
|
||||
const detectorWithOptions = new BarcodeDetector({
|
||||
formats: ["code_128", "qr_code"]});
|
||||
barcodeDetectionResult = await detectorWithOptions.detect(img);
|
||||
assert_array_equals(
|
||||
mock.getFormats(),
|
||||
[shapeDetection.mojom.BarcodeFormat.CODE_128,
|
||||
shapeDetection.mojom.BarcodeFormat.QR_CODE],
|
||||
"formats");
|
||||
|
||||
try {
|
||||
new BarcodeDetector({formats: []});
|
||||
assert_unreached("providing hint option that is empty should fail");
|
||||
} catch (error) {
|
||||
assert_equals(error.name, "TypeError");
|
||||
}
|
||||
|
||||
try {
|
||||
new BarcodeDetector({formats: ["unknown"]});
|
||||
assert_unreached("providing \"unknown\" as a hint option should fail");
|
||||
} catch (error) {
|
||||
assert_equals(error.name, "TypeError");
|
||||
}
|
||||
|
||||
try {
|
||||
new BarcodeDetector({formats: ["foo", "bar"]});
|
||||
assert_unreached(
|
||||
"providing hint option with unrecognized formats should fail");
|
||||
} catch (error) {
|
||||
assert_equals(error.name, "TypeError");
|
||||
}
|
||||
}, "Test that BarcodeDetectorOptions are correctly propagated");
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue