-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Font properties in PickerHandlers (#589)
- Loading branch information
1 parent
0736879
commit b83f98a
Showing
9 changed files
with
100 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 56 additions & 1 deletion
57
src/Core/tests/DeviceTests/Handlers/Picker/PickerHandlerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,65 @@ | ||
using Microsoft.Maui.DeviceTests.Stubs; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Microsoft.Maui.DeviceTests.Stubs; | ||
using Microsoft.Maui.Handlers; | ||
using Xunit; | ||
|
||
namespace Microsoft.Maui.DeviceTests | ||
{ | ||
[Category(TestCategory.Picker)] | ||
public partial class PickerHandlerTests : HandlerTestBase<PickerHandler, PickerStub> | ||
{ | ||
[Theory(DisplayName = "Font Size Initializes Correctly")] | ||
[InlineData(1)] | ||
[InlineData(10)] | ||
[InlineData(20)] | ||
[InlineData(100)] | ||
public async Task FontSizeInitializesCorrectly(int fontSize) | ||
{ | ||
var items = new List<string> | ||
{ | ||
"Item 1", | ||
"Item 2", | ||
"Item 3" | ||
}; | ||
|
||
var picker = new PickerStub() | ||
{ | ||
Title = "Select an Item", | ||
Font = Font.OfSize("Arial", fontSize) | ||
}; | ||
|
||
picker.ItemsSource = items; | ||
picker.SelectedIndex = 0; | ||
|
||
await ValidatePropertyInitValue(picker, () => picker.Font.FontSize, GetNativeUnscaledFontSize, picker.Font.FontSize); | ||
} | ||
|
||
[Theory(DisplayName = "Font Attributes Initialize Correctly")] | ||
[InlineData(FontAttributes.None, false, false)] | ||
[InlineData(FontAttributes.Bold, true, false)] | ||
[InlineData(FontAttributes.Italic, false, true)] | ||
[InlineData(FontAttributes.Bold | FontAttributes.Italic, true, true)] | ||
public async Task FontAttributesInitializeCorrectly(FontAttributes attributes, bool isBold, bool isItalic) | ||
{ | ||
var items = new List<string> | ||
{ | ||
"Item 1", | ||
"Item 2", | ||
"Item 3" | ||
}; | ||
|
||
var picker = new PickerStub() | ||
{ | ||
Title = "Select an Item", | ||
Font = Font.OfSize("Arial", 10).WithAttributes(attributes) | ||
}; | ||
|
||
picker.ItemsSource = items; | ||
picker.SelectedIndex = 0; | ||
|
||
await ValidatePropertyInitValue(picker, () => picker.Font.FontAttributes.HasFlag(FontAttributes.Bold), GetNativeIsBold, isBold); | ||
await ValidatePropertyInitValue(picker, () => picker.Font.FontAttributes.HasFlag(FontAttributes.Italic), GetNativeIsItalic, isItalic); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters