@@ -699,6 +699,32 @@ public void CalculateWidth_ShouldReturnWidth(double width, double expectedValue)
699
699
Assert . Equal ( expectedValue , actualValue ) ;
700
700
}
701
701
702
+ [ Theory ]
703
+ [ InlineData ( 150 , 142 , "SampleImage1.png" , Alignment . Left ) ]
704
+ [ InlineData ( 150 , 108 , "SampleImage1.png" , Alignment . Right ) ]
705
+ [ InlineData ( 180 , 164 , "SampleImage1.png" , Alignment . Top ) ]
706
+ [ InlineData ( 250 , 234 , "SampleImage1.png" , Alignment . Bottom ) ]
707
+ [ InlineData ( 200 , 184 , "SampleImage1.png" , null ) ]
708
+ public void CalculateAvailableTextWidth_ShouldReturnExpectedWidth ( double width , double expectedValue , string imagePath , Alignment ? alignment = null )
709
+ {
710
+ // Arrange
711
+ var button = new SfButton ( ) ;
712
+ button . ImageSource = ImageSource . FromFile ( imagePath ) ;
713
+
714
+ if ( alignment != null )
715
+ {
716
+ button . ShowIcon = true ;
717
+ button . ImageAlignment = ( Alignment ) alignment ;
718
+ }
719
+
720
+ // Set up as needed
721
+ button . Padding = new Thickness ( 4 , 4 , 4 , 4 ) ;
722
+
723
+ var actualValue = InvokePrivateMethod ( button , "CalculateAvailableTextWidth" , width ) ;
724
+
725
+ Assert . Equal ( expectedValue , actualValue ) ;
726
+ }
727
+
702
728
[ Theory ]
703
729
[ InlineData ( true , false , false , false , "#000000" ) ]
704
730
[ InlineData ( true , true , false , false , "#FF0000" ) ]
0 commit comments