diff options
Diffstat (limited to 'tests/test_browser.py')
-rw-r--r-- | tests/test_browser.py | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/tests/test_browser.py b/tests/test_browser.py index 42a1c0a0..80f94f2b 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -719,10 +719,11 @@ If manually bisecting: self.clear() self.btest('sdl_canvas.c', expected='1', args=['-s', 'LEGACY_GL_EMULATION=1', '-O2', '-s', 'SAFE_HEAP=1']) - def test_sdl_canvas_proxy(self): - def post(): - html = open('test.html').read() - html = html.replace('</body>', ''' + def post_manual_reftest(self, reference=None): + self.reftest(path_from_root('tests', self.reference if reference is None else reference)) + + html = open('test.html').read() + html = html.replace('</body>', ''' <script> function assert(x, y) { if (!x) throw 'assertion failed ' + y } @@ -738,11 +739,21 @@ window.close = function() { }; </script> </body>''' % open('reftest.js').read()) - open('test.html', 'w').write(html) + open('test.html', 'w').write(html) + def test_sdl_canvas_proxy(self): open('data.txt', 'w').write('datum') + self.btest('sdl_canvas_proxy.c', reference='sdl_canvas_proxy.png', args=['--proxy-to-worker', '--preload-file', 'data.txt'], manual_reference=True, post_build=self.post_manual_reftest) - self.btest('sdl_canvas_proxy.c', reference='sdl_canvas_proxy.png', args=['--proxy-to-worker', '--preload-file', 'data.txt'], manual_reference=True, post_build=post) + def test_glgears_proxy(self): + self.btest('hello_world_gles_proxy.c', reference='gears.png', args=['--proxy-to-worker', '-s', 'GL_TESTING=1'], manual_reference=True, post_build=self.post_manual_reftest) + + def test_glgears_proxy_jstarget(self): + # test .js target with --proxy-worker; emits 2 js files, client and worker + Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_gles_proxy.c'), '-o', 'test.js', '--proxy-to-worker', '-s', 'GL_TESTING=1']).communicate() + open('test.html', 'w').write(open(path_from_root('src', 'shell_minimal.html')).read().replace('{{{ SCRIPT }}}', '<script src="test.js"></script>')) + self.post_manual_reftest('gears.png') + self.run_browser('test.html', None, '/report_result?0') def test_sdl_canvas_alpha(self): self.btest('sdl_canvas_alpha.c', reference='sdl_canvas_alpha.png', reference_slack=9) @@ -1307,7 +1318,9 @@ keydown(100);keyup(100); // trigger the end message='You should see animating gears.') def test_glgears_long(self): - self.btest('hello_world_gles.c', expected=map(str, range(30, 1000)), args=['-DHAVE_BUILTIN_SINCOS', '-DLONGTEST']) + for proxy in [0, 1]: + print 'proxy', proxy + self.btest('hello_world_gles.c', expected=map(str, range(30, 500)), args=['-DHAVE_BUILTIN_SINCOS', '-DLONGTEST'] + (['--proxy-to-worker'] if proxy else [])) def test_glgears_animation(self): es2_suffix = ['', '_full', '_full_944'] @@ -1427,6 +1440,9 @@ keydown(100);keyup(100); // trigger the end def test_sdlglshader(self): self.btest('sdlglshader.c', reference='sdlglshader.png', args=['-O2', '--closure', '1', '-s', 'LEGACY_GL_EMULATION=1']) + def test_sdlglshader2(self): + self.btest('sdlglshader2.c', expected='1', args=['-s', 'LEGACY_GL_EMULATION=1'], also_proxied=True) + def test_gl_glteximage(self): self.btest('gl_teximage.c', '1') @@ -1456,9 +1472,8 @@ keydown(100);keyup(100); // trigger the end def test_gl_vertex_buffer(self): self.btest('gl_vertex_buffer.c', reference='gl_vertex_buffer.png', args=['-s', 'GL_UNSAFE_OPTS=0', '-s', 'LEGACY_GL_EMULATION=1'], reference_slack=1) - # Does not pass due to https://bugzilla.mozilla.org/show_bug.cgi?id=924264 so disabled for now. - # def test_gles2_uniform_arrays(self): - # self.btest('gles2_uniform_arrays.cpp', args=['-s', 'GL_ASSERTIONS=1'], expected=['1']) + def test_gles2_uniform_arrays(self): + self.btest('gles2_uniform_arrays.cpp', args=['-s', 'GL_ASSERTIONS=1'], expected=['1'], also_proxied=True) def test_gles2_conformance(self): self.btest('gles2_conformance.cpp', args=['-s', 'GL_ASSERTIONS=1'], expected=['1']) @@ -1476,7 +1491,7 @@ keydown(100);keyup(100); // trigger the end self.btest('cubegeom_pre3.c', reference='cubegeom_pre2.png', args=['-s', 'LEGACY_GL_EMULATION=1']) def test_cubegeom(self): - self.btest('cubegeom.c', reference='cubegeom.png', args=['-O2', '-g', '-s', 'LEGACY_GL_EMULATION=1']) + self.btest('cubegeom.c', reference='cubegeom.png', args=['-O2', '-g', '-s', 'LEGACY_GL_EMULATION=1'], also_proxied=True) def test_cubegeom_proc(self): open('side.c', 'w').write(r''' @@ -1500,10 +1515,10 @@ void *getBindBuffer() { self.btest('cubegeom_color.c', reference='cubegeom_color.png', args=['-s', 'LEGACY_GL_EMULATION=1']) def test_cubegeom_normal(self): - self.btest('cubegeom_normal.c', reference='cubegeom_normal.png', args=['-s', 'LEGACY_GL_EMULATION=1']) + self.btest('cubegeom_normal.c', reference='cubegeom_normal.png', args=['-s', 'LEGACY_GL_EMULATION=1'], also_proxied=True) def test_cubegeom_normal_dap(self): # draw is given a direct pointer to clientside memory, no element array buffer - self.btest('cubegeom_normal_dap.c', reference='cubegeom_normal.png', args=['-s', 'LEGACY_GL_EMULATION=1']) + self.btest('cubegeom_normal_dap.c', reference='cubegeom_normal.png', args=['-s', 'LEGACY_GL_EMULATION=1'], also_proxied=True) def test_cubegeom_normal_dap_far(self): # indices do nto start from 0 self.btest('cubegeom_normal_dap_far.c', reference='cubegeom_normal.png', args=['-s', 'LEGACY_GL_EMULATION=1']) @@ -1521,7 +1536,7 @@ void *getBindBuffer() { self.btest('cubegeom_mt.c', reference='cubegeom_mt.png', args=['-s', 'LEGACY_GL_EMULATION=1']) # multitexture def test_cubegeom_color2(self): - self.btest('cubegeom_color2.c', reference='cubegeom_color2.png', args=['-s', 'LEGACY_GL_EMULATION=1']) + self.btest('cubegeom_color2.c', reference='cubegeom_color2.png', args=['-s', 'LEGACY_GL_EMULATION=1'], also_proxied=True) def test_cubegeom_texturematrix(self): self.btest('cubegeom_texturematrix.c', reference='cubegeom_texturematrix.png', args=['-s', 'LEGACY_GL_EMULATION=1']) @@ -1539,7 +1554,7 @@ void *getBindBuffer() { self.btest('cubegeom_pre2_vao2.c', reference='cubegeom_pre2_vao2.png', args=['-s', 'LEGACY_GL_EMULATION=1']) def test_cube_explosion(self): - self.btest('cube_explosion.c', reference='cube_explosion.png', args=['-s', 'LEGACY_GL_EMULATION=1']) + self.btest('cube_explosion.c', reference='cube_explosion.png', args=['-s', 'LEGACY_GL_EMULATION=1'], also_proxied=True) def test_glgettexenv(self): self.btest('glgettexenv.c', args=['-s', 'LEGACY_GL_EMULATION=1'], expected=['1']) |