aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan.akhgari@gmail.com>2013-02-27 20:36:14 -0500
committerEhsan Akhgari <ehsan.akhgari@gmail.com>2013-02-27 20:36:14 -0500
commite1a0116a871bf96243472d79135eb624dc9c82c3 (patch)
tree7f14659e4855acc42e9752a73606efaed27ba382 /tests/runner.py
parent42da4e19f9d72026be6642c8b54f646c6d828dde (diff)
Implement SDL_TEXTINPUT
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-xtests/runner.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 50568762..d1d65d6f 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -10370,6 +10370,28 @@ elif 'browser' in str(sys.argv):
Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'sdl_key.c'), '-o', 'page.html', '--pre-js', 'pre.js', '-s', '''EXPORTED_FUNCTIONS=['_main', '_one']''']).communicate()
self.run_browser('page.html', '', '/report_result?510510')
+ def test_sdl_text(self):
+ open(os.path.join(self.get_dir(), 'pre.js'), 'w').write('''
+ Module.postRun = function() {
+ function doOne() {
+ Module._one();
+ setTimeout(doOne, 1000/60);
+ }
+ setTimeout(doOne, 1000/60);
+ }
+
+ function simulateKeyEvent(charCode) {
+ var event = document.createEvent("KeyboardEvent");
+ event.initKeyEvent("keypress", true, true, window,
+ 0, 0, 0, 0, 0, charCode);
+ document.body.dispatchEvent(event);
+ }
+ ''')
+ open(os.path.join(self.get_dir(), 'sdl_text.c'), 'w').write(self.with_report_result(open(path_from_root('tests', 'sdl_text.c')).read()))
+
+ Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'sdl_text.c'), '-o', 'page.html', '--pre-js', 'pre.js', '-s', '''EXPORTED_FUNCTIONS=['_main', '_one']''']).communicate()
+ self.run_browser('page.html', '', '/report_result?1')
+
def test_sdl_mouse(self):
open(os.path.join(self.get_dir(), 'pre.js'), 'w').write('''
function simulateMouseEvent(x, y, button) {