1
- using Microsoft . Maui . DeviceTests . Stubs ;
1
+ using System . Collections . Generic ;
2
+ using System . Threading . Tasks ;
3
+ using Microsoft . Maui . DeviceTests . Stubs ;
2
4
using Microsoft . Maui . Handlers ;
5
+ using Xunit ;
3
6
4
7
namespace Microsoft . Maui . DeviceTests
5
8
{
6
9
[ Category ( TestCategory . Picker ) ]
7
10
public partial class PickerHandlerTests : HandlerTestBase < PickerHandler , PickerStub >
8
11
{
12
+ [ Theory ( DisplayName = "Font Size Initializes Correctly" ) ]
13
+ [ InlineData ( 1 ) ]
14
+ [ InlineData ( 10 ) ]
15
+ [ InlineData ( 20 ) ]
16
+ [ InlineData ( 100 ) ]
17
+ public async Task FontSizeInitializesCorrectly ( int fontSize )
18
+ {
19
+ var items = new List < string >
20
+ {
21
+ "Item 1" ,
22
+ "Item 2" ,
23
+ "Item 3"
24
+ } ;
25
+
26
+ var picker = new PickerStub ( )
27
+ {
28
+ Title = "Select an Item" ,
29
+ Font = Font . OfSize ( "Arial" , fontSize )
30
+ } ;
31
+
32
+ picker . ItemsSource = items ;
33
+ picker . SelectedIndex = 0 ;
34
+
35
+ await ValidatePropertyInitValue ( picker , ( ) => picker . Font . FontSize , GetNativeUnscaledFontSize , picker . Font . FontSize ) ;
36
+ }
37
+
38
+ [ Theory ( DisplayName = "Font Attributes Initialize Correctly" ) ]
39
+ [ InlineData ( FontAttributes . None , false , false ) ]
40
+ [ InlineData ( FontAttributes . Bold , true , false ) ]
41
+ [ InlineData ( FontAttributes . Italic , false , true ) ]
42
+ [ InlineData ( FontAttributes . Bold | FontAttributes . Italic , true , true ) ]
43
+ public async Task FontAttributesInitializeCorrectly ( FontAttributes attributes , bool isBold , bool isItalic )
44
+ {
45
+ var items = new List < string >
46
+ {
47
+ "Item 1" ,
48
+ "Item 2" ,
49
+ "Item 3"
50
+ } ;
51
+
52
+ var picker = new PickerStub ( )
53
+ {
54
+ Title = "Select an Item" ,
55
+ Font = Font . OfSize ( "Arial" , 10 ) . WithAttributes ( attributes )
56
+ } ;
57
+
58
+ picker . ItemsSource = items ;
59
+ picker . SelectedIndex = 0 ;
60
+
61
+ await ValidatePropertyInitValue ( picker , ( ) => picker . Font . FontAttributes . HasFlag ( FontAttributes . Bold ) , GetNativeIsBold , isBold ) ;
62
+ await ValidatePropertyInitValue ( picker , ( ) => picker . Font . FontAttributes . HasFlag ( FontAttributes . Italic ) , GetNativeIsItalic , isItalic ) ;
63
+ }
9
64
}
10
65
}
0 commit comments