forked from dotnet/maui
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…net#9662 Fixes dotnet#8390
- Loading branch information
1 parent
7f3b34f
commit c5d9e5f
Showing
5 changed files
with
60 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Microsoft.Maui.Controls.Xaml.UnitTests.ColorConverter"> | ||
<ContentPage.Content> | ||
<Button | ||
x:Name="Button0" | ||
Text="Button" | ||
BackgroundColor="{Binding ButtonBackground}" /> | ||
</ContentPage.Content> | ||
</ContentPage> |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Microsoft.Maui.Controls.Core.UnitTests; | ||
using Microsoft.Maui.Graphics; | ||
using NUnit.Framework; | ||
|
||
namespace Microsoft.Maui.Controls.Xaml.UnitTests | ||
{ | ||
public partial class ColorConverter : ContentPage | ||
{ | ||
class Data | ||
{ | ||
public string ButtonBackground => "#fc87ad"; | ||
} | ||
|
||
public ColorConverter() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
public ColorConverter(bool useCompiledXaml) | ||
{ | ||
//this stub will be replaced at compile time | ||
} | ||
|
||
[TestFixture] | ||
public class Tests | ||
{ | ||
[TestCase(false)] | ||
[TestCase(true)] | ||
public void StringsAreValidAsColor(bool useCompiledXaml) | ||
{ | ||
var page = new ColorConverter(useCompiledXaml); | ||
page.BindingContext = new Data(); | ||
|
||
var expected = Color.FromArgb("#fc87ad"); | ||
Assert.AreEqual(expected, page.Button0.BackgroundColor); | ||
} | ||
} | ||
} | ||
} |