提交 a1656260 编写于 作者: A Andres Pineda

test(Image): Assert SVGImageSource uri Binding

上级 abc84264
......@@ -1594,6 +1594,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\ImageTests\SvgImageSource_Binding.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\ListView\ListView_BringIntoView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......@@ -5686,9 +5690,13 @@
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\IconSourceTests\IconSourceElementTests.xaml.cs">
<DependentUpon>IconSourceElementTests.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\ImageTests\ImageViewViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\ImageTests\Image_Source_Nullify.xaml.cs">
<DependentUpon>Image_Source_Nullify.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\ImageTests\SvgImageSource_Binding.xaml.cs">
<DependentUpon>SvgImageSource_Binding.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\ListView\ListView_BringIntoView.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\ImageTests\SvgImageSource_FromMsAppData.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\ListView\ListView_Snap_Rubberband.xaml.cs">
......
using System;
using System.Collections.Generic;
using System.Text;
using Uno.UI.Samples.UITests.Helpers;
using Windows.UI.Core;
namespace UITests.Windows_UI_Xaml_Controls.ImageTests;
internal class ImageViewViewModel : ViewModelBase
{
public IEnumerable<Item> Items { get; private set; }
public ImageViewViewModel(CoreDispatcher dispatcher) : base(dispatcher)
{
Items = new List<Item>()
{
new() { Title = "Item 1", Subtitle = "Subtitle 1", ImageUrl = "ms-appx:///Assets/Formats/couch.svg" },
new() { Title = "Item 2", Subtitle = "Subtitle 2", ImageUrl = "ms-appx:///Assets/Formats/home.svg" },
new() { Title = "Item 3", Subtitle = "Subtitle 3", ImageUrl = "ms-appx:///Assets/Formats/couch.svg" },
new() { Title = "Item 4", Subtitle = "Subtitle 4", ImageUrl = "ms-appx:///Assets/Formats/home.svg" },
new() { Title = "Item 5", Subtitle = "Subtitle 5", ImageUrl = "ms-appx:///Assets/Formats/couch.svg" },
new() { Title = "Item 6", Subtitle = "Subtitle 6", ImageUrl = null },
new() { Title = "Item 7", Subtitle = "Subtitle 7", ImageUrl = "ms-appx:///Assets/Formats/couch.svg" },
new() { Title = "Item 8", Subtitle = "Subtitle 8", ImageUrl = "ms-appx:///Assets/Formats/home.svg" },
new() { Title = "Item 9", Subtitle = "Subtitle 9", ImageUrl = "ms-appx:///Assets/Formats/couch.svg" },
new() { Title = "Item 10", Subtitle = "Subtitle 10", ImageUrl = "ms-appx:///Assets/Formats/home.svg" },
new() { Title = "Item 11", Subtitle = "Subtitle 11", ImageUrl = "ms-appx:///Assets/Formats/couch.svg" },
new() { Title = "Item 12", Subtitle = "Subtitle 12", ImageUrl = "ms-appx:///Assets/Formats/home.svg" },
new() { Title = "Item 13", Subtitle = "Subtitle 13", ImageUrl = null },
new() { Title = "Item 14", Subtitle = "Subtitle 14", ImageUrl = "ms-appx:///Assets/Formats/home.svg" },
new() { Title = "Item 15", Subtitle = "Subtitle 15", ImageUrl = "ms-appx:///Assets/Formats/couch.svg" },
new() { Title = "Item 16", Subtitle = "Subtitle 16", ImageUrl = "ms-appx:///Assets/Formats/home.svg" },
new() { Title = "Item 17", Subtitle = "Subtitle 17", ImageUrl = "ms-appx:///Assets/Formats/couch.svg" },
new() { Title = "Item 18", Subtitle = "Subtitle 18", ImageUrl = "ms-appx:///Assets/Formats/home.svg" },
new() { Title = "Item 19", Subtitle = "Subtitle 19", ImageUrl = "ms-appx:///Assets/Formats/couch.svg" },
new() { Title = "Item 20", Subtitle = "Subtitle 20", ImageUrl = null },
new() { Title = "Item 21", Subtitle = "Subtitle 21", ImageUrl = "ms-appx:///Assets/Formats/couch.svg" },
new() { Title = "Item 22", Subtitle = "Subtitle 22", ImageUrl = "ms-appx:///Assets/Formats/home.svg" },
};
}
}
internal class Item
{
public string Title { get; set; }
public string Subtitle { get; set; }
public string ImageUrl { get; set; }
}
<Page
x:Class="UITests.Windows_UI_Xaml_Controls.ImageTests.SvgImageSource_Binding"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UITests.Windows_UI_Xaml_Controls.ImageTests"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<ListView ItemsSource="{Binding [Items]}">
<ListView.Header>
<TextBlock Text="ListView with SVG ImageSource" />
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate>
<Grid ColumnSpacing="12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="90"/>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image VerticalAlignment="Center"
Grid.RowSpan="2">
<Image.Source>
<SvgImageSource UriSource="{Binding ImageUrl}"
RasterizePixelHeight="80"
RasterizePixelWidth="80"/>
</Image.Source>
</Image>
<TextBlock Text="{Binding Title}"
Grid.Column="1"
FontSize="18"/>
<TextBlock Text="{Binding Subtitle}"
Grid.Column="1"
Grid.Row="1"
Foreground="#5A5A5A"
FontSize="12"/>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</Page>
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Uno.Extensions;
using Uno.UI.Samples.Controls;
using Windows.Storage;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;
namespace UITests.Windows_UI_Xaml_Controls.ImageTests;
[SampleControlInfo("Image", "SvgImageSource_Binding", typeof(ImageViewViewModel), isManualTest: true)]
public sealed partial class SvgImageSource_Binding : Page
{
public SvgImageSource_Binding()
{
this.InitializeComponent();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册