Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Add custom test for CanvasGradient (#2334)
Browse files Browse the repository at this point in the history
The interface was not exposed early on, at least Safari 4 has the
methods to create gradients, but the interface object isn't exposed.
  • Loading branch information
foolip authored Sep 14, 2022
1 parent 6e52a10 commit 19a6230
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions custom-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,23 @@ api:
return {result: false, message: 'caches is not defined'};
};
var instance = caches;
CanvasGradient:
__base: |-
<%api.CanvasRenderingContext2D:ctx%>
var instance;
if (ctx.createLinearGradient) {
instance = ctx.createLinearGradient(0, 0, 1, 1);
} else if (ctx.createRadialGradient) {
instance = ctx.createRadialGradient(0, 0, 0, 1, 1, 1);
} else {
return {result: false, message: 'Could not create linear or radial gradient'};
}
CanvasPattern:
__resources:
- image-black
__base: |-
<%api.CanvasRenderingContext2D:canvas%>
var instance = canvas.createPattern(document.getElementById('resource-image-black'), 'repeat');
<%api.CanvasRenderingContext2D:ctx%>
var instance = ctx.createPattern(document.getElementById('resource-image-black'), 'repeat');
CanvasRenderingContext2D:
__base: |-
if (!('document' in self)) {
Expand Down Expand Up @@ -2301,8 +2312,8 @@ api:
var instance = new TextEncoder();
TextMetrics:
__base: |-
<%api.CanvasRenderingContext2D:canvas%>
var instance = canvas.measureText('mdn-bcd-collector');
<%api.CanvasRenderingContext2D:ctx%>
var instance = ctx.measureText('mdn-bcd-collector');
TextTrack:
__resources:
- video-blank
Expand Down

0 comments on commit 19a6230

Please sign in to comment.