mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-22 09:11:35 +00:00
Add immutable field to IdlType::Float32Array
This commit is contained in:
@ -1,26 +0,0 @@
|
||||
//! When generating our web_sys APIs we default to setting slice references that
|
||||
//! get passed to JS as mutable in case they get mutated in JS.
|
||||
//!
|
||||
//! In certain cases we know for sure that the slice will not get mutated - for
|
||||
//! example when working with the WebGlRenderingContext APIs.
|
||||
//!
|
||||
//! These tests ensure that whitelisted methods do indeed accept mutable slices.
|
||||
//!
|
||||
//! @see https://github.com/rustwasm/wasm-bindgen/issues/1005
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
use wasm_bindgen_test::*;
|
||||
use web_sys::WebGlRenderingContext;
|
||||
|
||||
#[wasm_bindgen(module = "./tests/wasm/element.js")]
|
||||
extern "C" {
|
||||
fn new_webgl_rendering_context() -> WebGlRenderingContext;
|
||||
}
|
||||
|
||||
// Ensure that our whitelisted WebGlRenderingContext methods work
|
||||
#[wasm_bindgen_test]
|
||||
fn test_webgl_rendering_context_immutable_slices() {
|
||||
let gl = new_webgl_rendering_context();
|
||||
|
||||
gl.vertex_attrib1fv_with_f32_array(0, &[5000.]);
|
||||
}
|
@ -56,7 +56,7 @@ pub mod style_element;
|
||||
pub mod table_element;
|
||||
pub mod title_element;
|
||||
pub mod xpath_result;
|
||||
pub mod immutable_slices;
|
||||
pub mod whitelisted_immutable_slices;
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn deref_works() {
|
||||
|
@ -22,5 +22,5 @@ extern "C" {
|
||||
fn test_webgl_rendering_context_immutable_slices() {
|
||||
let gl = new_webgl_rendering_context();
|
||||
|
||||
gl.vertex_attrib1fv_with_f32_array(0, &[5000.]);
|
||||
gl.vertex_attrib1fv_with_f32_array(0, &[5000.]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user