2018-11-01 04:24:56 -04:00
|
|
|
#![cfg(feature = "serde")]
|
|
|
|
|
2019-06-21 11:33:15 -04:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use winit::{
|
|
|
|
dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize},
|
2023-05-28 20:02:59 +02:00
|
|
|
event::{ElementState, MouseButton, MouseScrollDelta, TouchPhase},
|
|
|
|
keyboard::{Key, KeyCode, KeyLocation, ModifiersState},
|
2019-06-21 11:33:15 -04:00
|
|
|
window::CursorIcon,
|
2018-11-01 04:24:56 -04:00
|
|
|
};
|
|
|
|
|
2019-06-18 02:27:00 +08:00
|
|
|
#[allow(dead_code)]
|
2018-11-01 04:24:56 -04:00
|
|
|
fn needs_serde<S: Serialize + Deserialize<'static>>() {}
|
|
|
|
|
|
|
|
#[test]
|
2019-02-05 10:30:33 -05:00
|
|
|
fn window_serde() {
|
2019-05-29 21:29:54 -04:00
|
|
|
needs_serde::<CursorIcon>();
|
2018-11-01 04:24:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn events_serde() {
|
|
|
|
needs_serde::<TouchPhase>();
|
|
|
|
needs_serde::<ElementState>();
|
|
|
|
needs_serde::<MouseButton>();
|
|
|
|
needs_serde::<MouseScrollDelta>();
|
2023-05-28 20:02:59 +02:00
|
|
|
needs_serde::<Key>();
|
|
|
|
needs_serde::<KeyCode>();
|
|
|
|
needs_serde::<KeyLocation>();
|
2018-11-01 04:24:56 -04:00
|
|
|
needs_serde::<ModifiersState>();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn dpi_serde() {
|
2020-01-04 01:33:07 -05:00
|
|
|
needs_serde::<LogicalPosition<f64>>();
|
|
|
|
needs_serde::<PhysicalPosition<i32>>();
|
|
|
|
needs_serde::<PhysicalPosition<f64>>();
|
|
|
|
needs_serde::<LogicalSize<f64>>();
|
|
|
|
needs_serde::<PhysicalSize<u32>>();
|
2018-11-01 04:24:56 -04:00
|
|
|
}
|