Skip to content

Commit

Permalink
Fix failing test on release branch (doesn't reproduce on master)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkatz6 committed Dec 5, 2023
1 parent 70644f7 commit 8a61dab
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/Avalonia.Controls.UnitTests/VirtualizingStackPanelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Linq;
using Avalonia.Collections;
using Avalonia.Controls.Presenters;
using Avalonia.Controls.Primitives;
using Avalonia.Controls.Templates;
using Avalonia.Data;
using Avalonia.Input;
Expand Down Expand Up @@ -1141,6 +1142,18 @@ private static (VirtualizingStackPanel, ScrollViewer, T) CreateUnrootedTarget<T>
Template = new FuncControlTemplate<T>((_, ns) => scroll.RegisterInNameScope(ns)),
ItemsPanel = new FuncTemplate<Panel?>(() => target),
ItemTemplate = itemTemplate.GetValueOrDefault(DefaultItemTemplate()),
// master branch doesn't have this code, because ContentControl delivered controls always have a template there.
ItemContainerTheme = new ControlTheme(typeof(ListBoxItem))
{
Setters =
{
new Setter(TemplatedControl.TemplateProperty, new FuncControlTemplate((_, ns) => new ContentPresenter
{
Name = "PART_ContentPresenter",
[~ListBoxItem.ContentProperty] = new TemplateBinding(ListBoxItem.ContentProperty),
}.RegisterInNameScope(ns)))
}
}
};

return (target, scroll, itemsControl);
Expand Down

0 comments on commit 8a61dab

Please sign in to comment.