Skip to content

Commit 30179b5

Browse files
committed
Add test for wgpu_request_animation_frame_loop().
1 parent f1c9140 commit 30179b5

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// flags: -sEXIT_RUNTIME=0
2+
3+
#include "lib_webgpu.h"
4+
#include <assert.h>
5+
6+
int num_calls = 0;
7+
8+
double previous_time;
9+
WGPU_BOOL raf(double time, void *userData)
10+
{
11+
assert(time > previous_time);
12+
previous_time = time;
13+
14+
assert(userData == (void*)42);
15+
if (++num_calls > 100)
16+
{
17+
EM_ASM(window.close());
18+
return WGPU_FALSE;
19+
}
20+
return WGPU_TRUE;
21+
}
22+
23+
int main()
24+
{
25+
wgpu_request_animation_frame_loop(raf, (void*)42);
26+
}

0 commit comments

Comments
 (0)