Skip to content

Commit da9eec8

Browse files
Fixes test expected to fail for wasm (texture_bounds.rs)
1 parent f4a4e1d commit da9eec8

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

wgpu/tests/texture_bounds.rs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
//! Tests for texture copy bounds checks.
22
3-
use crate::common::{initialize_test, TestParameters};
3+
use crate::common::{fail_if, initialize_test, TestParameters};
44
use std::num::NonZeroU32;
5+
use wasm_bindgen_test::*;
56

67
#[test]
8+
#[wasm_bindgen_test]
79
fn bad_copy_origin() {
810
fn try_origin(origin: wgpu::Origin3d, size: wgpu::Extent3d, should_panic: bool) {
9-
let mut parameters = TestParameters::default();
10-
if should_panic {
11-
parameters = parameters.failure();
12-
}
11+
let parameters = TestParameters::default();
1312

1413
initialize_test(parameters, |ctx| {
1514
let texture = ctx.device.create_texture(&TEXTURE_DESCRIPTOR);
1615
let data = vec![255; BUFFER_SIZE as usize];
17-
ctx.queue.write_texture(
18-
wgpu::ImageCopyTexture {
19-
texture: &texture,
20-
mip_level: 0,
21-
origin,
22-
aspect: wgpu::TextureAspect::All,
23-
},
24-
&data,
25-
BUFFER_COPY_LAYOUT,
26-
size,
27-
);
16+
17+
fail_if(&ctx.device, should_panic, || {
18+
ctx.queue.write_texture(
19+
wgpu::ImageCopyTexture {
20+
texture: &texture,
21+
mip_level: 0,
22+
origin,
23+
aspect: wgpu::TextureAspect::All,
24+
},
25+
&data,
26+
BUFFER_COPY_LAYOUT,
27+
size,
28+
)
29+
});
2830
});
2931
}
3032

0 commit comments

Comments
 (0)