@ -111,7 +111,7 @@ namespace Avalonia.Base.UnitTests.Styling
}
[Fact]
public void Container_Queries_Matches_Name ( )
public void Container_Width_ Queries_Matches_Name ( )
{
using var app = UnitTestApplication . Start ( ) ;
var root = new LayoutTestRoot ( )
@ -160,5 +160,56 @@ namespace Avalonia.Base.UnitTests.Styling
root . LayoutManager . ExecuteLayoutPass ( ) ;
Assert . Equal ( child . Width , 3 0 0.0 ) ;
}
[Fact]
public void Container_Height_Queries_Matches_Name ( )
{
using var app = UnitTestApplication . Start ( ) ;
var root = new LayoutTestRoot ( )
{
ClientSize = new Size ( 6 0 0 , 6 0 0 )
} ;
var containerQuery1 = new ContainerQuery ( x = > new HeightQuery ( x , StyleQueryComparisonOperator . LessThanOrEquals , 5 0 0 ) ) ;
containerQuery1 . Children . Add ( new Style ( x = > x . Is < Border > ( ) )
{
Setters = { new Setter ( Control . HeightProperty , 2 0 0.0 ) }
} ) ;
var containerQuery2 = new ContainerQuery ( x = > new HeightQuery ( x , StyleQueryComparisonOperator . LessThanOrEquals , 5 0 0 ) , "TEST" ) ;
containerQuery2 . Children . Add ( new Style ( x = > x . Is < Border > ( ) )
{
Setters = { new Setter ( Control . HeightProperty , 3 0 0.0 ) }
} ) ;
root . Styles . Add ( containerQuery2 ) ;
root . Styles . Add ( containerQuery1 ) ;
var child = new Border ( )
{
Name = "Child" ,
VerticalAlignment = Avalonia . Layout . VerticalAlignment . Stretch
} ;
var controlInner = new ContentControl ( )
{
Width = 4 0 0 ,
Height = 4 0 0 ,
Content = child ,
Name = "Inner"
} ;
Container . SetSizing ( controlInner , Avalonia . Styling . ContainerSizing . Height ) ;
Container . SetName ( controlInner , "TEST" ) ;
var border = new Border ( )
{
HorizontalAlignment = Avalonia . Layout . HorizontalAlignment . Stretch ,
VerticalAlignment = Avalonia . Layout . VerticalAlignment . Stretch ,
Child = controlInner ,
Name = "Parent"
} ;
Container . SetSizing ( border , Avalonia . Styling . ContainerSizing . Height ) ;
root . Child = border ;
root . LayoutManager . ExecuteInitialLayoutPass ( ) ;
root . LayoutManager . ExecuteLayoutPass ( ) ;
Assert . Equal ( child . Height , 3 0 0.0 ) ;
}
}
}