use test_tools::*;
use core::mem::size_of;
use math_adapter::prelude::*;
use math_adapter::X2;
use crate::{ num };
tests_impls!
{
fn basic()
{
type T = i8;
{
a_id!( size_of::< winit::dpi::PhysicalSize::< T > >(), size_of::< ( T, T ) >() );
a_id!( size_of::< winit::dpi::PhysicalSize::< T > >(), size_of::< [ T ; 2 ] >() );
a_id!( size_of::< winit::dpi::PhysicalSize::< T > >(), 2 );
}
{
let got = winit::dpi::PhysicalSize::< i8 >{ width : 1, height : 2 };
a_id!( got.width, 1 );
a_id!( got.height, 2 );
a_id!( got._0(), 1 );
a_id!( got._1(), 2 );
}
}
fn physical_size()
{
math_adapter::for_each!
(
crate::macro_foreign_x2::macro_test_foreign_x2_number_for_each,
{ winit::dpi::PhysicalSize, width, height },
{ winit::dpi::LogicalSize, width, height },
{ winit::dpi::PhysicalPosition, x, y },
{ winit::dpi::LogicalPosition, x, y },
);
}
#[ cfg( all( feature = "winit", feature = "cgmath" ) ) ]
fn cgmath_winit_interoperability()
{
{
let src1 = winit::dpi::PhysicalSize::< i8 >::make( 3, 2 );
let src2 = winit::dpi::PhysicalSize::< i8 >::make( 0, 1 );
let got = src1.as_cgmath() - src2.as_cgmath();
let exp = cgmath::Vector2::< i8 >::make( 3, 1 );
a_id!( got, exp );
}
}
#[ cfg( all( feature = "winit" ) ) ]
#[ cfg( nalgebra_ops ) ]
fn inter_winit()
{
type T = i8;
{
let src1 = winit::dpi::PhysicalSize::< T >::make( 1, 3 );
let got = src1.as_canonical().sum();
let exp = 4;
a_id!( got, exp );
}
}
}
tests_index!
{
basic,
physical_size,
cgmath_winit_interoperability,
inter_winit,
}