Title: [274859] trunk/LayoutTests/imported/w3c
Revision
274859
Author
[email protected]
Date
2021-03-23 03:54:36 -0700 (Tue, 23 Mar 2021)

Log Message

Import WPT html/canvas/offscreen/manual/draw-generic-family tests
https://bugs.webkit.org/show_bug.cgi?id=223630

Reviewed by Youenn Fablet.

* web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family-expected.txt: Added.
* web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.html: Added.
* web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w-expected.txt: Added.
* web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w.html: Added.
* web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/w3c-import.log: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (274858 => 274859)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-03-23 10:35:00 UTC (rev 274858)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-03-23 10:54:36 UTC (rev 274859)
@@ -1,3 +1,16 @@
+2021-03-23  Chris Lord  <[email protected]>
+
+        Import WPT html/canvas/offscreen/manual/draw-generic-family tests
+        https://bugs.webkit.org/show_bug.cgi?id=223630
+
+        Reviewed by Youenn Fablet.
+
+        * web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family-expected.txt: Added.
+        * web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.html: Added.
+        * web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w-expected.txt: Added.
+        * web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w.html: Added.
+        * web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/w3c-import.log: Added.
+
 2021-03-22  Rob Buis  <[email protected]>
 
         Enable ability to prevent scrolling in Element.focus()

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family-expected.txt (0 => 274859)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family-expected.txt	2021-03-23 10:54:36 UTC (rev 274859)
@@ -0,0 +1,7 @@
+
+PASS Test that drawing sans-serif produces the same result between canvas and OffscreenCanvas
+PASS Test that drawing serif produces the same result between canvas and OffscreenCanvas
+PASS Test that drawing cursive produces the same result between canvas and OffscreenCanvas
+PASS Test that drawing fantasy produces the same result between canvas and OffscreenCanvas
+PASS Test that drawing monospace produces the same result between canvas and OffscreenCanvas
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.html (0 => 274859)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.html	2021-03-23 10:54:36 UTC (rev 274859)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<title>OffscreenCanvas test: 2d.text.draw.generic.family</title>
+<script src=""
+<script src=""
+<script src=""
+<script>
+function drawCanvas(ctx, family)
+{
+    ctx.font = '16px ' + family;
+    ctx.fillText(family, 0, 16);
+}
+
+function testDrawGenericFamily(family)
+{
+    let offscreenCanvas = new OffscreenCanvas(88, 24);
+    let oCtx = offscreenCanvas.getContext('2d');
+    drawCanvas(oCtx, family);
+    let canvas = document.createElement('canvas');
+    let ctx = canvas.getContext('2d');
+    drawCanvas(ctx, family);
+
+    let data1 = oCtx.getImageData(0, 0, 88, 24).data;
+    let data2 = ctx.getImageData(0, 0, 88, 24).data;
+    assert_array_equals(data1, data2,
+      "The image data generated by drawing generic font family '" + family +
+      "' should be the same for both OffscreenCanvas and regular canvas");
+}
+
+test(function() {
+    testDrawGenericFamily('sans-serif');
+}, "Test that drawing sans-serif produces the same result between canvas and OffscreenCanvas");
+
+test(function() {
+    testDrawGenericFamily('serif');
+}, "Test that drawing serif produces the same result between canvas and OffscreenCanvas");
+
+test(function() {
+    testDrawGenericFamily('cursive');
+}, "Test that drawing cursive produces the same result between canvas and OffscreenCanvas");
+
+test(function() {
+    testDrawGenericFamily('fantasy');
+}, "Test that drawing fantasy produces the same result between canvas and OffscreenCanvas");
+
+test(function() {
+    testDrawGenericFamily('monospace');
+}, "Test that drawing monospace produces the same result between canvas and OffscreenCanvas");
+</script>
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w-expected.txt (0 => 274859)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w-expected.txt	2021-03-23 10:54:36 UTC (rev 274859)
@@ -0,0 +1,22 @@
+CONSOLE MESSAGE: Error: assert_array_equals: The image data generated by drawing generic font family 'sans-serif' should be the same for both OffscreenCanvas and regular canvas expected property 11 to be 0 but got 75 (expected array object "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" got object "0,0,0,0,0,0,0,0,0,0,75,0,0,0,248,0,0,0,255,0")
+CONSOLE MESSAGE: Error: assert_array_equals: The image data generated by drawing generic font family 'serif' should be the same for both OffscreenCanvas and regular canvas expected property 23 to be 0 but got 7 (expected array object "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" got object "0,0,0,0,0,0,0,0,0,0,7,0,0,0,14,0,0,0,1,0")
+CONSOLE MESSAGE: Error: assert_array_equals: The image data generated by drawing generic font family 'cursive' should be the same for both OffscreenCanvas and regular canvas expected property 31 to be 0 but got 5 (expected array object "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" got object "0,0,0,0,0,0,0,0,0,0,5,0,0,0,15,0,0,0,3,0")
+CONSOLE MESSAGE: Error: assert_array_equals: The image data generated by drawing generic font family 'fantasy' should be the same for both OffscreenCanvas and regular canvas expected property 15 to be 0 but got 123 (expected array object "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" got object "0,0,0,0,0,0,0,0,0,0,123,0,0,0,255,0,0,0,255,0")
+CONSOLE MESSAGE: Error: assert_array_equals: The image data generated by drawing generic font family 'monospace' should be the same for both OffscreenCanvas and regular canvas expected property 7 to be 0 but got 97 (expected array object "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" got object "0,0,0,0,0,0,0,97,0,0,0,255,0,0,0,240,0,0,0,98")
+
+Harness Error (FAIL), message = Error: assert_array_equals: The image data generated by drawing generic font family 'monospace' should be the same for both OffscreenCanvas and regular canvas expected property 7 to be 0 but got 97 (expected array object "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" got object "0,0,0,0,0,0,0,97,0,0,0,255,0,0,0,240,0,0,0,98")
+
+TIMEOUT Test that drawing sans-serif produces the same result between canvas and OffscreenCanvas in a Worker Test timed out
+TIMEOUT Test that drawing serif produces the same result between canvas and OffscreenCanvas in a Worker Test timed out
+TIMEOUT Test that drawing cursive produces the same result between canvas and OffscreenCanvas in a Worker Test timed out
+TIMEOUT Test that drawing fantasy produces the same result between canvas and OffscreenCanvas in a Worker Test timed out
+TIMEOUT Test that drawing monospace produces the same result between canvas and OffscreenCanvas in a Worker Test timed out
+
+Harness Error (FAIL), message = Error: assert_array_equals: The image data generated by drawing generic font family 'monospace' should be the same for both OffscreenCanvas and regular canvas expected property 7 to be 0 but got 97 (expected array object "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" got object "0,0,0,0,0,0,0,97,0,0,0,255,0,0,0,240,0,0,0,98")
+
+TIMEOUT Test that drawing sans-serif produces the same result between canvas and OffscreenCanvas in a Worker Test timed out
+TIMEOUT Test that drawing serif produces the same result between canvas and OffscreenCanvas in a Worker Test timed out
+TIMEOUT Test that drawing cursive produces the same result between canvas and OffscreenCanvas in a Worker Test timed out
+TIMEOUT Test that drawing fantasy produces the same result between canvas and OffscreenCanvas in a Worker Test timed out
+TIMEOUT Test that drawing monospace produces the same result between canvas and OffscreenCanvas in a Worker Test timed out
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w.html (0 => 274859)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w.html	2021-03-23 10:54:36 UTC (rev 274859)
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<title>OffscreenCanvas test: 2d.text.draw.generic.family.w</title>
+<script src=""
+<script src=""
+<script src=""
+<script id='myWorker' type='text/worker'>
+self._onmessage_ = function(e) {
+    let oc = new OffscreenCanvas(88, 24);
+    let ctx = oc.getContext('2d');
+    ctx.font = '32px ' + e.data.family;
+    ctx.fillText(e.data.family, 0, 16);
+    self.postMessage(ctx.getImageData(0, 0, 88, 24).data);
+};
+</script>
+<script>
+function testDrawGenericFamily(t, family)
+{
+    let blob = new Blob([document.getElementById('myWorker').textContent]);
+    let worker = new Worker(URL.createObjectURL(blob));
+    worker.addEventListener('message', msg => {
+        let ctx = document.createElement('canvas').getContext('2d');
+        ctx.font = '32px ' + family;
+        ctx.fillText(family, 0, 16);
+        assert_array_equals(ctx.getImageData(0, 0, 88, 24).data, msg.data,
+          "The image data generated by drawing generic font family '" + family +
+          "' should be the same for both OffscreenCanvas and regular canvas");
+      t.done();
+    });
+    worker.postMessage({family: family});
+}
+
+async_test(function(t) {
+    testDrawGenericFamily(t, 'sans-serif');
+}, "Test that drawing sans-serif produces the same result between canvas and OffscreenCanvas in a Worker");
+
+async_test(function(t) {
+    testDrawGenericFamily(t, 'serif');
+}, "Test that drawing serif produces the same result between canvas and OffscreenCanvas in a Worker");
+
+async_test(function(t) {
+    testDrawGenericFamily(t, 'cursive');
+}, "Test that drawing cursive produces the same result between canvas and OffscreenCanvas in a Worker");
+
+async_test(function(t) {
+    testDrawGenericFamily(t, 'fantasy');
+}, "Test that drawing fantasy produces the same result between canvas and OffscreenCanvas in a Worker");
+
+async_test(function(t) {
+    testDrawGenericFamily(t, 'monospace');
+}, "Test that drawing monospace produces the same result between canvas and OffscreenCanvas in a Worker");
+</script>
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/w3c-import.log (0 => 274859)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/w3c-import.log	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/w3c-import.log	2021-03-23 10:54:36 UTC (rev 274859)
@@ -0,0 +1,18 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+	https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.html
+/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/manual/draw-generic-family/2d.text.draw.generic.family.w.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to