Skip to content

Commit 6995a4e

Browse files
authored
[test] Unify fake events system. NFC (#22915)
1 parent 26b1978 commit 6995a4e

File tree

7 files changed

+92
-121
lines changed

7 files changed

+92
-121
lines changed

test/browser/fake_events.js

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,59 @@
22
* Helper function used in browser tests to simulate HTML5 events
33
*/
44

5-
function simulateKeyEvent(eventType, keyCode, code, key) {
5+
function simulateKeyEvent(eventType, keyCode, code, key, target) {
66
var props = { keyCode, charCode: keyCode, view: window, bubbles: true, cancelable: true };
77
if (code) props['code'] = code;
88
if (key) props['key'] = key;
99
var event = new KeyboardEvent(eventType, props);
10-
return document.dispatchEvent(event);
10+
if (!target) target = document;
11+
return target.dispatchEvent(event);
1112
}
1213

13-
function simulateKeyDown(keyCode, code = undefined, key = undefined) {
14-
var doDefault = simulateKeyEvent('keydown', keyCode, code, key);
14+
function simulateKeyDown(keyCode, code = undefined, key = undefined, target = undefined) {
15+
var doDefault = simulateKeyEvent('keydown', keyCode, code, key, target);
1516
// As long as not handler called `preventDefault` we also send a keypress
1617
// event.
1718
if (doDefault) {
18-
simulateKeyEvent('keypress', keyCode, code, key);
19+
simulateKeyEvent('keypress', keyCode, code, key, target);
1920
}
2021
}
2122

22-
function simulateKeyUp(keyCode, code = undefined, key = undefined) {
23-
simulateKeyEvent('keyup', keyCode, code, key);
23+
function simulateKeyUp(keyCode, code = undefined, target = undefined) {
24+
simulateKeyEvent('keyup', keyCode, code, target);
2425
}
2526

26-
function simulateMouseEvent(x, y, button, absolute) {
27+
function simulateKeyDownUp(keyCode, code = undefined, target = undefined) {
28+
simulateKeyDown(keyCode, code, target);
29+
simulateKeyUp(keyCode, code, target);
30+
}
31+
32+
function simulateMouseEvent(eventType, x, y, button, absolute) {
2733
if (!absolute) {
2834
x += Module['canvas'].offsetLeft;
2935
y += Module['canvas'].offsetTop;
3036
}
3137
var event = document.createEvent("MouseEvents");
32-
if (button >= 0) {
33-
var event1 = document.createEvent("MouseEvents");
34-
event1.initMouseEvent('mousedown', true, true, window,
35-
1, x, y, x, y,
36-
0, 0, 0, 0,
37-
button, null);
38-
Module['canvas'].dispatchEvent(event1);
39-
var event2 = document.createEvent("MouseEvents");
40-
event2.initMouseEvent('mouseup', true, true, window,
41-
1, x, y, x, y,
42-
0, 0, 0, 0,
43-
button, null);
44-
Module['canvas'].dispatchEvent(event2);
45-
} else {
46-
var event1 = document.createEvent("MouseEvents");
47-
event1.initMouseEvent('mousemove', true, true, window,
48-
1, x, y, x, y,
49-
0, 0, 0, 0,
50-
0, null);
51-
Module['canvas'].dispatchEvent(event1);
52-
}
38+
event.initMouseEvent(eventType, true, true, window,
39+
1, x, y, x, y,
40+
0, 0, 0, 0,
41+
button, null);
42+
Module['canvas'].dispatchEvent(event);
43+
}
44+
45+
function simulateMouseDown(x, y, button, absolute) {
46+
simulateMouseEvent('mousedown', x, y, button, absolute);
47+
}
48+
49+
function simulateMouseUp(x, y, button, absolute) {
50+
simulateMouseEvent('mouseup', x, y, button, absolute);
51+
}
52+
53+
function simulateMouseMove(x, y, absolute) {
54+
simulateMouseEvent('mousemove', x, y, 0, absolute);
55+
}
56+
57+
function simulateMouseClick(x, y, button, absolute) {
58+
simulateMouseDown(x, y, button, absolute);
59+
simulateMouseUp(x, y, button, absolute);
5360
}

test/canvas_focus.c renamed to test/browser/test_canvas_focus.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ bool key_callback(int eventType, const EmscriptenKeyboardEvent *e, void *userDat
2222
int main() {
2323
emscripten_set_keypress_callback("#canvas", 0, 1, key_callback);
2424
EM_ASM({
25-
var event = new KeyboardEvent("keypress", { 'keyCode': 38, 'charCode': 38, 'view': window, 'bubbles': true, 'cancelable': true });
26-
// Focus, then send an event, same as if the user clicked on it for focus.
2725
Module.canvas.focus();
28-
document.activeElement.dispatchEvent(event);
26+
simulateKeyEvent("keypress", 38, undefined, undefined, /*target=*/document.activeElement);
2927
});
3028
emscripten_exit_with_live_runtime();
3129
__builtin_trap();

test/browser/test_glfw_events.c

Lines changed: 36 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -34,51 +34,51 @@ typedef struct {
3434

3535
// Javascript event.button 0 = left, 1 = middle, 2 = right
3636
test_t g_tests[] = {
37-
{ "Module.injectMouseEvent(10.0, 10.0, 'mousedown', 0)", { 1, 10.0, 10.0, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS, -1 } },
38-
{ "Module.injectMouseEvent(10.0, 20.0, 'mouseup', 0)", { 1, 10.0, 20.0, GLFW_MOUSE_BUTTON_LEFT, GLFW_RELEASE, -1 } },
39-
{ "Module.injectMouseEvent(10.0, 30.0, 'mousedown', 1)", { 1, 10.0, 30.0, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_PRESS, -1 } },
40-
{ "Module.injectMouseEvent(10.0, 40.0, 'mouseup', 1)", { 1, 10.0, 40.0, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_RELEASE, -1 } },
41-
{ "Module.injectMouseEvent(10.0, 30.0, 'mousedown', 2)", { 1, 10.0, 30.0, GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS, -1 } },
42-
{ "Module.injectMouseEvent(10.0, 40.0, 'mouseup', 2)", { 1, 10.0, 40.0, GLFW_MOUSE_BUTTON_RIGHT, GLFW_RELEASE, -1 } },
37+
{ "simulateMouseDown(10.0, 10.0, 0)", { 1, 10.0, 10.0, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS, -1 } },
38+
{ "simulateMouseUp (10.0, 20.0, 0)", { 1, 10.0, 20.0, GLFW_MOUSE_BUTTON_LEFT, GLFW_RELEASE, -1 } },
39+
{ "simulateMouseDown(10.0, 30.0, 1)", { 1, 10.0, 30.0, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_PRESS, -1 } },
40+
{ "simulateMouseUp (10.0, 40.0, 1)", { 1, 10.0, 40.0, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_RELEASE, -1 } },
41+
{ "simulateMouseDown(10.0, 30.0, 2)", { 1, 10.0, 30.0, GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS, -1 } },
42+
{ "simulateMouseUp (10.0, 40.0, 2)", { 1, 10.0, 40.0, GLFW_MOUSE_BUTTON_RIGHT, GLFW_RELEASE, -1 } },
4343
//{ "Module.injectMouseEvent(10.0, 50.0, 'mousewheel', 0)", { 10.0, 50.0, -1, -1, -1 } },
4444
//{ "Module.injectMouseEvent(10.0, 60.0, 'mousemove', 0)", { 10.0, 60.0, -1, -1, -1 } }
4545

46-
{ "Module.injectKeyEvent('keydown', 8)", { 0, 0.0, 0.0, GLFW_KEY_BACKSPACE, GLFW_PRESS, -1 } },
47-
{ "Module.injectKeyEvent('keyup', 8)", { 0, 0.0, 0.0, GLFW_KEY_BACKSPACE, GLFW_RELEASE, -1 } },
48-
{ "Module.injectKeyEvent('keydown', 9)", { 0, 0.0, 0.0, GLFW_KEY_TAB, GLFW_PRESS, -1 } },
49-
{ "Module.injectKeyEvent('keyup', 9)", { 0, 0.0, 0.0, GLFW_KEY_TAB, GLFW_RELEASE, -1 } },
50-
{ "Module.injectKeyEvent('keydown', 112)", { 0, 0.0, 0.0, GLFW_KEY_F1, GLFW_PRESS, -1 } },
51-
{ "Module.injectKeyEvent('keyup', 112)", { 0, 0.0, 0.0, GLFW_KEY_F1, GLFW_RELEASE, -1 } },
52-
{ "Module.injectKeyEvent('keydown', 37)", { 0, 0.0, 0.0, GLFW_KEY_LEFT, GLFW_PRESS, -1 } },
53-
{ "Module.injectKeyEvent('keyup', 37)", { 0, 0.0, 0.0, GLFW_KEY_LEFT, GLFW_RELEASE, -1 } },
54-
{ "Module.injectKeyEvent('keydown', 39)", { 0, 0.0, 0.0, GLFW_KEY_RIGHT, GLFW_PRESS, -1 } },
55-
{ "Module.injectKeyEvent('keyup', 39)", { 0, 0.0, 0.0, GLFW_KEY_RIGHT, GLFW_RELEASE, -1 } },
56-
{ "Module.injectKeyEvent('keydown', 38)", { 0, 0.0, 0.0, GLFW_KEY_UP, GLFW_PRESS, -1 } },
57-
{ "Module.injectKeyEvent('keyup', 38)", { 0, 0.0, 0.0, GLFW_KEY_UP, GLFW_RELEASE, -1 } },
58-
{ "Module.injectKeyEvent('keydown', 40)", { 0, 0.0, 0.0, GLFW_KEY_DOWN, GLFW_PRESS, -1 } },
59-
{ "Module.injectKeyEvent('keyup', 40)", { 0, 0.0, 0.0, GLFW_KEY_DOWN, GLFW_RELEASE, -1 } },
46+
{ "simulateKeyDown(8)", { 0, 0.0, 0.0, GLFW_KEY_BACKSPACE, GLFW_PRESS, -1 } },
47+
{ "simulateKeyUp (8)", { 0, 0.0, 0.0, GLFW_KEY_BACKSPACE, GLFW_RELEASE, -1 } },
48+
{ "simulateKeyDown(9)", { 0, 0.0, 0.0, GLFW_KEY_TAB, GLFW_PRESS, -1 } },
49+
{ "simulateKeyUp (9)", { 0, 0.0, 0.0, GLFW_KEY_TAB, GLFW_RELEASE, -1 } },
50+
{ "simulateKeyDown(112)", { 0, 0.0, 0.0, GLFW_KEY_F1, GLFW_PRESS, -1 } },
51+
{ "simulateKeyUp (112)", { 0, 0.0, 0.0, GLFW_KEY_F1, GLFW_RELEASE, -1 } },
52+
{ "simulateKeyDown(37)", { 0, 0.0, 0.0, GLFW_KEY_LEFT, GLFW_PRESS, -1 } },
53+
{ "simulateKeyUp (37)", { 0, 0.0, 0.0, GLFW_KEY_LEFT, GLFW_RELEASE, -1 } },
54+
{ "simulateKeyDown(39)", { 0, 0.0, 0.0, GLFW_KEY_RIGHT, GLFW_PRESS, -1 } },
55+
{ "simulateKeyUp (39)", { 0, 0.0, 0.0, GLFW_KEY_RIGHT, GLFW_RELEASE, -1 } },
56+
{ "simulateKeyDown(38)", { 0, 0.0, 0.0, GLFW_KEY_UP, GLFW_PRESS, -1 } },
57+
{ "simulateKeyUp (38)", { 0, 0.0, 0.0, GLFW_KEY_UP, GLFW_RELEASE, -1 } },
58+
{ "simulateKeyDown(40)", { 0, 0.0, 0.0, GLFW_KEY_DOWN, GLFW_PRESS, -1 } },
59+
{ "simulateKeyUp (40)", { 0, 0.0, 0.0, GLFW_KEY_DOWN, GLFW_RELEASE, -1 } },
6060
#if USE_GLFW == 2
61-
{ "Module.injectKeyEvent('keydown', 27)", { 0, 0.0, 0.0, GLFW_KEY_ESC, GLFW_PRESS, -1 } },
62-
{ "Module.injectKeyEvent('keyup', 27)", { 0, 0.0, 0.0, GLFW_KEY_ESC, GLFW_RELEASE, -1 } },
61+
{ "simulateKeyDown(27)", { 0, 0.0, 0.0, GLFW_KEY_ESC, GLFW_PRESS, -1 } },
62+
{ "simulateKeyUp(27)", { 0, 0.0, 0.0, GLFW_KEY_ESC, GLFW_RELEASE, -1 } },
6363

64-
{ "Module.injectKeyEvent('keydown', 65)", { 0, 0.0, 0.0, 'A', GLFW_PRESS, -1, 'A' } },
65-
{ "Module.injectKeyEvent('keypress', 65, {charCode: 65})", { 0, 0.0, 0.0, -1, -1, -1, 'A' } },
66-
{ "Module.injectKeyEvent('keyup', 65)", { 0, 0.0, 0.0, 'A', GLFW_RELEASE, -1, 'A' } },
64+
{ "simulateKeyDown(65)", { 0, 0.0, 0.0, 'A', GLFW_PRESS, -1, 'A' } },
65+
{ "simulateKeyEvent('keypress', 65, {charCode: 65})", { 0, 0.0, 0.0, -1, -1, -1, 'A' } },
66+
{ "simulateKeyUp(65)", { 0, 0.0, 0.0, 'A', GLFW_RELEASE, -1, 'A' } },
6767

68-
{ "Module.injectKeyEvent('keydown', 65, {ctrlKey: true})", { 0, 0.0, 0.0, 'A', GLFW_PRESS, -1, 'A' } },
69-
{ "Module.injectKeyEvent('keypress', 65, {ctrlKey: true, charCode: 65})", { 0, 0.0, 0.0, -1, -1, -1, -1 } },
70-
{ "Module.injectKeyEvent('keyup', 65, {ctrlKey: true})", { 0, 0.0, 0.0, 'A', GLFW_RELEASE, -1, 'A' } },
68+
{ "simulateKeyDown(65, {ctrlKey: true})", { 0, 0.0, 0.0, 'A', GLFW_PRESS, -1, 'A' } },
69+
{ "simulateKeyEvent('keypress', 65, {ctrlKey: true, charCode: 65})", { 0, 0.0, 0.0, -1, -1, -1, -1 } },
70+
{ "simulateKeyUp(65, {ctrlKey: true})", { 0, 0.0, 0.0, 'A', GLFW_RELEASE, -1, 'A' } },
7171
#else
72-
{ "Module.injectKeyEvent('keydown', 27)", { 0, 0.0, 0.0, GLFW_KEY_ESCAPE, GLFW_PRESS, -1 } },
73-
{ "Module.injectKeyEvent('keyup', 27)", { 0, 0.0, 0.0, GLFW_KEY_ESCAPE, GLFW_RELEASE, -1 } },
72+
{ "simulateKeyDown(27)", { 0, 0.0, 0.0, GLFW_KEY_ESCAPE, GLFW_PRESS, -1 } },
73+
{ "simulateKeyUp(27)", { 0, 0.0, 0.0, GLFW_KEY_ESCAPE, GLFW_RELEASE, -1 } },
7474

75-
{ "Module.injectKeyEvent('keydown', 65)", { 0, 0.0, 0.0, GLFW_KEY_A, GLFW_PRESS, -1 } },
76-
{ "Module.injectKeyEvent('keypress', 65, {charCode: 65})", { 0, 0.0, 0.0, -1, -1, -1, 'A' } },
77-
{ "Module.injectKeyEvent('keyup', 65)", { 0, 0.0, 0.0, GLFW_KEY_A, GLFW_RELEASE, -1 } },
75+
{ "simulateKeyDown(65)", { 0, 0.0, 0.0, GLFW_KEY_A, GLFW_PRESS, -1 } },
76+
{ "simulateKeyEvent('keypress', 65, {charCode: 65})", { 0, 0.0, 0.0, -1, -1, -1, 'A' } },
77+
{ "simulateKeyUp(65)", { 0, 0.0, 0.0, GLFW_KEY_A, GLFW_RELEASE, -1 } },
7878

79-
{ "Module.injectKeyEvent('keydown', 65, {ctrlKey: true})", { 0, 0.0, 0.0, GLFW_KEY_A, GLFW_PRESS, -1, 'A' } },
80-
{ "Module.injectKeyEvent('keypress', 65, {ctrlKey: true, charCode: 65})", { 0, 0.0, 0.0, -1, -1, -1, -1 } },
81-
{ "Module.injectKeyEvent('keyup', 65, {ctrlKey: true})", { 0, 0.0, 0.0, GLFW_KEY_A, GLFW_RELEASE, -1, 'A' } },
79+
{ "simulateKeyDown(65, {ctrlKey: true})", { 0, 0.0, 0.0, GLFW_KEY_A, GLFW_PRESS, -1, 'A' } },
80+
{ "simulateKeyEvent('keypress', 65, {ctrlKey: true, charCode: 65})", { 0, 0.0, 0.0, -1, -1, -1, -1 } },
81+
{ "simulateKeyUp(65, {ctrlKey: true})", { 0, 0.0, 0.0, GLFW_KEY_A, GLFW_RELEASE, -1, 'A' } },
8282
#endif
8383
};
8484

@@ -166,40 +166,6 @@ static void on_error(int error, const char *msg) {
166166
int main() {
167167
unsigned int success = (1 << (sizeof(g_tests) / sizeof(test_t))) - 1; // (2^count)-1;
168168

169-
emscripten_run_script(MULTILINE(
170-
Module.injectMouseEvent = function(x, y, event_, button) {
171-
var canvas = Module['canvas'];
172-
var event = new MouseEvent(event_, {
173-
'view': window,
174-
'bubbles': true,
175-
'cancelable': true,
176-
'screenX': canvas.offsetLeft + x,
177-
'screenY': canvas.offsetTop + y,
178-
'clientX': canvas.offsetLeft + x,
179-
'clientY': canvas.offsetTop + y,
180-
'button': button
181-
});
182-
canvas.dispatchEvent(event);
183-
184-
//var event = document.createEvent("MouseEvents");
185-
//var canvas = Module['canvas'];
186-
//event.initMouseEvent(event_, true, true, window, 0, canvas.offsetLeft + x, canvas.offsetTop + y, canvas.offsetLeft + x, canvas.offsetTop + y, 0, 0, 0, 0, button, null);
187-
//canvas.dispatchEvent(event);
188-
};
189-
190-
Module.injectKeyEvent = function(type, keyCode, options) {
191-
// KeyboardEvent constructor always returns 0 keyCode on Chrome, so use generic events
192-
//var keyboardEvent = new KeyboardEvent(type, Object.assign({ keyCode: keyCode}, options));
193-
var keyboardEvent = document.createEventObject ?
194-
document.createEventObject() : document.createEvent('Events');
195-
keyboardEvent.initEvent(type, true, true);
196-
keyboardEvent.keyCode = keyCode;
197-
keyboardEvent = Object.assign(keyboardEvent, options);
198-
199-
canvas.dispatchEvent(keyboardEvent);
200-
};
201-
));
202-
203169
glfwInit();
204170

205171
#if USE_GLFW == 2

test/browser/test_sdl2_key.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ int main(int argc, char **argv) {
6262

6363
SDL_StartTextInput();
6464

65-
emscripten_run_script("simulateKeyDown(38, 'ArrowUp'); simulateKeyUp(38, 'ArrowUp')"); // up
66-
emscripten_run_script("simulateKeyDown(40, 'ArrowDown'); simulateKeyUp(40, 'ArrowDown')"); // down
67-
emscripten_run_script("simulateKeyDown(37, 'ArrowLeft'); simulateKeyUp(37, 'ArrowLeft');"); // left
68-
emscripten_run_script("simulateKeyDown(39, 'ArrowRight');simulateKeyUp(39, 'ArrowRight');"); // right
69-
emscripten_run_script("simulateKeyDown(65, 'KeyA'); simulateKeyUp(65, 'KeyA');"); // a
70-
emscripten_run_script("simulateKeyDown(66, 'KeyB'); simulateKeyUp(66, 'KeyB');"); // b
71-
emscripten_run_script("simulateKeyDown(100, 'Numpad4'); simulateKeyUp(100, 'Numpad4');"); // trigger the end
65+
emscripten_run_script("simulateKeyDownUp(38, 'ArrowUp')");
66+
emscripten_run_script("simulateKeyDownUp(40, 'ArrowDown')");
67+
emscripten_run_script("simulateKeyDownUp(37, 'ArrowLeft')");
68+
emscripten_run_script("simulateKeyDownUp(39, 'ArrowRight')");
69+
emscripten_run_script("simulateKeyDownUp(65, 'KeyA')");
70+
emscripten_run_script("simulateKeyDownUp(66, 'KeyB')");
71+
emscripten_run_script("simulateKeyDownUp(100, 'Numpad4')"); // trigger the end
7272

7373
emscripten_set_main_loop(pump_events, 3, 0);
7474
return 99;

test/browser/test_sdl2_mouse.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ int main() {
9090
int absolute = false;
9191
#endif
9292

93-
EM_ASM(simulateMouseEvent(10, 20, -1, $0), absolute); // move from 0,0 to 10,20
94-
EM_ASM(simulateMouseEvent(10, 20, 0, $0), absolute); // click
95-
EM_ASM(simulateMouseEvent(10, 20, 0, $0), absolute); // click some more, but this one should be ignored through PeepEvent
96-
EM_ASM(simulateMouseEvent(30, 70, -1, $0), absolute); // move some more
97-
EM_ASM(simulateMouseEvent(30, 70, 1, $0), absolute); // trigger the end
93+
EM_ASM(simulateMouseMove(10, 20, $0), absolute); // move from 0,0 to 10,20
94+
EM_ASM(simulateMouseClick(10, 20, 0, $0), absolute); // click
95+
EM_ASM(simulateMouseClick(10, 20, 0, $0), absolute); // click some more, but this one should be ignored through PeepEvent
96+
EM_ASM(simulateMouseMove(30, 70, $0), absolute); // move some more
97+
EM_ASM(simulateMouseClick(30, 70, 1, $0), absolute); // trigger the end
9898

9999
emscripten_set_main_loop(one, 0, 0);
100100
}

test/browser/test_sdl_mouse.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ int main() {
7676
int absolute = false;
7777
#endif
7878

79-
EM_ASM(simulateMouseEvent(10, 20, -1, $0), absolute); // move from 0,0 to 10,20
80-
EM_ASM(simulateMouseEvent(10, 20, 0, $0), absolute); // click
81-
EM_ASM(simulateMouseEvent(10, 20, 0, $0), absolute); // click some more, but this one should be ignored through PeepEvent
82-
EM_ASM(simulateMouseEvent(30, 77, -1, $0), absolute); // move some more
83-
EM_ASM(simulateMouseEvent(30, 77, 1, $0), absolute); // trigger the end
79+
EM_ASM(simulateMouseMove(10, 20, $0), absolute); // move from 0,0 to 10,20
80+
EM_ASM(simulateMouseClick(10, 20, 0, $0), absolute); // click
81+
EM_ASM(simulateMouseClick(10, 20, 0, $0), absolute); // click some more, but this one should be ignored through PeepEvent
82+
EM_ASM(simulateMouseMove(30, 77, $0), absolute); // move some more
83+
EM_ASM(simulateMouseClick(30, 77, 1, $0), absolute); // trigger the end
8484

8585
emscripten_set_main_loop(one, 0, 0);
8686
}

test/test_browser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ def post():
10041004
self.btest_exit('test_sdl_key_proxy.c', 223092870, args=['--proxy-to-worker', '--pre-js', 'pre.js', '-lSDL', '-lGL', '-sRUNTIME_DEBUG'], post_build=post)
10051005

10061006
def test_canvas_focus(self):
1007-
self.btest_exit('canvas_focus.c')
1007+
self.btest_exit('test_canvas_focus.c', args=['--pre-js', test_file('browser/fake_events.js')])
10081008

10091009
def test_keydown_preventdefault_proxy(self):
10101010
def post():
@@ -2858,7 +2858,7 @@ def test_glfw3(self, args):
28582858
})
28592859
@requires_graphics_hardware
28602860
def test_glfw_events(self, args):
2861-
self.btest_exit('test_glfw_events.c', args=args + ['-lglfw', '-lGL'])
2861+
self.btest_exit('test_glfw_events.c', args=args + ['-lglfw', '-lGL', '--pre-js', test_file('browser/fake_events.js')])
28622862

28632863
@requires_graphics_hardware
28642864
def test_glfw3_hi_dpi_aware(self):

0 commit comments

Comments
 (0)