forked from unoplatform/uno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request unoplatform#16389 from Youssef1313/stabilize-snapshot
ci: Stabilize snapshot tests more
- Loading branch information
Showing
26 changed files
with
219 additions
and
150 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/SamplesApp/UITests.Shared/Helpers/WaitableSampleImageHelpers.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,54 @@ | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.UI.Xaml.Controls; | ||
using Microsoft.UI.Xaml.Media; | ||
using Microsoft.UI.Xaml.Media.Imaging; | ||
|
||
namespace UITests.Shared.Helpers; | ||
|
||
internal static class WaitableSampleImageHelpers | ||
{ | ||
private static Task WaitImage(ImageBrush image) | ||
{ | ||
var tcs = new TaskCompletionSource(); | ||
image.ImageOpened += (_, _) => tcs.SetResult(); | ||
image.ImageFailed += (_, _) => tcs.SetResult(); | ||
return tcs.Task; | ||
} | ||
|
||
private static Task WaitImage(Image image) | ||
{ | ||
var tcs = new TaskCompletionSource(); | ||
image.ImageOpened += (_, _) => tcs.SetResult(); | ||
image.ImageFailed += (_, _) => tcs.SetResult(); | ||
return tcs.Task; | ||
} | ||
|
||
private static Task WaitImage(SvgImageSource image) | ||
{ | ||
var tcs = new TaskCompletionSource(); | ||
image.Opened += (_, _) => tcs.SetResult(); | ||
image.OpenFailed += (_, _) => tcs.SetResult(); | ||
return tcs.Task; | ||
} | ||
|
||
private static Task WaitImage(BitmapImage image) | ||
{ | ||
var tcs = new TaskCompletionSource(); | ||
image.ImageOpened += (_, _) => tcs.SetResult(); | ||
image.ImageFailed += (_, _) => tcs.SetResult(); | ||
return tcs.Task; | ||
} | ||
|
||
public static Task WaitAllImages(params ImageBrush[] images) | ||
=> Task.WhenAll(images.Select(WaitImage)); | ||
|
||
public static Task WaitAllImages(params Image[] images) | ||
=> Task.WhenAll(images.Select(WaitImage)); | ||
|
||
public static Task WaitAllImages(params SvgImageSource[] images) | ||
=> Task.WhenAll(images.Select(WaitImage)); | ||
|
||
public static Task WaitAllImages(params BitmapImage[] images) | ||
=> Task.WhenAll(images.Select(WaitImage)); | ||
} |
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
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
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
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
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
9 changes: 8 additions & 1 deletion
9
src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ImageTests/ImageInStackPanel.xaml.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 |
---|---|---|
@@ -1,14 +1,21 @@ | ||
using Uno.UI.Samples.Controls; | ||
using Microsoft.UI.Xaml.Controls; | ||
using UITests.Shared.Helpers; | ||
using System.Threading.Tasks; | ||
|
||
namespace Uno.UI.Samples.UITests.Image | ||
{ | ||
[SampleControlInfo(category: "Image", Description = "ImageInStackPanel")] | ||
public sealed partial class ImageInStackPanel : UserControl | ||
public sealed partial class ImageInStackPanel : UserControl, IWaitableSample | ||
{ | ||
private readonly Task _samplePreparedTask; | ||
|
||
public ImageInStackPanel() | ||
{ | ||
this.InitializeComponent(); | ||
_samplePreparedTask = WaitableSampleImageHelpers.WaitAllImages(image1); | ||
} | ||
|
||
public Task SamplePreparedTask => _samplePreparedTask; | ||
} | ||
} |
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
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
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
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
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
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
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
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
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
104 changes: 44 additions & 60 deletions
104
src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Media/ImageBrushTests/BorderImageBrush.xaml
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 |
---|---|---|
@@ -1,68 +1,52 @@ | ||
<UserControl x:Class="Uno.UI.Samples.UITests.ImageBrushTestControl.BorderImageBrush" | ||
xmlns:controls="using:Uno.UI.Samples.Controls" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:Uno.UI.Samples.UITests" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:u="using:Uno.UI.Samples.Controls" | ||
xmlns:uBehaviors="using:Uno.UI.Samples.Behaviors" | ||
xmlns:ios="http://uno.ui/ios" | ||
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:android="http://uno.ui/android" | ||
xmlns:not_ios="http://uno.ui/not_ios" | ||
xmlns:shapes="clr-namespace:Microsoft.UI.Xaml.Shapes;assembly=Uno" | ||
mc:Ignorable="d ios android" | ||
d:DesignHeight="600" | ||
d:DesignWidth="400"> | ||
<controls:SampleControl SampleDescription="BorderImageBrush"> | ||
<controls:SampleControl.SampleContent> | ||
<DataTemplate> | ||
<StackPanel> | ||
<TextBlock Text="This should display an image with a red border." /> | ||
<Border BorderBrush="Red" | ||
BorderThickness="30" | ||
CornerRadius="50,0,25,10" | ||
Width="200" | ||
Height="100"> | ||
<Border.Background> | ||
<ImageBrush x:Name="imageBrush1" ImageSource="http://lh5.ggpht.com/lxBMauupBiLIpgOgu5apeiX_YStXeHRLK1oneS4NfwwNt7fGDKMP0KpQIMwfjfL9GdHRVEavmg7gOrj5RYC4qwrjh3Y0jCWFDj83jzg" /> | ||
</Border.Background> | ||
</Border> | ||
mc:Ignorable="d"> | ||
<StackPanel> | ||
<TextBlock Text="This should display an image with a red border." /> | ||
<Border BorderBrush="Red" | ||
BorderThickness="30" | ||
CornerRadius="50,0,25,10" | ||
Width="200" | ||
Height="100"> | ||
<Border.Background> | ||
<ImageBrush x:Name="imageBrush1" ImageSource="http://lh5.ggpht.com/lxBMauupBiLIpgOgu5apeiX_YStXeHRLK1oneS4NfwwNt7fGDKMP0KpQIMwfjfL9GdHRVEavmg7gOrj5RYC4qwrjh3Y0jCWFDj83jzg" /> | ||
</Border.Background> | ||
</Border> | ||
|
||
<TextBlock Text="This should display a red rectangle with an image border brush." /> | ||
<Border Background="Red" | ||
BorderThickness="30" | ||
CornerRadius="10,0,10,0" | ||
Width="200" | ||
Height="100"> | ||
<Border.BorderBrush> | ||
<ImageBrush x:Name="imageBrush2" ImageSource="http://lh5.ggpht.com/lxBMauupBiLIpgOgu5apeiX_YStXeHRLK1oneS4NfwwNt7fGDKMP0KpQIMwfjfL9GdHRVEavmg7gOrj5RYC4qwrjh3Y0jCWFDj83jzg" /> | ||
</Border.BorderBrush> | ||
</Border> | ||
|
||
<TextBlock Text="This should display a thin red circle with an image fill." /> | ||
<Border BorderBrush="Red" | ||
BorderThickness="1" | ||
CornerRadius="100" | ||
Width="200" | ||
Height="200"> | ||
<Border.Background> | ||
<ImageBrush x:Name="imageBrush3" ImageSource="http://lh5.ggpht.com/lxBMauupBiLIpgOgu5apeiX_YStXeHRLK1oneS4NfwwNt7fGDKMP0KpQIMwfjfL9GdHRVEavmg7gOrj5RYC4qwrjh3Y0jCWFDj83jzg" /> | ||
</Border.Background> | ||
</Border> | ||
|
||
<TextBlock Text="This should display a rectangle with variable border thickness (48,24,12,6) with an image inside." /> | ||
<Border BorderBrush="Red" | ||
BorderThickness="48,24,12,6" | ||
Width="200" | ||
Height="100"> | ||
<Border.Background> | ||
<ImageBrush x:Name="imageBrush4" ImageSource="http://lh5.ggpht.com/lxBMauupBiLIpgOgu5apeiX_YStXeHRLK1oneS4NfwwNt7fGDKMP0KpQIMwfjfL9GdHRVEavmg7gOrj5RYC4qwrjh3Y0jCWFDj83jzg" /> | ||
</Border.Background> | ||
</Border> | ||
</StackPanel> | ||
</DataTemplate> | ||
</controls:SampleControl.SampleContent> | ||
</controls:SampleControl> | ||
<TextBlock Text="This should display a red rectangle with an image border brush." /> | ||
<Border Background="Red" | ||
BorderThickness="30" | ||
CornerRadius="10,0,10,0" | ||
Width="200" | ||
Height="100"> | ||
<Border.BorderBrush> | ||
<ImageBrush x:Name="imageBrush2" ImageSource="http://lh5.ggpht.com/lxBMauupBiLIpgOgu5apeiX_YStXeHRLK1oneS4NfwwNt7fGDKMP0KpQIMwfjfL9GdHRVEavmg7gOrj5RYC4qwrjh3Y0jCWFDj83jzg" /> | ||
</Border.BorderBrush> | ||
</Border> | ||
|
||
<TextBlock Text="This should display a thin red circle with an image fill." /> | ||
<Border BorderBrush="Red" | ||
BorderThickness="1" | ||
CornerRadius="100" | ||
Width="200" | ||
Height="200"> | ||
<Border.Background> | ||
<ImageBrush x:Name="imageBrush3" ImageSource="http://lh5.ggpht.com/lxBMauupBiLIpgOgu5apeiX_YStXeHRLK1oneS4NfwwNt7fGDKMP0KpQIMwfjfL9GdHRVEavmg7gOrj5RYC4qwrjh3Y0jCWFDj83jzg" /> | ||
</Border.Background> | ||
</Border> | ||
|
||
<TextBlock Text="This should display a rectangle with variable border thickness (48,24,12,6) with an image inside." /> | ||
<Border BorderBrush="Red" | ||
BorderThickness="48,24,12,6" | ||
Width="200" | ||
Height="100"> | ||
<Border.Background> | ||
<ImageBrush x:Name="imageBrush4" ImageSource="http://lh5.ggpht.com/lxBMauupBiLIpgOgu5apeiX_YStXeHRLK1oneS4NfwwNt7fGDKMP0KpQIMwfjfL9GdHRVEavmg7gOrj5RYC4qwrjh3Y0jCWFDj83jzg" /> | ||
</Border.Background> | ||
</Border> | ||
</StackPanel> | ||
</UserControl> |
Oops, something went wrong.