diff --git a/iced_layershell/tests/test_macro.rs b/iced_layershell/tests/test_macro.rs index 7aae4d3..eaf65f6 100644 --- a/iced_layershell/tests/test_macro.rs +++ b/iced_layershell/tests/test_macro.rs @@ -1,7 +1,8 @@ -use iced_layershell::to_layer_message; +use iced_layershell::actions::IsSingleton; +use iced_layershell::{to_layer_message, LayerSingleton}; #[test] -fn test_macro() { +fn test_layer_message_macro() { #[to_layer_message] #[derive(Debug, Clone)] enum TestEnum { @@ -10,3 +11,24 @@ fn test_macro() { let e = TestEnum::SizeChange((10, 10)); let _ = e.clone(); } + +#[test] +fn test_layersingleton_derive() { + #[allow(unused)] + #[derive(LayerSingleton)] + enum SingleToneTest { + #[singleton] + SingleTon, + NotSingleTon, + #[singleton] + SingleTonTwo { + field: bool, + }, + #[singleton] + SingleTonThird(i32), + } + assert!(SingleToneTest::SingleTon.is_singleton()); + assert!(!SingleToneTest::NotSingleTon.is_singleton()); + assert!(SingleToneTest::SingleTonTwo { field: false }.is_singleton()); + assert!(SingleToneTest::SingleTonThird(10).is_singleton()); +}