Skip to content

Commit f1db17e

Browse files
authored
[NFC] Cleanup video test (#4585)
* Inline visibleRect width and height access * Assert visibleRect is non-null
1 parent d7f88a1 commit f1db17e

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

src/webgpu/web_platform/external_texture/video.spec.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,7 @@ parameters are present.
406406
// quadrant. In this test we crop the video to each quadrant and check that desired color
407407
// is sampled from each corner of the cropped image.
408408
// visible rect clip applies on raw decoded frame, which defines based on video frame visible size.
409-
const visibleRect = source.visibleRect ?? new DOMRectReadOnly();
410-
const srcVideoHeight = visibleRect.height;
411-
const srcVideoWidth = visibleRect.width;
409+
const visibleRect = source.visibleRect!;
412410

413411
const srcColorSpace = kVideoInfo[videoName].colorSpace;
414412
const presentColors = kVideoExpectedColors[srcColorSpace][dstColorSpace];
@@ -423,38 +421,38 @@ parameters are present.
423421
subRect: {
424422
x: visibleRect.x,
425423
y: visibleRect.y,
426-
width: srcVideoWidth / 2,
427-
height: srcVideoHeight / 2,
424+
width: visibleRect.width / 2,
425+
height: visibleRect.height / 2,
428426
},
429427
color: convertToUnorm8(presentColors[expect.topLeftColor]),
430428
},
431429
// Top right
432430
{
433431
subRect: {
434-
x: visibleRect.x + srcVideoWidth / 2,
432+
x: visibleRect.x + visibleRect.width / 2,
435433
y: visibleRect.y,
436-
width: srcVideoWidth / 2,
437-
height: srcVideoHeight / 2,
434+
width: visibleRect.width / 2,
435+
height: visibleRect.height / 2,
438436
},
439437
color: convertToUnorm8(presentColors[expect.topRightColor]),
440438
},
441439
// Bottom left
442440
{
443441
subRect: {
444442
x: visibleRect.x,
445-
y: visibleRect.y + srcVideoHeight / 2,
446-
width: srcVideoWidth / 2,
447-
height: srcVideoHeight / 2,
443+
y: visibleRect.y + visibleRect.height / 2,
444+
width: visibleRect.width / 2,
445+
height: visibleRect.height / 2,
448446
},
449447
color: convertToUnorm8(presentColors[expect.bottomLeftColor]),
450448
},
451449
// Bottom right
452450
{
453451
subRect: {
454-
x: visibleRect.x + srcVideoWidth / 2,
455-
y: visibleRect.y + srcVideoHeight / 2,
456-
width: srcVideoWidth / 2,
457-
height: srcVideoHeight / 2,
452+
x: visibleRect.x + visibleRect.width / 2,
453+
y: visibleRect.y + visibleRect.height / 2,
454+
width: visibleRect.width / 2,
455+
height: visibleRect.height / 2,
458456
},
459457
color: convertToUnorm8(presentColors[expect.bottomRightColor]),
460458
},

0 commit comments

Comments
 (0)