@@ -112,6 +112,17 @@ def metafunc(self, proxied, *args, **kwargs):
112
112
return metafunc
113
113
114
114
115
+ def proxied (f ):
116
+ assert callable (f )
117
+
118
+ @wraps (f )
119
+ def decorated (self , * args , ** kwargs ):
120
+ self .proxied = True
121
+ return f (self , * args , ** kwargs )
122
+
123
+ return decorated
124
+
125
+
115
126
# This is similar to @core.no_wasmfs, but it disable WasmFS and runs the test
116
127
# normally. That is, in core we skip the test if we are in the wasmfs.* mode,
117
128
# while in browser we don't have such modes, so we force the test to run without
@@ -856,9 +867,11 @@ def test_sdl_canvas(self, args):
856
867
857
868
def post_manual_reftest (self ):
858
869
assert os .path .exists ('reftest.js' )
870
+ shutil .copy (test_file ('browser_reporting.js' ), '.' )
859
871
html = read_file ('test.html' )
860
872
html = html .replace ('</body>' , '''
861
- <script src="reftest.js"/>
873
+ <script src="browser_reporting.js"></script>
874
+ <script src="reftest.js"></script>
862
875
<script>
863
876
var windowClose = window.close;
864
877
window.close = () => {
@@ -872,9 +885,10 @@ def post_manual_reftest(self):
872
885
</body>''' )
873
886
create_file ('test.html' , html )
874
887
888
+ @proxied
875
889
def test_sdl_canvas_proxy (self ):
876
890
create_file ('data.txt' , 'datum' )
877
- self .reftest ('test_sdl_canvas_proxy.c' , 'test_sdl_canvas_proxy.png' , args = ['--proxy-to-worker' , '--preload-file' , 'data.txt' , '-lSDL' , '-lGL' ], post_build = self . post_manual_reftest )
891
+ self .reftest ('test_sdl_canvas_proxy.c' , 'test_sdl_canvas_proxy.png' , args = ['--proxy-to-worker' , '--preload-file' , 'data.txt' , '-lSDL' , '-lGL' ])
878
892
879
893
@requires_graphics_hardware
880
894
def test_glgears_proxy_jstarget (self ):
@@ -2934,7 +2948,7 @@ def test_sdl2_glshader(self):
2934
2948
if not self .proxied :
2935
2949
# closure build current fails on proxying
2936
2950
self .emcc_args += ['--closure=1' , '-g1' ]
2937
- self .reftest ('test_sdl2_glshader.c' , 'test_sdl_glshader.png' , args = ['-sUSE_SDL=2' , '-O2' , '- sLEGACY_GL_EMULATION' ])
2951
+ self .reftest ('test_sdl2_glshader.c' , 'test_sdl_glshader.png' , args = ['-sUSE_SDL=2' , '-sLEGACY_GL_EMULATION' ])
2938
2952
2939
2953
@requires_graphics_hardware
2940
2954
def test_sdl2_canvas_blank (self ):
@@ -2986,9 +3000,10 @@ def test_sdl2_image_prepare_data(self):
2986
3000
self .reftest ('test_sdl2_image_prepare_data.c' , 'screenshot.jpg' , args = ['--preload-file' , 'screenshot.not' , '-sUSE_SDL=2' , '-sUSE_SDL_IMAGE=2' ])
2987
3001
2988
3002
@requires_graphics_hardware
3003
+ @proxied
2989
3004
def test_sdl2_canvas_proxy (self ):
2990
3005
create_file ('data.txt' , 'datum' )
2991
- self .reftest ('test_sdl2_canvas_proxy.c' , 'test_sdl2_canvas.png' , args = ['-sUSE_SDL=2' , '--proxy-to-worker' , '--preload-file' , 'data.txt' ], post_build = self . post_manual_reftest )
3006
+ self .reftest ('test_sdl2_canvas_proxy.c' , 'test_sdl2_canvas.png' , args = ['-sUSE_SDL=2' , '--proxy-to-worker' , '--preload-file' , 'data.txt' ])
2992
3007
2993
3008
def test_sdl2_pumpevents (self ):
2994
3009
# key events should be detected using SDL_PumpEvents
@@ -3066,8 +3081,9 @@ def test_sdl2_canvas_write(self):
3066
3081
self .btest_exit ('test_sdl2_canvas_write.c' , args = ['-sUSE_SDL=2' ])
3067
3082
3068
3083
@requires_graphics_hardware
3084
+ @proxied
3069
3085
def test_sdl2_gl_frames_swap (self ):
3070
- self .reftest ('test_sdl2_gl_frames_swap.c' , 'test_sdl2_gl_frames_swap.png' , args = ['--proxy-to-worker' , '-sUSE_SDL=2' ], post_build = self . post_manual_reftest )
3086
+ self .reftest ('test_sdl2_gl_frames_swap.c' , 'test_sdl2_gl_frames_swap.png' , args = ['--proxy-to-worker' , '-sUSE_SDL=2' ])
3071
3087
3072
3088
@requires_graphics_hardware
3073
3089
def test_sdl2_ttf (self ):
0 commit comments