Browse Source

Fix failing test on release branch (doesn't reproduce on master)

release/11.0.6
Max Katz 2 years ago
parent
commit
8a61dabe39
  1. 13
      tests/Avalonia.Controls.UnitTests/VirtualizingStackPanelTests.cs

13
tests/Avalonia.Controls.UnitTests/VirtualizingStackPanelTests.cs

@ -6,6 +6,7 @@ using System.Collections.Specialized;
using System.Linq;
using Avalonia.Collections;
using Avalonia.Controls.Presenters;
using Avalonia.Controls.Primitives;
using Avalonia.Controls.Templates;
using Avalonia.Data;
using Avalonia.Input;
@ -1141,6 +1142,18 @@ namespace Avalonia.Controls.UnitTests
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);

Loading…
Cancel
Save