diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/runner.py | 12 | ||||
-rw-r--r-- | tests/sdl_canvas.c | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index 7fc2f284..62e1b7e1 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -8323,6 +8323,18 @@ fscanfed: 10 - hello Popen(['python', FILE_PACKAGER, 'test.data', '--pre-run', '--crunch=32', '--preload', 'ship.dds'], stdout=open('pre.js', 'w')).communicate() assert crunch_time < os.stat('ship.crn').st_mtime, 'Crunch was changed' + def test_headless(self): + shutil.copyfile(path_from_root('tests', 'screenshot.png'), os.path.join(self.get_dir(), 'example.png')) + Popen(['python', EMCC, path_from_root('tests', 'sdl_canvas.c'), '-s', 'HEADLESS=1']).communicate() + output = run_js('a.out.js', engine=SPIDERMONKEY_ENGINE, stderr=PIPE) + assert '''Init: 0 +Font: 0x1 +Sum: 0 +you should see two lines of text in different colors and a blue rectangle +SDL_Quit called (and ignored) +done. +''' in output, output + elif 'browser' in str(sys.argv): # Browser tests. diff --git a/tests/sdl_canvas.c b/tests/sdl_canvas.c index 5d1c849c..7dcfa043 100644 --- a/tests/sdl_canvas.c +++ b/tests/sdl_canvas.c @@ -53,6 +53,8 @@ int main(int argc, char **argv) { SDL_Quit(); + printf("done.\n"); + int result = sum > 3000 && sum < 5000; // varies a little on different browsers, font differences? REPORT_RESULT(); |