-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for findCanvasEventTarget's various cases
- Loading branch information
Showing
3 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2024 The Emscripten Authors. All rights reserved. | ||
// Emscripten is available under two separate licenses, the MIT license and the | ||
// University of Illinois/NCSA Open Source License. Both these licenses can be | ||
// found in the LICENSE file. | ||
|
||
#include <GLES2/gl2.h> | ||
#include <GLES2/gl2ext.h> | ||
#include <assert.h> | ||
|
||
#include <emscripten/emscripten.h> | ||
#include <emscripten/html5.h> | ||
|
||
const char *TARGETS[]={"!foovas", "#canvas", "canvas"}; | ||
const char *target = TARGETS[WHICH_TARGET]; | ||
|
||
int main() | ||
{ | ||
EM_ASM({ | ||
specialHTMLTargets["!foovas"] = Module.canvas; | ||
}); | ||
int w=0, h=0; | ||
EMSCRIPTEN_RESULT res = emscripten_get_canvas_element_size(target, &w, &h); | ||
assert(res == EMSCRIPTEN_RESULT_SUCCESS); | ||
EmscriptenWebGLContextAttributes attrs; | ||
emscripten_webgl_init_context_attributes(&attrs); | ||
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context(target, &attrs); | ||
assert(context > 0); | ||
res = emscripten_webgl_make_context_current(context); | ||
assert(res == EMSCRIPTEN_RESULT_SUCCESS); | ||
assert(emscripten_webgl_get_current_context() == context); | ||
res = emscripten_get_canvas_element_size(target, &w, &h); | ||
assert(res == EMSCRIPTEN_RESULT_SUCCESS); | ||
res = emscripten_webgl_destroy_context(context); | ||
assert(res == EMSCRIPTEN_RESULT_SUCCESS); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters