diff --git a/src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj b/src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj index 5313b587c229..3b134ca8cb9a 100644 --- a/src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj +++ b/src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj @@ -19,6 +19,9 @@ + + + diff --git a/src/Controls/tests/DeviceTests/Elements/Image/ImageTests.cs b/src/Controls/tests/DeviceTests/Elements/Image/ImageTests.cs index ad021d8e89a3..ac3096293b89 100644 --- a/src/Controls/tests/DeviceTests/Elements/Image/ImageTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/Image/ImageTests.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.Maui.Controls; @@ -46,5 +47,28 @@ await InvokeOnMainThreadAsync(async () => await handler.ToPlatform().AssertContainsColor(Colors.Red, MauiContext); }); } + + [Fact] + public async Task ImageSetFromStreamRenders() + { + SetupBuilder(); + var layout = new VerticalStackLayout(); + + using var stream = GetType().Assembly.GetManifestResourceStream("red-embedded.png"); + + var image = new Image + { + Source = ImageSource.FromStream(() => stream) + }; + + layout.Add(image); + + await InvokeOnMainThreadAsync(async () => + { + var handler = CreateHandler(layout); + await image.Wait(); + await handler.ToPlatform().AssertContainsColor(Colors.Red, MauiContext); + }); + } } } \ No newline at end of file diff --git a/src/Controls/tests/DeviceTests/Resources/Images/red-embedded.png b/src/Controls/tests/DeviceTests/Resources/Images/red-embedded.png new file mode 100644 index 000000000000..3587e2727c39 Binary files /dev/null and b/src/Controls/tests/DeviceTests/Resources/Images/red-embedded.png differ