summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/shape-detection/resources
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/shape-detection/resources')
-rw-r--r--testing/web-platform/tests/shape-detection/resources/aztec-correction.jpgbin0 -> 47787 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/aztec-full.jpgbin0 -> 28632 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/aztec-layers.jpgbin0 -> 95666 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/aztec.jpgbin0 -> 23060 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/barcodes.movbin0 -> 1200741 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/code128-height.jpgbin0 -> 55292 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/code128.jpgbin0 -> 22948 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/face-bottom-left.jpgbin0 -> 185080 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/face-bottom-right.jpgbin0 -> 191912 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/face-center.jpgbin0 -> 177637 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/face-top-left.jpgbin0 -> 168676 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/face-top-right.jpgbin0 -> 171771 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/faces.movbin0 -> 2793460 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/pdf417-columns.jpgbin0 -> 32027 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/pdf417-compact.jpgbin0 -> 25472 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/pdf417-compaction.jpgbin0 -> 40094 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/pdf417-correction.jpgbin0 -> 49828 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/pdf417-rows.jpgbin0 -> 30318 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/pdf417-square.jpgbin0 -> 51406 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/pdf417-taller.jpgbin0 -> 43642 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/pdf417-wider.jpgbin0 -> 30318 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/pdf417.jpgbin0 -> 38048 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/qr-bottom-left.jpgbin0 -> 34846 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/qr-bottom-right.jpgbin0 -> 34846 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/qr-center.jpgbin0 -> 34838 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/qr-h.jpgbin0 -> 54287 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/qr-l.jpgbin0 -> 34210 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/qr-m.jpgbin0 -> 34838 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/qr-q.jpgbin0 -> 43431 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/qr-top-left.jpgbin0 -> 34968 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/qr-top-right.jpgbin0 -> 34968 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/shapedetection-helpers.js75
-rw-r--r--testing/web-platform/tests/shape-detection/resources/single-detection-helpers.js66
-rw-r--r--testing/web-platform/tests/shape-detection/resources/text-bottom-left.jpgbin0 -> 25605 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/text-bottom-right.jpgbin0 -> 25982 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/text-center.jpgbin0 -> 25646 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/text-top-left.jpgbin0 -> 26305 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/text-top-right.jpgbin0 -> 26364 bytes
-rw-r--r--testing/web-platform/tests/shape-detection/resources/text.movbin0 -> 132839 bytes
39 files changed, 141 insertions, 0 deletions
diff --git a/testing/web-platform/tests/shape-detection/resources/aztec-correction.jpg b/testing/web-platform/tests/shape-detection/resources/aztec-correction.jpg
new file mode 100644
index 0000000000..55bc0d23d6
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/aztec-correction.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/aztec-full.jpg b/testing/web-platform/tests/shape-detection/resources/aztec-full.jpg
new file mode 100644
index 0000000000..36390f0821
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/aztec-full.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/aztec-layers.jpg b/testing/web-platform/tests/shape-detection/resources/aztec-layers.jpg
new file mode 100644
index 0000000000..75449a7044
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/aztec-layers.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/aztec.jpg b/testing/web-platform/tests/shape-detection/resources/aztec.jpg
new file mode 100644
index 0000000000..f71e11f064
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/aztec.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/barcodes.mov b/testing/web-platform/tests/shape-detection/resources/barcodes.mov
new file mode 100644
index 0000000000..473a7ae239
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/barcodes.mov
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/code128-height.jpg b/testing/web-platform/tests/shape-detection/resources/code128-height.jpg
new file mode 100644
index 0000000000..69883e5683
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/code128-height.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/code128.jpg b/testing/web-platform/tests/shape-detection/resources/code128.jpg
new file mode 100644
index 0000000000..9bb66fe8ca
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/code128.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/face-bottom-left.jpg b/testing/web-platform/tests/shape-detection/resources/face-bottom-left.jpg
new file mode 100644
index 0000000000..1fb4e660e4
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/face-bottom-left.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/face-bottom-right.jpg b/testing/web-platform/tests/shape-detection/resources/face-bottom-right.jpg
new file mode 100644
index 0000000000..ce8837851b
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/face-bottom-right.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/face-center.jpg b/testing/web-platform/tests/shape-detection/resources/face-center.jpg
new file mode 100644
index 0000000000..30364040ed
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/face-center.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/face-top-left.jpg b/testing/web-platform/tests/shape-detection/resources/face-top-left.jpg
new file mode 100644
index 0000000000..300866b2eb
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/face-top-left.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/face-top-right.jpg b/testing/web-platform/tests/shape-detection/resources/face-top-right.jpg
new file mode 100644
index 0000000000..528a2a778d
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/face-top-right.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/faces.mov b/testing/web-platform/tests/shape-detection/resources/faces.mov
new file mode 100644
index 0000000000..b2c7b8c577
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/faces.mov
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/pdf417-columns.jpg b/testing/web-platform/tests/shape-detection/resources/pdf417-columns.jpg
new file mode 100644
index 0000000000..54a08cf0ee
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/pdf417-columns.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/pdf417-compact.jpg b/testing/web-platform/tests/shape-detection/resources/pdf417-compact.jpg
new file mode 100644
index 0000000000..1185c56dfe
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/pdf417-compact.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/pdf417-compaction.jpg b/testing/web-platform/tests/shape-detection/resources/pdf417-compaction.jpg
new file mode 100644
index 0000000000..20e4a1c64c
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/pdf417-compaction.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/pdf417-correction.jpg b/testing/web-platform/tests/shape-detection/resources/pdf417-correction.jpg
new file mode 100644
index 0000000000..0c64ea9605
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/pdf417-correction.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/pdf417-rows.jpg b/testing/web-platform/tests/shape-detection/resources/pdf417-rows.jpg
new file mode 100644
index 0000000000..9f5f67b10c
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/pdf417-rows.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/pdf417-square.jpg b/testing/web-platform/tests/shape-detection/resources/pdf417-square.jpg
new file mode 100644
index 0000000000..8a379ae6cc
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/pdf417-square.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/pdf417-taller.jpg b/testing/web-platform/tests/shape-detection/resources/pdf417-taller.jpg
new file mode 100644
index 0000000000..a520f22fde
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/pdf417-taller.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/pdf417-wider.jpg b/testing/web-platform/tests/shape-detection/resources/pdf417-wider.jpg
new file mode 100644
index 0000000000..9f5f67b10c
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/pdf417-wider.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/pdf417.jpg b/testing/web-platform/tests/shape-detection/resources/pdf417.jpg
new file mode 100644
index 0000000000..ebbe36b510
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/pdf417.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/qr-bottom-left.jpg b/testing/web-platform/tests/shape-detection/resources/qr-bottom-left.jpg
new file mode 100644
index 0000000000..754bdedaf1
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/qr-bottom-left.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/qr-bottom-right.jpg b/testing/web-platform/tests/shape-detection/resources/qr-bottom-right.jpg
new file mode 100644
index 0000000000..483297100d
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/qr-bottom-right.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/qr-center.jpg b/testing/web-platform/tests/shape-detection/resources/qr-center.jpg
new file mode 100644
index 0000000000..ca8e770bf4
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/qr-center.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/qr-h.jpg b/testing/web-platform/tests/shape-detection/resources/qr-h.jpg
new file mode 100644
index 0000000000..a1beb02101
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/qr-h.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/qr-l.jpg b/testing/web-platform/tests/shape-detection/resources/qr-l.jpg
new file mode 100644
index 0000000000..a29c358393
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/qr-l.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/qr-m.jpg b/testing/web-platform/tests/shape-detection/resources/qr-m.jpg
new file mode 100644
index 0000000000..ca8e770bf4
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/qr-m.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/qr-q.jpg b/testing/web-platform/tests/shape-detection/resources/qr-q.jpg
new file mode 100644
index 0000000000..45313c71b0
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/qr-q.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/qr-top-left.jpg b/testing/web-platform/tests/shape-detection/resources/qr-top-left.jpg
new file mode 100644
index 0000000000..f3092933e4
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/qr-top-left.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/qr-top-right.jpg b/testing/web-platform/tests/shape-detection/resources/qr-top-right.jpg
new file mode 100644
index 0000000000..875ee8035c
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/qr-top-right.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/shapedetection-helpers.js b/testing/web-platform/tests/shape-detection/resources/shapedetection-helpers.js
new file mode 100644
index 0000000000..1b4949b8f6
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/shapedetection-helpers.js
@@ -0,0 +1,75 @@
+'use strict';
+
+// These tests rely on the User Agent providing an implementation of
+// platform shape detection backends.
+//
+// In Chromium-based browsers this implementation is provided by a polyfill
+// in order to reduce the amount of test-only code shipped to users. To enable
+// these tests the browser must be run with these options:
+//
+// --enable-blink-features=MojoJS,MojoJSTest
+
+async function loadChromiumResources() {
+ await import('/resources/chromium/mock-barcodedetection.js');
+ await import('/resources/chromium/mock-facedetection.js');
+ await import('/resources/chromium/mock-textdetection.js');
+}
+
+/**
+ * @param {String} detectionTestName
+ * name of mock shape detection test interface,
+ * must be the item of ["FaceDetectionTest", "BarcodeDetectionTest",
+ * "TextDetectionTest"]
+*/
+async function initialize_detection_tests(detectionTestName) {
+ let detectionTest;
+ if (typeof document === 'undefined') {
+ // Use 'self' for workers.
+ if (typeof self[detectionTestName] === 'undefined') {
+ // test-only-api.js is already loaded in worker.js
+ if (isChromiumBased) {
+ await loadChromiumResources();
+ }
+ }
+ detectionTest = new self[detectionTestName]();
+ } else {
+ if (typeof window[detectionTestName] === 'undefined') {
+ const script = document.createElement('script');
+ script.src = '/resources/test-only-api.js';
+ script.async = false;
+ const p = new Promise((resolve, reject) => {
+ script.onload = () => { resolve(); };
+ script.onerror = e => { reject(e); };
+ })
+ document.head.appendChild(script);
+ await p;
+
+ if (isChromiumBased) {
+ await loadChromiumResources();
+ }
+
+ }
+ detectionTest = new window[detectionTestName]();
+ }
+ await detectionTest.initialize();
+ return detectionTest;
+}
+
+function detection_test(detectionTestName, func, name, properties) {
+ promise_test(async t => {
+ let detectionTest = await initialize_detection_tests(detectionTestName);
+ try {
+ await func(t, detectionTest);
+ } finally {
+ await detectionTest.reset();
+ };
+ }, name, properties);
+}
+
+function getArrayBufferFromBigBuffer(bigBuffer) {
+ if (bigBuffer.bytes !== undefined) {
+ return new Uint8Array(bigBuffer.bytes).buffer;
+ }
+ return bigBuffer.sharedMemory.bufferHandle.mapBuffer(0,
+ bigBuffer.sharedMemory.size).buffer;
+}
diff --git a/testing/web-platform/tests/shape-detection/resources/single-detection-helpers.js b/testing/web-platform/tests/shape-detection/resources/single-detection-helpers.js
new file mode 100644
index 0000000000..bbd2bda96b
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/single-detection-helpers.js
@@ -0,0 +1,66 @@
+function imageLoadedPromise(image) {
+ return new Promise(function(resolve, reject) {
+ if (image.complete)
+ resolve();
+ image.addEventListener("load", resolve, { once: true });
+ });
+}
+
+function videoLoadedPromise(video) {
+ return new Promise(function(resolve, reject) {
+ if (video.readyState == 4)
+ resolve();
+ else {
+ video.addEventListener("loadeddata", resolve, { once: true });
+ video.addEventListener("error", reject, { once: true });
+ }
+ });
+}
+
+function waitForNFrames(count) {
+ if (count <= 0)
+ return Promise.reject(new TypeError("count should be greater than 0!"));
+
+ return new Promise(resolve => {
+ function tick() {
+ (--count) ? requestAnimationFrame(tick) : resolve();
+ }
+ requestAnimationFrame(tick);
+ });
+}
+
+function seekTo(video, time) {
+ return new Promise(function(resolve, reject) {
+ video.addEventListener("seeked", async function() {
+ /* Work around flakiness in video players... */
+ await waitForNFrames(3);
+ resolve();
+ }, { once: true });
+ video.currentTime = time;
+ });
+}
+
+function checkBoundingBox(actual, expected, fuzziness) {
+ assert_equals(actual.constructor.name, "DOMRectReadOnly");
+ assert_approx_equals(actual.left, expected.left, fuzziness);
+ assert_approx_equals(actual.right, expected.right, fuzziness);
+ assert_approx_equals(actual.top, expected.top, fuzziness);
+ assert_approx_equals(actual.bottom, expected.bottom, fuzziness);
+}
+
+function checkPointsLieWithinBoundingBox(points, boundingBox) {
+ for (point of points) {
+ assert_between_inclusive(point.x, boundingBox.left, boundingBox.right);
+ assert_between_inclusive(point.y, boundingBox.top, boundingBox.bottom);
+ }
+}
+
+function checkPointIsNear(actual, expected, fuzzinessX, fuzzinessY) {
+ assert_approx_equals(actual.x, expected.x, fuzzinessX);
+ assert_approx_equals(actual.y, expected.y, fuzzinessY);
+}
+
+function checkPointsAreNear(actual, expected, fuzzinessX, fuzzinessY) {
+ for (point of actual)
+ checkPointIsNear(point, expected, fuzzinessX, fuzzinessY);
+}
diff --git a/testing/web-platform/tests/shape-detection/resources/text-bottom-left.jpg b/testing/web-platform/tests/shape-detection/resources/text-bottom-left.jpg
new file mode 100644
index 0000000000..12a0641fd3
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/text-bottom-left.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/text-bottom-right.jpg b/testing/web-platform/tests/shape-detection/resources/text-bottom-right.jpg
new file mode 100644
index 0000000000..7ad8b71b6c
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/text-bottom-right.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/text-center.jpg b/testing/web-platform/tests/shape-detection/resources/text-center.jpg
new file mode 100644
index 0000000000..69e8ce446c
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/text-center.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/text-top-left.jpg b/testing/web-platform/tests/shape-detection/resources/text-top-left.jpg
new file mode 100644
index 0000000000..53ca0e0aaf
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/text-top-left.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/text-top-right.jpg b/testing/web-platform/tests/shape-detection/resources/text-top-right.jpg
new file mode 100644
index 0000000000..76a22a677c
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/text-top-right.jpg
Binary files differ
diff --git a/testing/web-platform/tests/shape-detection/resources/text.mov b/testing/web-platform/tests/shape-detection/resources/text.mov
new file mode 100644
index 0000000000..d50197b326
--- /dev/null
+++ b/testing/web-platform/tests/shape-detection/resources/text.mov
Binary files differ