From ab266c93548d2cff1d15ac1fe19ee7ee5f466793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaufort?= Date: Fri, 11 Oct 2024 11:44:55 +0200 Subject: [PATCH] Update tests for validating canvas texture formats in configure() (#3997) --- .../web_platform/canvas/configure.spec.ts | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/webgpu/web_platform/canvas/configure.spec.ts b/src/webgpu/web_platform/canvas/configure.spec.ts index 47c13e5eed28..06e590751b33 100644 --- a/src/webgpu/web_platform/canvas/configure.spec.ts +++ b/src/webgpu/web_platform/canvas/configure.spec.ts @@ -173,21 +173,21 @@ g.test('format') } } - t.expectValidationError(() => { + if (validFormat) { ctx.configure({ device: t.device, format, }); - }, !validFormat); - - const configuration = ctx.getConfiguration(); - t.expect(configuration!.format === format); - - t.expectValidationError(() => { - // Should always return a texture, whether the configured format was valid or not. - const currentTexture = ctx.getCurrentTexture(); - t.expect(currentTexture instanceof GPUTexture); - }, !validFormat); + const configuration = ctx.getConfiguration(); + t.expect(configuration!.format === format); + } else { + t.shouldThrow('TypeError', () => { + ctx.configure({ + device: t.device, + format, + }); + }); + } }); g.test('usage')