diff --git a/crates/tests/winrt/reference_float/src/bindings.rs b/crates/tests/winrt/reference_float/src/bindings.rs index 203d4bc8c6..39ddc3745c 100644 --- a/crates/tests/winrt/reference_float/src/bindings.rs +++ b/crates/tests/winrt/reference_float/src/bindings.rs @@ -8,34 +8,16 @@ #[repr(C)] #[derive(Clone, Debug, PartialEq)] pub struct RefWithFloat { - pub ReferenceFloat: Option>, - pub ReferenceWithFloat: Option>, + pub Value: Option>, } impl windows_core::TypeKind for RefWithFloat { type TypeKind = windows_core::CloneType; } impl windows_core::RuntimeType for RefWithFloat { - const SIGNATURE :windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::from_slice ( b"struct(test_reference_float.RefWithFloat;pinterface({61c17706-2d65-11e0-9ae8-d48564015472};f4);pinterface({61c17706-2d65-11e0-9ae8-d48564015472};struct(test_reference_float.WithFloat;f4)))" ) ; + const SIGNATURE :windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::from_slice ( b"struct(test_reference_float.RefWithFloat;pinterface({61c17706-2d65-11e0-9ae8-d48564015472};f4))" ) ; } impl Default for RefWithFloat { fn default() -> Self { unsafe { core::mem::zeroed() } } } -#[repr(C)] -#[derive(Clone, Copy, Debug, PartialEq)] -pub struct WithFloat { - pub Value: f32, -} -impl windows_core::TypeKind for WithFloat { - type TypeKind = windows_core::CopyType; -} -impl windows_core::RuntimeType for WithFloat { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::from_slice(b"struct(test_reference_float.WithFloat;f4)"); -} -impl Default for WithFloat { - fn default() -> Self { - unsafe { core::mem::zeroed() } - } -} diff --git a/crates/tests/winrt/reference_float/src/lib.rs b/crates/tests/winrt/reference_float/src/lib.rs index 7cb93020cc..2840f056d5 100644 --- a/crates/tests/winrt/reference_float/src/lib.rs +++ b/crates/tests/winrt/reference_float/src/lib.rs @@ -5,10 +5,7 @@ use windows::{core::*, Foundation::*}; #[test] fn test() -> Result<()> { let mut container = RefWithFloat::default(); - container.ReferenceFloat = Some(PropertyValue::CreateSingle(1.23)?.cast()?); - - // TODO: https://github.com/microsoft/windows-rs/issues/292 is needed to provide a stock implementation - // of `IReference` for arbitrary types in order to test `container.ReferenceWithFloat`. + container.Value = Some(PropertyValue::CreateSingle(1.23)?.cast()?); Ok(()) } diff --git a/crates/tests/winrt/reference_float/src/metadata.idl b/crates/tests/winrt/reference_float/src/metadata.idl index e49b1d9f97..f2e3ae1f8e 100644 --- a/crates/tests/winrt/reference_float/src/metadata.idl +++ b/crates/tests/winrt/reference_float/src/metadata.idl @@ -3,14 +3,8 @@ namespace test_reference_float { - struct WithFloat - { - Single Value; - }; - struct RefWithFloat { - Windows.Foundation.IReference ReferenceFloat; - Windows.Foundation.IReference ReferenceWithFloat; + Windows.Foundation.IReference Value; }; }