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

2d.gradient.colormix

+

color-mix works as CanvasGradient color input

+ + +

Actual output:

+

FAIL (fallback content)

+ + + + diff --git a/html/canvas/tools/yaml-new/fill-and-stroke-styles.yaml b/html/canvas/tools/yaml-new/fill-and-stroke-styles.yaml index e0e1dc3b07c8cb..10d7295035e57c 100644 --- a/html/canvas/tools/yaml-new/fill-and-stroke-styles.yaml +++ b/html/canvas/tools/yaml-new/fill-and-stroke-styles.yaml @@ -2108,3 +2108,16 @@ @assert ctx.strokeStyle === 'color(srgb 0.5 0 0.5)'; ctx.strokeStyle = "color-mix(in srgb, red, color(srgb 1 0 0))"; @assert ctx.strokeStyle === 'color(srgb 1 0 0)'; + +- name: 2d.gradient.colormix + desc: color-mix works as CanvasGradient color input + canvasType: ['HtmlCanvas'] + code: | + var g = ctx.createLinearGradient(0, 0, 100, 0); + g.addColorStop(0, '#f00'); + g.addColorStop(1, 'color-mix(in srgb, #0f0, #00f)'); + ctx.fillStyle = g; + ctx.fillRect(0, 0, 100, 50); + @assert pixel 25,25 ==~ 212,81,61,255 +/- 3; + @assert pixel 50,25 ==~ 167,106,88,255 +/- 3; + @assert pixel 75,25 ==~ 113,120,109,255 +/- 3;