@@ -1191,6 +1191,51 @@ public void Content_TimePicker(ContainerType container)
1191
1191
Assert . Equal ( new TimeSpan ( 10 , 30 , 0 ) , timePicker . Time ) ;
1192
1192
}
1193
1193
1194
+ [ Fact ]
1195
+ public void VerySmallContainerWidth_ShouldNotCrash ( )
1196
+ {
1197
+ // Test for the fix of issue where very small container widths cause Android crash
1198
+ // with Java.Lang.IllegalArgumentException: 'Layout: -46 < 0'
1199
+ var inputLayout = new SfTextInputLayout
1200
+ {
1201
+ Content = new Entry { Text = "Test" } ,
1202
+ Hint = "Name" ,
1203
+ WidthRequest = 10 , // Very small width that could cause negative layout bounds
1204
+ HeightRequest = 50
1205
+ } ;
1206
+
1207
+ // The control should handle very small dimensions gracefully without throwing exceptions
1208
+ Assert . NotNull ( inputLayout ) ;
1209
+ Assert . NotNull ( inputLayout . Content ) ;
1210
+ Assert . Equal ( "Test" , ( ( Entry ) inputLayout . Content ) . Text ) ;
1211
+ Assert . Equal ( "Name" , inputLayout . Hint ) ;
1212
+ }
1213
+
1214
+ [ Fact ]
1215
+ public void VerySmallContainerWidthWithLeadingAndTrailingViews_ShouldNotCrash ( )
1216
+ {
1217
+ // Test for the fix where very small container widths with leading/trailing views cause crashes
1218
+ var inputLayout = new SfTextInputLayout
1219
+ {
1220
+ Content = new Entry { Text = "Test" } ,
1221
+ Hint = "Name" ,
1222
+ LeadingView = new Label { Text = "L" } ,
1223
+ TrailingView = new Label { Text = "T" } ,
1224
+ ShowLeadingView = true ,
1225
+ ShowTrailingView = true ,
1226
+ WidthRequest = 10 , // Very small width that could cause negative layout bounds
1227
+ HeightRequest = 50
1228
+ } ;
1229
+
1230
+ // The control should handle very small dimensions gracefully without throwing exceptions
1231
+ Assert . NotNull ( inputLayout ) ;
1232
+ Assert . NotNull ( inputLayout . Content ) ;
1233
+ Assert . NotNull ( inputLayout . LeadingView ) ;
1234
+ Assert . NotNull ( inputLayout . TrailingView ) ;
1235
+ Assert . True ( inputLayout . ShowLeadingView ) ;
1236
+ Assert . True ( inputLayout . ShowTrailingView ) ;
1237
+ }
1238
+
1194
1239
1195
1240
#endregion
1196
1241
}
0 commit comments