diff --git a/html/canvas/element/fill-and-stroke-styles/2d.gradient.conic.html b/html/canvas/element/fill-and-stroke-styles/2d.gradient.conic.html new file mode 100644 index 00000000000000..608b6a14db1bf4 --- /dev/null +++ b/html/canvas/element/fill-and-stroke-styles/2d.gradient.conic.html @@ -0,0 +1,36 @@ + + +Canvas test: 2d.gradient.conic + + + + + + +

2d.gradient.conic

+

Conic gradient function exists

+ + +

Actual output:

+

FAIL (fallback content)

+

Expected output:

+

+ + diff --git a/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.html b/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.html new file mode 100644 index 00000000000000..a1a4651ef65bb9 --- /dev/null +++ b/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.html @@ -0,0 +1,36 @@ + + +OffscreenCanvas test: 2d.gradient.conic + + + + +

2d.gradient.conic

+

Conic gradient function exists

+ + + diff --git a/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.worker.js b/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.worker.js new file mode 100644 index 00000000000000..53a61ad114ddbf --- /dev/null +++ b/html/canvas/offscreen/fill-and-stroke-styles/2d.gradient.conic.worker.js @@ -0,0 +1,32 @@ +// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. +// OffscreenCanvas test in a worker:2d.gradient.conic +// Description:Conic gradient function exists +// Note: + +importScripts("/resources/testharness.js"); +importScripts("/html/canvas/resources/canvas-tests.js"); + +var t = async_test("Conic gradient function exists"); +var t_pass = t.done.bind(t); +var t_fail = t.step_func(function(reason) { + throw reason; +}); +t.step(function() { + +var offscreenCanvas = new OffscreenCanvas(100, 50); +var ctx = offscreenCanvas.getContext('2d'); + +const g = ctx.createConicGradient(0, 0, 25); +g.addColorStop(0, "#0f0"); +g.addColorStop(0.5, "#0f0"); +g.addColorStop(0.5, "#f00"); +g.addColorStop(1, "#f00"); +ctx.fillStyle = g; +ctx.fillRect(0, 0, 100, 50); +_assertPixel(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255"); +_assertPixel(offscreenCanvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255"); +t.done(); + +}); +done(); diff --git a/html/canvas/tools/yaml/element/fill-and-stroke-styles.yaml b/html/canvas/tools/yaml/element/fill-and-stroke-styles.yaml index d05ae0911bd8f9..50d28085f4c498 100644 --- a/html/canvas/tools/yaml/element/fill-and-stroke-styles.yaml +++ b/html/canvas/tools/yaml/element/fill-and-stroke-styles.yaml @@ -1174,10 +1174,20 @@ @assert pixel 75,25 == 0,255,0,255; expected: green - - - - +- name: 2d.gradient.conic + desc: Conic gradient function exists + code: | + const g = ctx.createConicGradient(0, 0, 25); + g.addColorStop(0, "#0f0"); + g.addColorStop(0.5, "#0f0"); + g.addColorStop(0.51, "#f00"); + g.addColorStop(1, "#f00"); + ctx.fillStyle = g; + ctx.fillRect(0, 0, 100, 50); + @assert pixel 25,25 == 0,255,0,255; + @assert pixel 50,25 == 0,255,0,255; + @assert pixel 75,25 == 0,255,0,255; + expected: green - name: 2d.pattern.basic.type testing: diff --git a/html/canvas/tools/yaml/offscreen/fill-and-stroke-styles.yaml b/html/canvas/tools/yaml/offscreen/fill-and-stroke-styles.yaml index 2554d48d26844a..7be040a13291c0 100644 --- a/html/canvas/tools/yaml/offscreen/fill-and-stroke-styles.yaml +++ b/html/canvas/tools/yaml/offscreen/fill-and-stroke-styles.yaml @@ -928,6 +928,22 @@ @assert pixel 75,25 == 0,255,0,255; t.done(); +- name: 2d.gradient.conic + desc: Conic gradient function exists + code: | + const g = ctx.createConicGradient(0, 0, 25); + g.addColorStop(0, "#0f0"); + g.addColorStop(0.5, "#0f0"); + g.addColorStop(0.5, "#f00"); + g.addColorStop(1, "#f00"); + ctx.fillStyle = g; + ctx.fillRect(0, 0, 100, 50); + @assert pixel 25,25 == 0,255,0,255; + @assert pixel 50,25 == 0,255,0,255; + @assert pixel 75,25 == 0,255,0,255; + t.done(); + expected: green + - name: 2d.pattern.basic.image testing: - 2d.pattern.painting