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:
Родитель
d7f9b086bf
Коммит
301f664316
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче