Let's see if we can make these tests stable (#6241)

* Let's see if we can make these tests stable

* Also handle this for ImageButtonStub
This commit is contained in:
E.Z. Hart 2022-04-19 23:48:00 -06:00 коммит произвёл GitHub
Родитель d7f9b086bf
Коммит 301f664316
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 25 добавлений и 10 удалений

Просмотреть файл

@ -127,7 +127,7 @@ namespace Microsoft.Maui.DeviceTests
{
var handler = (IPlatformViewHandler)CreateHandler(image);
await image.Wait();
await image.Wait(timeout: 5000);
#if __ANDROID__
handler.PlatformView.SetMinimumHeight(1);
@ -137,8 +137,6 @@ namespace Microsoft.Maui.DeviceTests
await handler.PlatformView.AssertContainsColor(color);
});
await Task.Delay(1000);
Assert.Equal(new List<string> { "LoadingStarted", "LoadingFailed" }, order);
Assert.NotNull(exception);
}

Просмотреть файл

@ -37,15 +37,23 @@ namespace Microsoft.Maui.DeviceTests.Stubs
public void UpdateIsLoading(bool isLoading) =>
IsLoading = isLoading;
void IImageSourcePartEvents.LoadingCompleted(bool successful) =>
void IImageSourcePartEvents.LoadingCompleted(bool successful)
{
IsLoading = false;
LoadingCompleted?.Invoke(successful);
}
void IImageSourcePartEvents.LoadingFailed(Exception exception) =>
void IImageSourcePartEvents.LoadingFailed(Exception exception)
{
IsLoading = false;
LoadingFailed?.Invoke(exception);
}
void IImageSourcePartEvents.LoadingStarted() =>
void IImageSourcePartEvents.LoadingStarted()
{
IsLoading = true;
LoadingStarted?.Invoke();
}
public event EventHandler Pressed;
public event EventHandler Released;

Просмотреть файл

@ -22,14 +22,23 @@ namespace Microsoft.Maui.DeviceTests.Stubs
public void UpdateIsLoading(bool isLoading) =>
IsLoading = isLoading;
void IImageSourcePartEvents.LoadingCompleted(bool successful) =>
void IImageSourcePartEvents.LoadingCompleted(bool successful)
{
IsLoading = false;
LoadingCompleted?.Invoke(successful);
}
void IImageSourcePartEvents.LoadingFailed(Exception exception) =>
void IImageSourcePartEvents.LoadingFailed(Exception exception)
{
IsLoading = false;
LoadingFailed?.Invoke(exception);
}
void IImageSourcePartEvents.LoadingStarted() =>
void IImageSourcePartEvents.LoadingStarted()
{
IsLoading = true;
LoadingStarted?.Invoke();
}
}
public static class ImageStubExtensions