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