@@ -895,6 +895,78 @@ public void GetActualSegmentWidth_ReturnsExpectedWidth(double widthRequest, doub
895
895
Assert . Equal ( expectedResult , resultWidth ) ;
896
896
}
897
897
898
+ [ Theory ]
899
+ [ InlineData ( 100.0 , 50.0 , 200.0 , LayoutAlignment . Fill , 94.0 ) ]
900
+ [ InlineData ( - 100.0 , 50.0 , 200.0 , LayoutAlignment . Fill , 194.0 ) ]
901
+ [ InlineData ( 100.0 , 50.0 , 100.0 , LayoutAlignment . Start , 94.0 ) ]
902
+ [ InlineData ( - 100.0 , 50.0 , 200.0 , LayoutAlignment . Start , 50.0 ) ]
903
+
904
+ public void GetActualSegmentWidth_ReturnsExpectedWidth_WithStrokethicknessZero ( double widthRequest , double minWidth , double maxWidth , LayoutAlignment alignment , double expectedResult )
905
+ {
906
+ var segmentInfo = new SfSegmentedControl
907
+ {
908
+ _items = [ new SfSegmentItem { } , new SfSegmentItem { } ] ,
909
+ VisibleSegmentsCount = 2 ,
910
+ StrokeThickness = 0
911
+ } ;
912
+ var resultWidth = SegmentViewHelper . GetActualSegmentWidth ( segmentInfo , widthRequest , minWidth , maxWidth , alignment ) ;
913
+ Assert . Equal ( expectedResult , resultWidth ) ;
914
+ }
915
+
916
+ [ Theory ]
917
+ [ InlineData ( 100.0 , 50.0 , 200.0 , LayoutAlignment . Fill , 94.0 ) ]
918
+ [ InlineData ( - 100.0 , 50.0 , 200.0 , LayoutAlignment . Fill , 194.0 ) ]
919
+ [ InlineData ( 100.0 , 50.0 , 100.0 , LayoutAlignment . Start , 94.0 ) ]
920
+ [ InlineData ( - 100.0 , 50.0 , 200.0 , LayoutAlignment . Start , 50.0 ) ]
921
+
922
+ public void GetActualSegmentWidth_DifferentCount_ReturnsExpectedWidth_WithStrokethicknessZero ( double widthRequest , double minWidth , double maxWidth , LayoutAlignment alignment , double expectedResult )
923
+ {
924
+ var segmentInfo = new SfSegmentedControl
925
+ {
926
+ _items = [ new SfSegmentItem { } , new SfSegmentItem { } ] ,
927
+ VisibleSegmentsCount = 1 ,
928
+ StrokeThickness = 0
929
+ } ;
930
+ var resultWidth = SegmentViewHelper . GetActualSegmentWidth ( segmentInfo , widthRequest , minWidth , maxWidth , alignment ) ;
931
+ Assert . Equal ( expectedResult , resultWidth ) ;
932
+ }
933
+
934
+ [ Theory ]
935
+ [ InlineData ( 100.0 , 50.0 , 200.0 , LayoutAlignment . Fill , 94.0 ) ]
936
+ [ InlineData ( - 100.0 , 50.0 , 200.0 , LayoutAlignment . Fill , 194.0 ) ]
937
+ [ InlineData ( 100.0 , 50.0 , 100.0 , LayoutAlignment . Start , 94.0 ) ]
938
+ [ InlineData ( - 100.0 , 50.0 , 200.0 , LayoutAlignment . Start , 194.0 ) ]
939
+
940
+ public void GetActualSegmentWidth_NegativeCount_ReturnsExpectedWidth_WithStrokethicknessZero ( double widthRequest , double minWidth , double maxWidth , LayoutAlignment alignment , double expectedResult )
941
+ {
942
+ var segmentInfo = new SfSegmentedControl
943
+ {
944
+ _items = [ new SfSegmentItem { } , new SfSegmentItem { } ] ,
945
+ VisibleSegmentsCount = - 1 ,
946
+ StrokeThickness = 0
947
+ } ;
948
+ var resultWidth = SegmentViewHelper . GetActualSegmentWidth ( segmentInfo , widthRequest , minWidth , maxWidth , alignment ) ;
949
+ Assert . Equal ( expectedResult , resultWidth ) ;
950
+ }
951
+
952
+ [ Theory ]
953
+ [ InlineData ( 100.0 , 50.0 , 200.0 , LayoutAlignment . Fill , 94.0 ) ]
954
+ [ InlineData ( - 100.0 , 50.0 , 200.0 , LayoutAlignment . Fill , 194.0 ) ]
955
+ [ InlineData ( 100.0 , 50.0 , 100.0 , LayoutAlignment . Start , 94.0 ) ]
956
+ [ InlineData ( - 100.0 , 50.0 , 200.0 , LayoutAlignment . Start , 194.0 ) ]
957
+
958
+ public void GetActualSegmentWidth_NegativeCount_ReturnsExpectedWidth_WithStrokethickness ( double widthRequest , double minWidth , double maxWidth , LayoutAlignment alignment , double expectedResult )
959
+ {
960
+ var segmentInfo = new SfSegmentedControl
961
+ {
962
+ _items = [ new SfSegmentItem { } , new SfSegmentItem { } ] ,
963
+ VisibleSegmentsCount = - 1 ,
964
+ StrokeThickness = 1
965
+ } ;
966
+ var resultWidth = SegmentViewHelper . GetActualSegmentWidth ( segmentInfo , widthRequest , minWidth , maxWidth , alignment ) ;
967
+ Assert . Equal ( expectedResult , resultWidth ) ;
968
+ }
969
+
898
970
[ Theory ]
899
971
[ InlineData ( LayoutAlignment . Fill ) ]
900
972
[ InlineData ( LayoutAlignment . Start ) ]
0 commit comments