Fixed CarouselView Loop="False" rendering items incorrectly (#25545)
* Fixed CarouselView Loop="False" rendering items incorrectly * Added snapshots
This commit is contained in:
Родитель
83d9676a0d
Коммит
7143174eca
|
@ -570,8 +570,6 @@ namespace Microsoft.Maui.Controls.Handlers.Items
|
|||
}
|
||||
|
||||
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
||||
{
|
||||
if (Carousel.Loop)
|
||||
{
|
||||
// If the height or width are unbounded and the user is set to
|
||||
// Loop then we can't just do an infinite measure.
|
||||
|
@ -609,8 +607,6 @@ namespace Microsoft.Maui.Controls.Handlers.Items
|
|||
heightMeasureSpec = MeasureSpecMode.Exactly.MakeMeasureSpec(viewHolder.ItemView.MeasuredHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
|
|
Двоичные данные
src/Controls/tests/TestCases.Android.Tests/snapshots/android/CarouselViewShouldRenderCorrectly.png
Normal file
Двоичные данные
src/Controls/tests/TestCases.Android.Tests/snapshots/android/CarouselViewShouldRenderCorrectly.png
Normal file
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 35 KiB |
|
@ -0,0 +1,105 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Maui.Controls.Sample.Issues.Issue25192">
|
||||
<Grid>
|
||||
<CarouselView Margin="2,9,2,20"
|
||||
HeightRequest="180"
|
||||
Loop="False"
|
||||
PeekAreaInsets="20"
|
||||
VerticalOptions="End">
|
||||
<CarouselView.ItemsSource>
|
||||
<x:Array Type="{x:Type x:String}">
|
||||
<x:String>Item1</x:String>
|
||||
<x:String>Item2</x:String>
|
||||
<x:String>Item3</x:String>
|
||||
</x:Array>
|
||||
</CarouselView.ItemsSource>
|
||||
<CarouselView.ItemsLayout>
|
||||
<LinearItemsLayout ItemSpacing="5"
|
||||
Orientation="Horizontal"
|
||||
SnapPointsAlignment="Center"
|
||||
SnapPointsType="MandatorySingle"/>
|
||||
</CarouselView.ItemsLayout>
|
||||
<CarouselView.ItemTemplate>
|
||||
<DataTemplate
|
||||
x:DataType="{x:Null}">
|
||||
<Border BackgroundColor="Red"
|
||||
Stroke="Blue"
|
||||
StrokeShape="RoundRectangle 12"
|
||||
StrokeThickness="0">
|
||||
<Grid Margin="16"
|
||||
ColumnDefinitions="*,*"
|
||||
ColumnSpacing="15"
|
||||
RowDefinitions="*,*,36"
|
||||
RowSpacing="15">
|
||||
<VerticalStackLayout
|
||||
Grid.Row="0"
|
||||
Grid.ColumnSpan="2"
|
||||
VerticalOptions="Center">
|
||||
<Label FontSize="16"
|
||||
LineBreakMode="WordWrap"
|
||||
Text="DummyLabel"
|
||||
TextColor="#333333"
|
||||
VerticalOptions="Center"/>
|
||||
<Label FontFamily="Medium"
|
||||
FontSize="14"
|
||||
LineBreakMode="WordWrap"
|
||||
Text="DummyDesc"
|
||||
TextColor="#5F5E6A"/>
|
||||
</VerticalStackLayout>
|
||||
|
||||
<Border Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
BackgroundColor="LightGray"
|
||||
HorizontalOptions="Start"
|
||||
StrokeShape="RoundRectangle 12"
|
||||
StrokeThickness="0"
|
||||
VerticalOptions="Center">
|
||||
<Label Grid.Column="1"
|
||||
FontFamily="Regular"
|
||||
FontSize="14"
|
||||
Margin="6"
|
||||
AutomationId="{Binding .}"
|
||||
Text="{Binding .}"
|
||||
TextColor="Black"
|
||||
VerticalOptions="Center"/>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
BackgroundColor="#e8fccf"
|
||||
HorizontalOptions="Center"
|
||||
StrokeShape="RoundRectangle 12"
|
||||
StrokeThickness="0"
|
||||
VerticalOptions="Center">
|
||||
<Label Grid.Column="1"
|
||||
FontFamily="Regular"
|
||||
FontSize="14"
|
||||
Margin="6"
|
||||
Text="{Binding .}"
|
||||
TextColor="#155d27"
|
||||
VerticalOptions="Center"/>
|
||||
</Border>
|
||||
|
||||
<Label Grid.Row="2"
|
||||
FontSize="24"
|
||||
HorizontalOptions="Start"
|
||||
Text="I am here"
|
||||
TextColor="Black"
|
||||
VerticalOptions="Center"/>
|
||||
|
||||
<Button Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
BackgroundColor="White"
|
||||
BorderWidth="2"
|
||||
TextColor="Black"
|
||||
Text="Click me"
|
||||
VerticalOptions="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</CarouselView.ItemTemplate>
|
||||
</CarouselView>
|
||||
</Grid>
|
||||
</ContentPage>
|
|
@ -0,0 +1,11 @@
|
|||
namespace Maui.Controls.Sample.Issues
|
||||
{
|
||||
[Issue(IssueTracker.Github, 25192, "CarouselView Loop='False' renders incorrectly items", PlatformAffected.All)]
|
||||
public partial class Issue25192 : ContentPage
|
||||
{
|
||||
public Issue25192()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using NUnit.Framework;
|
||||
using UITest.Appium;
|
||||
using UITest.Core;
|
||||
|
||||
namespace Microsoft.Maui.TestCases.Tests.Issues
|
||||
{
|
||||
public class Issue25192 : _IssuesUITest
|
||||
{
|
||||
public Issue25192(TestDevice testDevice) : base(testDevice)
|
||||
{
|
||||
}
|
||||
|
||||
public override string Issue => "CarouselView Loop='False' renders incorrectly items";
|
||||
|
||||
[Test]
|
||||
[Category(UITestCategories.CarouselView)]
|
||||
public void CarouselViewShouldRenderCorrectly()
|
||||
{
|
||||
App.WaitForElement("Item1");
|
||||
VerifyScreenshot();
|
||||
}
|
||||
}
|
||||
}
|
Двоичные данные
src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/CarouselViewShouldRenderCorrectly.png
Normal file
Двоичные данные
src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/CarouselViewShouldRenderCorrectly.png
Normal file
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 8.9 KiB |
Двоичные данные
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/CarouselViewShouldRenderCorrectly.png
Normal file
Двоичные данные
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/CarouselViewShouldRenderCorrectly.png
Normal file
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 39 KiB |
Загрузка…
Ссылка в новой задаче