-
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.
Adding a test to validate loading images
I noticed that in one of my PRs I loaded a lower res image and another test caught it. Adding these tests to ensure that at least we validate the on-screen image.
- Loading branch information
1 parent
cb1ac24
commit 75c65b5
Showing
17 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/Controls/samples/Controls.Sample.UITests/Concepts/ImageLoadingGalleryPage.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,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<Image> Add(Test.ImageLoading test, ImageSource image) => | ||
Add(test, new Image | ||
{ | ||
Source = image, | ||
HorizontalOptions = LayoutOptions.Center, | ||
VerticalOptions = LayoutOptions.Start | ||
}); | ||
|
||
ViewContainer<Image> Add(Test.ImageLoading test, Image image) => | ||
Add(new ViewContainer<Image>(test, image)); | ||
} | ||
} |
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
Binary file added
BIN
+15.1 KB
src/Controls/samples/Controls.Sample.UITests/Resources/Images/animated_heart.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
43 changes: 43 additions & 0 deletions
43
src/Controls/tests/UITests/Tests/Concepts/ImageLoadingGalleryTests.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,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(); | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.