File tree 1 file changed +18
-16
lines changed 1 file changed +18
-16
lines changed Original file line number Diff line number Diff line change 1
1
//! Tests for texture copy bounds checks.
2
2
3
- use crate :: common:: { initialize_test, TestParameters } ;
3
+ use crate :: common:: { fail_if , initialize_test, TestParameters } ;
4
4
use std:: num:: NonZeroU32 ;
5
+ use wasm_bindgen_test:: * ;
5
6
6
7
#[ test]
8
+ #[ wasm_bindgen_test]
7
9
fn bad_copy_origin ( ) {
8
10
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 ( ) ;
13
12
14
13
initialize_test ( parameters, |ctx| {
15
14
let texture = ctx. device . create_texture ( & TEXTURE_DESCRIPTOR ) ;
16
15
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
+ } ) ;
28
30
} ) ;
29
31
}
30
32
You can’t perform that action at this time.
0 commit comments