-
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.
Create development path without compatibility projects
- Loading branch information
Showing
33 changed files
with
943 additions
and
92 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,70 @@ | ||
{ | ||
"solution": { | ||
"path": "Microsoft.Maui-dev.sln", | ||
"projects": [ | ||
"src\\BlazorWebView\\samples\\BlazorWinFormsApp\\BlazorWinFormsApp.csproj", | ||
"src\\BlazorWebView\\samples\\BlazorWpfApp\\BlazorWpfApp.csproj", | ||
"src\\BlazorWebView\\samples\\MauiRazorClassLibrarySample\\MauiRazorClassLibrarySample.csproj", | ||
"src\\BlazorWebView\\samples\\WebViewAppShared\\WebViewAppShared.csproj", | ||
"src\\BlazorWebView\\src\\Maui\\Microsoft.AspNetCore.Components.WebView.Maui.csproj", | ||
"src\\BlazorWebView\\src\\WindowsForms\\Microsoft.AspNetCore.Components.WebView.WindowsForms.csproj", | ||
"src\\BlazorWebView\\src\\Wpf\\Microsoft.AspNetCore.Components.WebView.Wpf.csproj", | ||
"src\\BlazorWebView\\tests\\MauiDeviceTests\\MauiBlazorWebView.DeviceTests.csproj", | ||
"src\\Controls\\Foldable\\src\\Controls.Foldable.csproj", | ||
"src\\Controls\\Maps\\src\\Controls.Maps.csproj", | ||
"src\\Controls\\samples\\Controls.Sample.Profiling\\Maui.Controls.Sample.Profiling.csproj", | ||
"src\\Controls\\samples\\Controls.Sample.Sandbox\\Maui.Controls.Sample.Sandbox.csproj", | ||
"src\\Controls\\samples\\Controls.Sample\\Maui.Controls.Sample.csproj", | ||
"src\\Controls\\src\\Build.Tasks\\Controls.Build.Tasks.csproj", | ||
"src\\Controls\\src\\Core.Design\\Controls.Core.Design.csproj", | ||
"src\\Controls\\src\\Core\\Controls.Core.csproj", | ||
"src\\Controls\\src\\NuGet\\Controls.NuGet.csproj", | ||
"src\\Controls\\src\\SourceGen\\Controls.SourceGen.csproj", | ||
"src\\Controls\\src\\Xaml.Design\\Controls.Xaml.Design.csproj", | ||
"src\\Controls\\src\\Xaml\\Controls.Xaml.csproj", | ||
"src\\Controls\\tests\\Core.Design.UnitTests\\Controls.Core.Design.UnitTests.csproj", | ||
"src\\Controls\\tests\\Core.UnitTests\\Controls.Core.UnitTests.csproj", | ||
"src\\Controls\\tests\\CustomAttributes\\Controls.CustomAttributes.csproj", | ||
"src\\Controls\\tests\\DeviceTests\\Controls.DeviceTests.csproj", | ||
"src\\Controls\\tests\\Xaml.UnitTests.ExternalAssembly\\Controls.Xaml.UnitTests.ExternalAssembly.csproj", | ||
"src\\Controls\\tests\\Xaml.UnitTests\\Controls.Xaml.UnitTests.csproj", | ||
"src\\Core\\maps\\src\\Maps.csproj", | ||
"src\\Core\\src\\Core.csproj", | ||
"src\\Core\\tests\\Benchmarks.Droid\\Benchmarks.Droid.csproj", | ||
"src\\Core\\tests\\Benchmarks\\Core.Benchmarks.csproj", | ||
"src\\Core\\tests\\DeviceTests.Shared\\Core.DeviceTests.Shared.csproj", | ||
"src\\Core\\tests\\DeviceTests\\Core.DeviceTests.csproj", | ||
"src\\Core\\tests\\UnitTests\\Core.UnitTests.csproj", | ||
"src\\Essentials\\samples\\Sample.Server.WebAuthenticator\\Essentials.Sample.Server.WebAuthenticator.csproj", | ||
"src\\Essentials\\samples\\Samples\\Essentials.Sample.csproj", | ||
"src\\Essentials\\src\\Essentials.csproj", | ||
"src\\Essentials\\test\\DeviceTests\\Essentials.DeviceTests.csproj", | ||
"src\\Essentials\\test\\UnitTests\\Essentials.UnitTests.csproj", | ||
"src\\Graphics\\samples\\GraphicsTester.Android\\GraphicsTester.Android.csproj", | ||
"src\\Graphics\\samples\\GraphicsTester.Portable\\GraphicsTester.Portable.csproj", | ||
"src\\Graphics\\samples\\GraphicsTester.Skia.Console\\GraphicsTester.Skia.Console.csproj", | ||
"src\\Graphics\\samples\\GraphicsTester.Skia.Tizen\\GraphicsTester.Skia.Tizen.csproj", | ||
"src\\Graphics\\samples\\GraphicsTester.Skia.Windows\\GraphicsTester.Skia.Windows.csproj", | ||
"src\\Graphics\\samples\\GraphicsTester.WinUI.Desktop\\GraphicsTester.WinUI.Desktop.csproj", | ||
"src\\Graphics\\samples\\GraphicsTester.iOS\\GraphicsTester.iOS.csproj", | ||
"src\\Graphics\\src\\Graphics.Skia.WPF\\Graphics.Skia.WPF.csproj", | ||
"src\\Graphics\\src\\Graphics.Skia\\Graphics.Skia.csproj", | ||
"src\\Graphics\\src\\Graphics.Win2D\\Graphics.Win2D.csproj", | ||
"src\\Graphics\\src\\Graphics\\Graphics.csproj", | ||
"src\\Graphics\\src\\Text.Markdig\\Graphics.Text.Markdig.csproj", | ||
"src\\Graphics\\tests\\DeviceTests\\Graphics.DeviceTests.csproj", | ||
"src\\Graphics\\tests\\Graphics.Benchmarks\\Graphics.Benchmarks.csproj", | ||
"src\\Graphics\\tests\\Graphics.Tests\\Graphics.Tests.csproj", | ||
"src\\SingleProject\\Resizetizer\\src\\Resizetizer.csproj", | ||
"src\\SingleProject\\Resizetizer\\test\\UnitTests\\Resizetizer.UnitTests.csproj", | ||
"src\\Templates\\src\\Microsoft.Maui.Templates.csproj", | ||
"src\\TestUtils\\samples\\DeviceTests.Sample\\TestUtils.DeviceTests.Sample.csproj", | ||
"src\\TestUtils\\src\\DeviceTests.Runners.SourceGen\\TestUtils.DeviceTests.Runners.SourceGen.csproj", | ||
"src\\TestUtils\\src\\DeviceTests.Runners\\TestUtils.DeviceTests.Runners.csproj", | ||
"src\\TestUtils\\src\\DeviceTests\\TestUtils.DeviceTests.csproj", | ||
"src\\TestUtils\\src\\TestUtils\\TestUtils.csproj", | ||
"src\\Workload\\Microsoft.Maui.Sdk\\Microsoft.Maui.Sdk.csproj", | ||
"src\\Workload\\Microsoft.NET.Sdk.Maui\\Microsoft.NET.Sdk.Maui.csproj" | ||
] | ||
} | ||
} |
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
34 changes: 34 additions & 0 deletions
34
src/Compatibility/Core/tests/Compatibility.UnitTests/ApplicationStub.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,34 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Maui.Compatibility.Core.UnitTests | ||
{ | ||
class ApplicationStub : IApplication | ||
{ | ||
readonly List<IWindow> _windows = new List<IWindow>(); | ||
|
||
public IElementHandler Handler { get; set; } | ||
|
||
public Maui.IElement Parent { get; set; } | ||
|
||
public IReadOnlyList<IWindow> Windows => _windows.AsReadOnly(); | ||
|
||
public string Property { get; set; } = "Default"; | ||
|
||
public IWindow CreateWindow(IActivationState activationState) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public void OpenWindow(IWindow window) | ||
{ | ||
_windows.Add(window); | ||
} | ||
|
||
public void CloseWindow(IWindow window) | ||
{ | ||
_windows.Remove(window); | ||
} | ||
|
||
public void ThemeChanged() { } | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Compatibility/Core/tests/Compatibility.UnitTests/ButtonHandlerStub.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,13 @@ | ||
using System; | ||
using Microsoft.Maui.Handlers; | ||
|
||
namespace Microsoft.Maui.Compatibility.Core.UnitTests | ||
{ | ||
class ButtonHandlerStub : ViewHandler<IButton, object> | ||
{ | ||
protected override object CreatePlatformView() => throw new NotImplementedException(); | ||
public ButtonHandlerStub() : base(new PropertyMapper<IButton, ButtonHandlerStub>()) | ||
{ | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/Compatibility/Core/tests/Compatibility.UnitTests/Compatibility.Core.UnitTests.csproj
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,33 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>$(_MauiDotNetTfm)</TargetFramework> | ||
<AssemblyName>Microsoft.Maui.Compatibility.Core.UnitTests</AssemblyName> | ||
<IsPackable>false</IsPackable> | ||
<NoWarn>0114;0672;0108;0067;0168;0169;0219;0612;0618;1998;4014</NoWarn> | ||
<RootNamespace>Microsoft.Maui.Compatibility.Core.UnitTests</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" /> | ||
<PackageReference Include="coverlet.collector" Version="3.2.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" /> | ||
<PackageReference Include="NSubstitute" Version="4.3.0" /> | ||
<PackageReference Include="xunit" Version="2.4.2" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\..\Controls\src\Core\Controls.Core.csproj" /> | ||
<ProjectReference Include="..\..\..\..\Core\src\Core.csproj" /> | ||
<ProjectReference Include="..\..\..\..\TestUtils\src\TestUtils\TestUtils.csproj" /> | ||
<ProjectReference Include="..\..\src\Compatibility.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
76 changes: 76 additions & 0 deletions
76
src/Compatibility/Core/tests/Compatibility.UnitTests/HostBuilderAppTests.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,76 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Maui.Controls.Compatibility.Hosting; | ||
using Microsoft.Maui.Controls.Hosting; | ||
using Microsoft.Maui.Hosting; | ||
using Xunit; | ||
|
||
namespace Microsoft.Maui.Compatibility.Core.UnitTests | ||
{ | ||
|
||
public class HostBuilderAppTests | ||
{ | ||
[Theory] | ||
[InlineData(true)] | ||
[InlineData(false)] | ||
public void CompatibilityExtensionsWorkUseCompatibility(bool useCompatibility) | ||
{ | ||
MauiAppBuilderExtensions.ResetCompatibilityCheck(); | ||
bool handlersCalled = false; | ||
var builder = MauiApp.CreateBuilder().UseMauiApp<ApplicationStub>(); | ||
|
||
if (useCompatibility) | ||
builder = builder.UseMauiCompatibility(); | ||
|
||
var mauiApp = | ||
builder.ConfigureMauiHandlers(collection => | ||
{ | ||
handlersCalled = true; | ||
|
||
if (useCompatibility) | ||
{ | ||
collection.AddCompatibilityRenderer(typeof(Object), typeof(Object)); | ||
} | ||
else | ||
{ | ||
Assert.Throws<InvalidOperationException>(() => | ||
collection.AddCompatibilityRenderer(typeof(Object), typeof(Object)) | ||
); | ||
} | ||
}) | ||
.Build(); | ||
|
||
_ = mauiApp.Services.GetRequiredService<IMauiHandlersFactory>(); | ||
Assert.True(handlersCalled); | ||
} | ||
|
||
[Fact] | ||
public void RegisteringHandlerWithAddCompatibilityRendererThrowsException() | ||
{ | ||
MauiAppBuilderExtensions.ResetCompatibilityCheck(); | ||
bool handlersCalled = false; | ||
var builder = MauiApp.CreateBuilder().UseMauiApp<ApplicationStub>(); | ||
|
||
var mauiApp = | ||
builder.ConfigureMauiHandlers(collection => | ||
{ | ||
handlersCalled = true; | ||
|
||
Assert.Throws<InvalidOperationException>(() => | ||
collection.AddCompatibilityRenderer(typeof(ButtonHandlerStub), typeof(Object)) | ||
); | ||
}) | ||
.Build(); | ||
|
||
_ = mauiApp.Services.GetRequiredService<IMauiHandlersFactory>(); | ||
Assert.True(handlersCalled); | ||
} | ||
} | ||
} |
Oops, something went wrong.