Path: blob/main/test/browser/html5_special_event_targets.cpp
4150 views
// Copyright 2016 The Emscripten Authors. All rights reserved.1// Emscripten is available under two separate licenses, the MIT license and the2// University of Illinois/NCSA Open Source License. Both these licenses can be3// found in the LICENSE file.45#include <GLES2/gl2.h>6#include <GLES2/gl2ext.h>7#include <assert.h>89#include <emscripten/emscripten.h>10#include <emscripten/html5.h>1112int main()13{14EM_ASM({15specialHTMLTargets["!foovas"] = Module.canvas;16});17EmscriptenWebGLContextAttributes attrs;18emscripten_webgl_init_context_attributes(&attrs);19// Test that creating a context with #canvas target when -sDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=020// will create a canvas against Module.canvas21EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context("!foovas", &attrs);22assert(context > 0); // Must have received a valid context.23EMSCRIPTEN_RESULT res = emscripten_webgl_make_context_current(context);24assert(res == EMSCRIPTEN_RESULT_SUCCESS);25assert(emscripten_webgl_get_current_context() == context);26return 0;27}282930