diff --git a/src/Controls/samples/Controls.Sample.UITests/Concepts/ImageLoadingGalleryPage.cs b/src/Controls/samples/Controls.Sample.UITests/Concepts/ImageLoadingGalleryPage.cs new file mode 100644 index 000000000000..281469e029f3 --- /dev/null +++ b/src/Controls/samples/Controls.Sample.UITests/Concepts/ImageLoadingGalleryPage.cs @@ -0,0 +1,30 @@ +using System; +using Microsoft.Maui.Controls; + +namespace Maui.Controls.Sample +{ + internal class ImageLoadingGalleryPage : CoreGalleryBasePage + { + protected override void Build() + { + Add(Test.ImageLoading.FromBundleSvg, ImageSource.FromFile("dotnet_bot.png")); + + Add(Test.ImageLoading.FromBundlePng, ImageSource.FromFile("groceries.png")); + + Add(Test.ImageLoading.FromBundleJpg, ImageSource.FromFile("oasis.jpg")); + + Add(Test.ImageLoading.FromBundleGif, ImageSource.FromFile("animated_heart.gif")); + } + + ViewContainer Add(Test.ImageLoading test, ImageSource image) => + Add(test, new Image + { + Source = image, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Start + }); + + ViewContainer Add(Test.ImageLoading test, Image image) => + Add(new ViewContainer(test, image)); + } +} diff --git a/src/Controls/samples/Controls.Sample.UITests/CoreViews/CorePageView.cs b/src/Controls/samples/Controls.Sample.UITests/CoreViews/CorePageView.cs index fc4b37e9608f..936cffcb443f 100644 --- a/src/Controls/samples/Controls.Sample.UITests/CoreViews/CorePageView.cs +++ b/src/Controls/samples/Controls.Sample.UITests/CoreViews/CorePageView.cs @@ -48,6 +48,7 @@ public override string ToString() new GalleryPageFactory(() => new DragAndDropGallery(), "Drag and Drop Gallery"), new GalleryPageFactory(() => new GestureRecognizerGallery(), "Gesture Recognizer Gallery"), new GalleryPageFactory(() => new InputTransparencyGalleryPage(), "Input Transparency Gallery"), + new GalleryPageFactory(() => new ImageLoadingGalleryPage(), "Image Loading Gallery"), // Elements new GalleryPageFactory(() => new ActivityIndicatorCoreGalleryPage(), "ActivityIndicator Gallery"), new GalleryPageFactory(() => new BoxViewCoreGalleryPage(), "Box Gallery"), diff --git a/src/Controls/samples/Controls.Sample.UITests/Resources/Images/animated_heart.gif b/src/Controls/samples/Controls.Sample.UITests/Resources/Images/animated_heart.gif new file mode 100644 index 000000000000..a7dfec7ea5cd Binary files /dev/null and b/src/Controls/samples/Controls.Sample.UITests/Resources/Images/animated_heart.gif differ diff --git a/src/Controls/samples/Controls.Sample.UITests/Test.cs b/src/Controls/samples/Controls.Sample.UITests/Test.cs index fd42adf37926..b5b94adc4ff6 100644 --- a/src/Controls/samples/Controls.Sample.UITests/Test.cs +++ b/src/Controls/samples/Controls.Sample.UITests/Test.cs @@ -712,6 +712,14 @@ public enum CarouselView IsBounceEnabled } + public enum ImageLoading + { + FromBundleSvg, + FromBundlePng, + FromBundleJpg, + FromBundleGif, + } + public enum InputTransparency { Default, diff --git a/src/Controls/tests/UITests/Tests/Concepts/ImageLoadingGalleryTests.cs b/src/Controls/tests/UITests/Tests/Concepts/ImageLoadingGalleryTests.cs new file mode 100644 index 000000000000..4f86d90ec4c4 --- /dev/null +++ b/src/Controls/tests/UITests/Tests/Concepts/ImageLoadingGalleryTests.cs @@ -0,0 +1,43 @@ +using Maui.Controls.Sample; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.AppiumTests +{ + public class ImageLoadingGalleryTests : CoreGalleryBasePageTest + { + public ImageLoadingGalleryTests(TestDevice device) + : base(device) + { + } + + protected override void NavigateToGallery() + { + App.NavigateToGallery("Image Loading Gallery"); + } + + [Test] + public void LoadAndVerifyPng() => LoadAndVerify(Test.ImageLoading.FromBundlePng); + + [Test] + public void LoadAndVerifyJpg() => LoadAndVerify(Test.ImageLoading.FromBundleJpg); + + [Test] + public void LoadAndVerifyGif() => LoadAndVerify(Test.ImageLoading.FromBundleGif); + + [Test] + public void LoadAndVerifySvg() => LoadAndVerify(Test.ImageLoading.FromBundleSvg); + + void LoadAndVerify(Test.ImageLoading test) + { + var remote = new EventViewContainerRemote(UITestContext, test); + remote.GoTo(test.ToString()); + + App.WaitForElement($"{test}VisualElement"); + Thread.Sleep(1000); // android has some button animations that need to finish + + VerifyScreenshot(); + } + } +} diff --git a/src/Controls/tests/UITests/snapshots/android/LoadAndVerifyGif.png b/src/Controls/tests/UITests/snapshots/android/LoadAndVerifyGif.png new file mode 100644 index 000000000000..59a6e6c09daa Binary files /dev/null and b/src/Controls/tests/UITests/snapshots/android/LoadAndVerifyGif.png differ diff --git a/src/Controls/tests/UITests/snapshots/android/LoadAndVerifyJpg.png b/src/Controls/tests/UITests/snapshots/android/LoadAndVerifyJpg.png new file mode 100644 index 000000000000..98cf290fe970 Binary files /dev/null and b/src/Controls/tests/UITests/snapshots/android/LoadAndVerifyJpg.png differ diff --git a/src/Controls/tests/UITests/snapshots/android/LoadAndVerifyPng.png b/src/Controls/tests/UITests/snapshots/android/LoadAndVerifyPng.png new file mode 100644 index 000000000000..d15518a20f4e Binary files /dev/null and b/src/Controls/tests/UITests/snapshots/android/LoadAndVerifyPng.png differ diff --git a/src/Controls/tests/UITests/snapshots/android/LoadAndVerifySvg.png b/src/Controls/tests/UITests/snapshots/android/LoadAndVerifySvg.png new file mode 100644 index 000000000000..8503a6e4442e Binary files /dev/null and b/src/Controls/tests/UITests/snapshots/android/LoadAndVerifySvg.png differ diff --git a/src/Controls/tests/UITests/snapshots/ios/LoadAndVerifyGif.png b/src/Controls/tests/UITests/snapshots/ios/LoadAndVerifyGif.png new file mode 100644 index 000000000000..fc70afdd5bd7 Binary files /dev/null and b/src/Controls/tests/UITests/snapshots/ios/LoadAndVerifyGif.png differ diff --git a/src/Controls/tests/UITests/snapshots/ios/LoadAndVerifyJpg.png b/src/Controls/tests/UITests/snapshots/ios/LoadAndVerifyJpg.png new file mode 100644 index 000000000000..0f7baa06499a Binary files /dev/null and b/src/Controls/tests/UITests/snapshots/ios/LoadAndVerifyJpg.png differ diff --git a/src/Controls/tests/UITests/snapshots/ios/LoadAndVerifyPng.png b/src/Controls/tests/UITests/snapshots/ios/LoadAndVerifyPng.png new file mode 100644 index 000000000000..b31bf02bc91d Binary files /dev/null and b/src/Controls/tests/UITests/snapshots/ios/LoadAndVerifyPng.png differ diff --git a/src/Controls/tests/UITests/snapshots/ios/LoadAndVerifySvg.png b/src/Controls/tests/UITests/snapshots/ios/LoadAndVerifySvg.png new file mode 100644 index 000000000000..8e59f313765e Binary files /dev/null and b/src/Controls/tests/UITests/snapshots/ios/LoadAndVerifySvg.png differ diff --git a/src/Controls/tests/UITests/snapshots/windows/LoadAndVerifyGif.png b/src/Controls/tests/UITests/snapshots/windows/LoadAndVerifyGif.png new file mode 100644 index 000000000000..07b612eb3f3d Binary files /dev/null and b/src/Controls/tests/UITests/snapshots/windows/LoadAndVerifyGif.png differ diff --git a/src/Controls/tests/UITests/snapshots/windows/LoadAndVerifyJpg.png b/src/Controls/tests/UITests/snapshots/windows/LoadAndVerifyJpg.png new file mode 100644 index 000000000000..8865b7504156 Binary files /dev/null and b/src/Controls/tests/UITests/snapshots/windows/LoadAndVerifyJpg.png differ diff --git a/src/Controls/tests/UITests/snapshots/windows/LoadAndVerifyPng.png b/src/Controls/tests/UITests/snapshots/windows/LoadAndVerifyPng.png new file mode 100644 index 000000000000..56942cc72e84 Binary files /dev/null and b/src/Controls/tests/UITests/snapshots/windows/LoadAndVerifyPng.png differ diff --git a/src/Controls/tests/UITests/snapshots/windows/LoadAndVerifySvg.png b/src/Controls/tests/UITests/snapshots/windows/LoadAndVerifySvg.png new file mode 100644 index 000000000000..72e6270717e9 Binary files /dev/null and b/src/Controls/tests/UITests/snapshots/windows/LoadAndVerifySvg.png differ