Skip to content

Commit ba48453

Browse files
yiyixchromium-wpt-export-bot
authored andcommitted
Unify tests in drawing-rectangles-to-the-canvas
Tests in category drawing-rectangles-to-the-canvas for HTMLCanvas and Offscreencanvas are almost identical. Add tests to the unified folder. Changes in the output of HTMLCanvas are due to the different spacing in tests templates. Bug: 1275750 Change-Id: Icb9c7865fabd8a41199fdd45f4258ab1f1b5d892 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3393029 Reviewed-by: Juanmi Huertas Commit-Queue: Yi Xu Cr-Commit-Position: refs/heads/main@{#960170}
1 parent 94b2b12 commit ba48453

File tree

8 files changed

+8
-475
lines changed

8 files changed

+8
-475
lines changed

html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.clip.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,12 @@

2d.clearRect.clip

2121

2222
ctx.fillStyle = '#0f0';
2323
ctx.fillRect(0, 0, 100, 50);
24-
2524
ctx.beginPath();
2625
ctx.rect(0, 0, 16, 16);
2726
ctx.clip();
28-
2927
ctx.clearRect(0, 0, 100, 50);
30-
3128
ctx.fillStyle = '#0f0';
3229
ctx.fillRect(0, 0, 16, 16);
33-
3430
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
3531

3632

html/canvas/element/drawing-rectangles-to-the-canvas/2d.clearRect.nonfinite.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@

2d.clearRect.nonfinite

2121

2222
ctx.fillStyle = '#0f0';
2323
ctx.fillRect(0, 0, 100, 50);
24-
2524
ctx.clearRect(Infinity, 0, 100, 50);
2625
ctx.clearRect(-Infinity, 0, 100, 50);
2726
ctx.clearRect(NaN, 0, 100, 50);
@@ -45,7 +44,6 @@

2d.clearRect.nonfinite

4544
ctx.clearRect(0, Infinity, Infinity, Infinity);
4645
ctx.clearRect(0, Infinity, 100, Infinity);
4746
ctx.clearRect(0, 0, Infinity, Infinity);
48-
4947
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
5048

5149

html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.clip.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,13 @@

2d.fillRect.clip

2121

2222
ctx.fillStyle = '#0f0';
2323
ctx.fillRect(0, 0, 100, 50);
24-
2524
ctx.beginPath();
2625
ctx.rect(0, 0, 16, 16);
2726
ctx.clip();
28-
2927
ctx.fillStyle = '#f00';
3028
ctx.fillRect(0, 0, 100, 50);
31-
3229
ctx.fillStyle = '#0f0';
3330
ctx.fillRect(0, 0, 16, 16);
34-
3531
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
3632

3733

html/canvas/element/drawing-rectangles-to-the-canvas/2d.fillRect.nonfinite.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@

2d.fillRect.nonfinite

2121

2222
ctx.fillStyle = '#0f0';
2323
ctx.fillRect(0, 0, 100, 50);
24-
2524
ctx.fillStyle = '#f00';
2625
ctx.fillRect(Infinity, 0, 100, 50);
2726
ctx.fillRect(-Infinity, 0, 100, 50);
@@ -46,7 +45,6 @@

2d.fillRect.nonfinite

4645
ctx.fillRect(0, Infinity, Infinity, Infinity);
4746
ctx.fillRect(0, Infinity, 100, Infinity);
4847
ctx.fillRect(0, 0, Infinity, Infinity);
49-
5048
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
5149

5250

html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.clip.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,14 @@

2d.strokeRect.clip

2121

2222
ctx.fillStyle = '#0f0';
2323
ctx.fillRect(0, 0, 100, 50);
24-
2524
ctx.beginPath();
2625
ctx.rect(0, 0, 16, 16);
2726
ctx.clip();
28-
2927
ctx.strokeStyle = '#f00';
3028
ctx.lineWidth = 50;
3129
ctx.strokeRect(0, 0, 100, 50);
32-
3330
ctx.fillStyle = '#0f0';
3431
ctx.fillRect(0, 0, 16, 16);
35-
3632
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
3733

3834

html/canvas/element/drawing-rectangles-to-the-canvas/2d.strokeRect.nonfinite.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@

2d.strokeRect.nonfinite

2121

2222
ctx.fillStyle = '#0f0';
2323
ctx.fillRect(0, 0, 100, 50);
24-
2524
ctx.strokeStyle = '#f00';
2625
ctx.lineWidth = 150;
2726
ctx.strokeRect(Infinity, 0, 100, 50);
@@ -47,7 +46,6 @@

2d.strokeRect.nonfinite

4746
ctx.strokeRect(0, Infinity, Infinity, Infinity);
4847
ctx.strokeRect(0, Infinity, 100, Infinity);
4948
ctx.strokeRect(0, 0, Infinity, Infinity);
50-
5149
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
5250

5351

html/canvas/tools/yaml/element/drawing-rectangles-to-the-canvas.yaml renamed to html/canvas/tools/yaml-new/drawing-rectangles-to-the-canvas.yaml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,12 @@
9696
code: |
9797
ctx.fillStyle = '#0f0';
9898
ctx.fillRect(0, 0, 100, 50);
99-
10099
ctx.beginPath();
101100
ctx.rect(0, 0, 16, 16);
102101
ctx.clip();
103-
104102
ctx.clearRect(0, 0, 100, 50);
105-
106103
ctx.fillStyle = '#0f0';
107104
ctx.fillRect(0, 0, 16, 16);
108-
109105
@assert pixel 50,25 == 0,255,0,255;
110106
expected: green
111107

@@ -131,9 +127,7 @@
131127
code: |
132128
ctx.fillStyle = '#0f0';
133129
ctx.fillRect(0, 0, 100, 50);
134-
135130
@nonfinite ctx.clearRect(<0 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <100 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>);
136-
137131
@assert pixel 50,25 == 0,255,0,255;
138132
expected: green
139133

@@ -215,17 +209,13 @@
215209
code: |
216210
ctx.fillStyle = '#0f0';
217211
ctx.fillRect(0, 0, 100, 50);
218-
219212
ctx.beginPath();
220213
ctx.rect(0, 0, 16, 16);
221214
ctx.clip();
222-
223215
ctx.fillStyle = '#f00';
224216
ctx.fillRect(0, 0, 100, 50);
225-
226217
ctx.fillStyle = '#0f0';
227218
ctx.fillRect(0, 0, 16, 16);
228-
229219
@assert pixel 50,25 == 0,255,0,255;
230220
expected: green
231221

@@ -251,10 +241,8 @@
251241
code: |
252242
ctx.fillStyle = '#0f0';
253243
ctx.fillRect(0, 0, 100, 50);
254-
255244
ctx.fillStyle = '#f00';
256245
@nonfinite ctx.fillRect(<0 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <100 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>);
257-
258246
@assert pixel 50,25 == 0,255,0,255;
259247
expected: green
260248

@@ -407,18 +395,14 @@
407395
code: |
408396
ctx.fillStyle = '#0f0';
409397
ctx.fillRect(0, 0, 100, 50);
410-
411398
ctx.beginPath();
412399
ctx.rect(0, 0, 16, 16);
413400
ctx.clip();
414-
415401
ctx.strokeStyle = '#f00';
416402
ctx.lineWidth = 50;
417403
ctx.strokeRect(0, 0, 100, 50);
418-
419404
ctx.fillStyle = '#0f0';
420405
ctx.fillRect(0, 0, 16, 16);
421-
422406
@assert pixel 50,25 == 0,255,0,255;
423407
expected: green
424408

@@ -447,18 +431,18 @@
447431
code: |
448432
ctx.fillStyle = '#0f0';
449433
ctx.fillRect(0, 0, 100, 50);
450-
451434
ctx.strokeStyle = '#f00';
452435
ctx.lineWidth = 150;
453436
@nonfinite ctx.strokeRect(<0 Infinity -Infinity NaN>, <0 Infinity -Infinity NaN>, <100 Infinity -Infinity NaN>, <50 Infinity -Infinity NaN>);
454-
455437
@assert pixel 50,25 == 0,255,0,255;
456438
expected: green
457439

458440
- name: 2d.fillStyle.colorObject
459441
desc: ctx.fillStyle works with color objects
460442
testing:
461443
- 2d.fillRect
444+
canvasType:
445+
['HTMLCanvas']
462446
code: |
463447
ctx.fillStyle = {r: 1, g: 0, b: 0};
464448
ctx.fillRect(0, 0, 100, 50);
@@ -484,6 +468,8 @@
484468
desc: ctx.fillStyle with color objects has transparency
485469
testing:
486470
- 2d.fillRect
471+
canvasType:
472+
['HTMLCanvas']
487473
code: |
488474
ctx.fillStyle = {r: 0, g: 1, b: 0, a: 0};
489475
ctx.fillRect(0, 0, 100, 50);
@@ -506,6 +492,8 @@
506492
desc: ctx.strokeStyle works with color objects
507493
testing:
508494
- 2d.strokeRect
495+
canvasType:
496+
['HTMLCanvas']
509497
code: |
510498
ctx.lineWidth = 50;
511499
ctx.strokeStyle = {r: 1, g: 0, b: 0};
@@ -532,6 +520,8 @@
532520
desc: ctx.strokeStyle with color objects has transparency
533521
testing:
534522
- 2d.strokeRect
523+
canvasType:
524+
['HTMLCanvas']
535525
code: |
536526
ctx.lineWidth = 50;
537527
ctx.strokeStyle = {r: 0, g: 1, b: 0, a: 0};
@@ -551,4 +541,3 @@
551541
expected: green
552542

553543

554-

0 commit comments

Comments
 (0)