Skip to content

Commit

Permalink
fix texture_formats:canvas_configuration test for gpuweb/gpuweb#4911 (#…
Browse files Browse the repository at this point in the history
…3998)

Signed-off-by: sagudev <[email protected]>
Co-authored-by: François Beaufort <[email protected]>
  • Loading branch information
sagudev and beaufortfrancois authored Oct 11, 2024
1 parent ab266c9 commit 8a29164
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Tests for capability checking for features enabling optional texture formats.
import { makeTestGroup } from '../../../../../common/framework/test_group.js';
import { getGPU } from '../../../../../common/util/navigator_gpu.js';
import { assert } from '../../../../../common/util/util.js';
import { kCanvasTextureFormats } from '../../../../capability_info.js';
import { kAllTextureFormats, kTextureFormatInfo } from '../../../../format_info.js';
import { kAllCanvasTypes, createCanvas } from '../../../../util/create_elements.js';
import { ValidationTest } from '../../validation_test.js';
Expand Down Expand Up @@ -161,15 +162,15 @@ g.test('canvas_configuration')
usage: GPUTextureUsage.COPY_SRC | GPUTextureUsage.COPY_DST,
};

if (enable_required_feature) {
t.expectValidationError(() => {
ctx.configure(canvasConf);
});
} else {
t.shouldThrow('TypeError', () => {
ctx.configure(canvasConf);
});
}
const expectedError =
enable_required_feature &&
(kCanvasTextureFormats as unknown as Array<GPUTextureFormat>).includes(format)
? false
: 'TypeError';

t.shouldThrow(expectedError, () => {
ctx.configure(canvasConf);
});
});

g.test('canvas_configuration_view_formats')
Expand Down

0 comments on commit 8a29164

Please sign in to comment.