1 use wasm_bindgen::JsValue;
2 use wasm_bindgen_test::*;
3 use web_sys::{DomPoint, DomPointReadOnly};
4
5 #[wasm_bindgen_test]
dom_point()6 fn dom_point() {
7 let x = DomPoint::new_with_x_and_y_and_z_and_w(1.0, 2.0, 3.0, 4.0).unwrap();
8 assert_eq!(x.x(), 1.0);
9 x.set_x(1.5);
10 assert_eq!(x.x(), 1.5);
11
12 assert_eq!(x.y(), 2.0);
13 x.set_y(2.5);
14 assert_eq!(x.y(), 2.5);
15
16 assert_eq!(x.z(), 3.0);
17 x.set_z(3.5);
18 assert_eq!(x.z(), 3.5);
19
20 assert_eq!(x.w(), 4.0);
21 x.set_w(4.5);
22 assert_eq!(x.w(), 4.5);
23 }
24
25 #[wasm_bindgen_test]
dom_point_readonly()26 fn dom_point_readonly() {
27 let x = DomPoint::new_with_x_and_y_and_z_and_w(1.0, 2.0, 3.0, 4.0).unwrap();
28 let x = DomPointReadOnly::from(JsValue::from(x));
29 assert_eq!(x.x(), 1.0);
30 assert_eq!(x.y(), 2.0);
31 assert_eq!(x.z(), 3.0);
32 assert_eq!(x.w(), 4.0);
33 }
34