Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As reported in #17461, OnPlatform simplification cause some issues - while used as a Resource (#17461, unable to unit test for now) - doesn't type convert. On nodes shouldn't be replaced by the Value, but an element node (<On Platform="..." Value="Red" /> should generate <Color x:Key="foo">Red</Color>. right now it only generated "Red" - fixes #17461
- Loading branch information
1 parent
e982732
commit 5db6e53
Showing
3 changed files
with
102 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?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" | ||
xmlns:local="clr-namespace:Microsoft.Maui.Controls.Xaml.UnitTests" | ||
x:Class="Microsoft.Maui.Controls.Xaml.UnitTests.Maui17461"> | ||
<ContentPage.Resources> | ||
<!--<Color x:Key="LightSmoke">#4FFFFFFF</Color>--> | ||
<OnPlatform x:Key="EntryBackgroundColor" x:TypeArguments="Color"> | ||
<On Platform="iOS" Value="{StaticResource LightSmoke}" /> | ||
<On Platform="Android" Value="Transparent" /> | ||
</OnPlatform> | ||
</ContentPage.Resources> | ||
</ContentPage> |
38 changes: 38 additions & 0 deletions
38
src/Controls/tests/Xaml.UnitTests/Issues/Maui17461.xaml.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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using Microsoft.Maui.ApplicationModel; | ||
using Microsoft.Maui.Controls.Core.UnitTests; | ||
using Microsoft.Maui.Controls.Shapes; | ||
using Microsoft.Maui.Devices; | ||
using Microsoft.Maui.Graphics; | ||
using NUnit.Framework; | ||
|
||
namespace Microsoft.Maui.Controls.Xaml.UnitTests; | ||
|
||
public partial class Maui17461 : ContentPage | ||
{ | ||
|
||
public Maui17461() => InitializeComponent(); | ||
|
||
public Maui17461(bool useCompiledXaml) | ||
{ | ||
//this stub will be replaced at compile time | ||
} | ||
|
||
[TestFixture] | ||
class Test | ||
{ | ||
[SetUp] public void Setup() => AppInfo.SetCurrent(new MockAppInfo()); | ||
|
||
|
||
[TearDown] public void TearDown() => AppInfo.SetCurrent(null); | ||
|
||
[Test] | ||
public void MissingKeyException([Values("net7.0-ios", "net7.0-android", "net7.0-macos")] string targetFramework) | ||
{ | ||
MockCompiler.Compile(typeof(Maui17461), out var methodDef, targetFramework: targetFramework); | ||
} | ||
} | ||
} |