@@ -1859,6 +1859,155 @@ mod tests {
18591859 assert ! ( ( b_top - a_bottom - 40. ) . abs( ) <= 1e-5 ) ;
18601860 }
18611861
1862+ #[ test]
1863+ fn block_layouts_respect_align_content ( ) {
1864+ let mut app = setup_ui_test_app ( ) ;
1865+ let world = app. world_mut ( ) ;
1866+ let child = world
1867+ . spawn ( Node {
1868+ height : px ( 20 ) ,
1869+ ..default ( )
1870+ } )
1871+ . id ( ) ;
1872+ world
1873+ . spawn ( Node {
1874+ display : Display :: Block ,
1875+ align_content : AlignContent :: End ,
1876+ height : px ( 100 ) ,
1877+ ..default ( )
1878+ } )
1879+ . add_child ( child) ;
1880+
1881+ app. update ( ) ;
1882+
1883+ assert_eq ! (
1884+ app. world( )
1885+ . get:: <UiGlobalTransform >( child)
1886+ . map( |transform| transform. translation. y) ,
1887+ Some ( 90. )
1888+ ) ;
1889+ }
1890+
1891+ #[ test]
1892+ fn test_border_radius_updates ( ) {
1893+ let mut app = setup_ui_test_app ( ) ;
1894+
1895+ let entity = app
1896+ . world_mut ( )
1897+ . spawn ( ( Node {
1898+ height : px ( 100 ) ,
1899+ width : px ( 50 ) ,
1900+ ..default ( )
1901+ } , ) )
1902+ . id ( ) ;
1903+
1904+ app. update ( ) ;
1905+
1906+ let computed = app. world ( ) . get :: < ComputedNode > ( entity) . unwrap ( ) ;
1907+ assert_eq ! ( computed. border_radius, ResolvedBorderRadius :: ZERO ) ;
1908+
1909+ app. world_mut ( )
1910+ . get_mut :: < Node > ( entity)
1911+ . unwrap ( )
1912+ . border_radius = BorderRadius :: all ( px ( 10 ) ) ;
1913+
1914+ app. update ( ) ;
1915+
1916+ let computed = app. world ( ) . get :: < ComputedNode > ( entity) . unwrap ( ) ;
1917+ assert_eq ! (
1918+ computed. border_radius,
1919+ ResolvedBorderRadius {
1920+ top_left: Vec2 :: splat( 10. ) ,
1921+ top_right: Vec2 :: splat( 10. ) ,
1922+ bottom_left: Vec2 :: splat( 10. ) ,
1923+ bottom_right: Vec2 :: splat( 10. )
1924+ }
1925+ ) ;
1926+
1927+ app. world_mut ( )
1928+ . get_mut :: < Node > ( entity)
1929+ . unwrap ( )
1930+ . border_radius
1931+ . top_left = CornerRadius :: circular ( vh ( 30 ) ) ;
1932+
1933+ app. update ( ) ;
1934+
1935+ assert_eq ! (
1936+ app. world( )
1937+ . get:: <ComputedNode >( entity)
1938+ . unwrap( )
1939+ . border_radius,
1940+ ResolvedBorderRadius {
1941+ top_left: Vec2 :: splat( TARGET_HEIGHT as f32 * 30. / 100. ) . min( Vec2 :: splat( 25. ) ) ,
1942+ top_right: Vec2 :: splat( 10. ) ,
1943+ bottom_left: Vec2 :: splat( 10. ) ,
1944+ bottom_right: Vec2 :: splat( 10. )
1945+ }
1946+ ) ;
1947+
1948+ let border_radius = & mut app
1949+ . world_mut ( )
1950+ . get_mut :: < Node > ( entity)
1951+ . unwrap ( )
1952+ . border_radius ;
1953+ border_radius. top_right = CornerRadius :: circular ( percent ( 100 ) ) ;
1954+ border_radius. bottom_left = CornerRadius :: new ( percent ( 100 ) , percent ( 100 ) ) ;
1955+
1956+ app. update ( ) ;
1957+
1958+ assert_eq ! (
1959+ app. world( )
1960+ . get:: <ComputedNode >( entity)
1961+ . unwrap( )
1962+ . border_radius,
1963+ ResolvedBorderRadius {
1964+ top_left: Vec2 :: splat( TARGET_HEIGHT as f32 * 30. / 100. ) . min( Vec2 :: splat( 25. ) ) ,
1965+ top_right: Vec2 :: splat( 25. ) ,
1966+ bottom_left: Vec2 :: new( 25. , 50. ) ,
1967+ bottom_right: Vec2 :: splat( 10. )
1968+ }
1969+ ) ;
1970+
1971+ app. world_mut ( ) . get_mut :: < Node > ( entity) . unwrap ( ) . width = px ( 200. ) ;
1972+
1973+ app. update ( ) ;
1974+
1975+ assert_eq ! (
1976+ app. world( )
1977+ . get:: <ComputedNode >( entity)
1978+ . unwrap( )
1979+ . border_radius,
1980+ ResolvedBorderRadius {
1981+ top_left: Vec2 :: splat( TARGET_HEIGHT as f32 * 30. / 100. ) . min( Vec2 :: splat( 50. ) ) ,
1982+ top_right: Vec2 :: splat( 50. ) ,
1983+ bottom_left: Vec2 :: new( 100. , 50. ) ,
1984+ bottom_right: Vec2 :: splat( 10. )
1985+ }
1986+ ) ;
1987+
1988+ let world = app. world_mut ( ) ;
1989+ let mut camera_query = world. query :: < & mut Camera > ( ) ;
1990+ camera_query
1991+ . single_mut ( world)
1992+ . unwrap ( )
1993+ . viewport
1994+ . as_mut ( )
1995+ . unwrap ( )
1996+ . physical_size
1997+ . y = TARGET_HEIGHT / 2 ;
1998+
1999+ app. update ( ) ;
2000+
2001+ assert_eq ! (
2002+ app. world( )
2003+ . get:: <ComputedNode >( entity)
2004+ . unwrap( )
2005+ . border_radius
2006+ . top_left,
2007+ Vec2 :: splat( 15. )
2008+ ) ;
2009+ }
2010+
18622011 #[ cfg( feature = "ghost_nodes" ) ]
18632012 mod ghost_node_tests {
18642013 use super :: * ;
0 commit comments