Update web-platform-tests to revision 7bfa241671d6ca921229f6601d2d7b70dd55da90

This commit is contained in:
WPT Sync Bot 2019-07-27 10:23:05 +00:00
parent f78dd6142e
commit 441c1fa235
47 changed files with 888 additions and 163 deletions

View file

@ -0,0 +1,64 @@
// META: global=window,worker
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// META: script=/shape-detection/resources/shapedetection-helpers.js
// See: https://wicg.github.io/shape-detection-api/
'use strict';
idl_test(
['shape-detection-api'],
['dom', 'geometry'],
async idl_array => {
idl_array.add_objects({
FaceDetector: ['faceDetector'],
DetectedFace: ['detectedFace'],
BarcodeDetector: ['barcodeDetector'],
DetectedBarcode: ['detectedBarcode']
});
let faceDetectionTest;
try {
faceDetectionTest =
await initialize_detection_tests("FaceDetectionTest");
const img = createTestImage();
const theImageBitmap = await createImageBitmap(img);
self.faceDetector = new FaceDetector();
const faceDetectionResult = await faceDetector.detect(theImageBitmap);
self.detectedFace = faceDetectionResult[0];
} catch (e) {
// Surfaced in idlharness.js's test_object.
} finally {
faceDetectionTest && faceDetectionTest.reset();
}
let barcodeDetectionTest;
try {
barcodeDetectionTest =
await initialize_detection_tests("BarcodeDetectionTest");
const img = createTestImage();
const theImageBitmap = await createImageBitmap(img);
self.barcodeDetector = new BarcodeDetector();
const barcodeDetectionResult =
await barcodeDetector.detect(theImageBitmap);
self.detectedBarcode = barcodeDetectionResult[0];
} catch (e) {
// Surface in idlharness.js's test_object.
} finally {
barcodeDetectionTest && barcodeDetectionTest.reset();
}
}
);
function createTestImage() {
const image = new OffscreenCanvas(100, 50);
const imgctx = image.getContext('2d');
imgctx.fillStyle = "#F00";
imgctx.fillRect(0, 0, 2, 2);
imgctx.fillStyle = "#0F0";
imgctx.fillRect(0, 0, 1, 1);
return image;
}