fune/testing/web-platform/tests/shape-detection/detection-ImageDataUint16StorageFormat.https.window.js
Jack Hsieh 7ae191b73d Bug 1793029 [wpt PR 36115] - shapedetection: Let SkBitmap calculate minimum valid value for rowBytes, a=testonly
Automatic update from web-platform-tests
shapedetection: Let SkBitmap calculate minimum valid value for rowBytes

In order to align with the expectation of SkBitmap.rowBytes() equal to
SkBitmap.info().minRowBytes() in bitmap_skbitmap_mojom_traits.cc, pass 0
for rowBytes parameter when calling SkBitmap.tryAllocPixels() for
SkBitmap to calculate minimum valid value for rowBytes.

A new shape-detection WPT test is added to test if detectors can process ImageData with uint16 storage format properly which is the case where minimal row bytes is half of the image row bytes.

Bug: 1242240
Change-Id: I4399e5c2cbda853cf6c5a5d269eea46d226a958b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3919646
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Commit-Queue: Jack Hsieh <chengweih@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1052249}

--

wpt-commits: 03c06a32d54ad2cf5b07031455fefef71905c3c3
wpt-pr: 36115
2022-10-12 11:08:42 +00:00

41 lines
1.2 KiB
JavaScript

// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/shape-detection/resources/shapedetection-helpers.js
const imgUint16 = new ImageData(1024, 1024, {storageFormat: 'uint16'});
// These tests verify that a Detector's detect() can process ImageData with
// uint16 storage format.
const imageDataTests = [
{
createDetector: () => {
return new FaceDetector();
},
mockTestName: 'FaceDetectionTest',
name:
'FaceDetector.detect() can process uint16 storage format ImageData'
},
{
createDetector: () => {
return new BarcodeDetector();
},
mockTestName: 'BarcodeDetectionTest',
name:
'BarcodeDetector.detect() can process uint16 storage format ImageData'
},
{
createDetector: () => {
return new TextDetector();
},
mockTestName: 'TextDetectionTest',
name:
'TextDetector.detect() can process uint16 storage format ImageData'
}
];
for (let imageDataTest of imageDataTests) {
detection_test(imageDataTest.mockTestName, async () => {
let detector = imageDataTest.createDetector();
await detector.detect(imgUint16);
}, imageDataTest.name);
}