|
|
@@ -749,7 +749,6 @@ namespace Avalonia.Controls.UnitTests
|
|
|
{
|
|
|
Template = CreateTreeViewTemplate(),
|
|
|
Items = tree,
|
|
|
- ItemTemplate = new FuncDataTemplate<string>(x => new TextBlock { Width = 20, Height = 10 }),
|
|
|
SelectionMode = SelectionMode.Multiple,
|
|
|
};
|
|
|
|
|
|
@@ -777,7 +776,6 @@ namespace Avalonia.Controls.UnitTests
|
|
|
{
|
|
|
Template = CreateTreeViewTemplate(),
|
|
|
Items = tree,
|
|
|
- ItemTemplate = new FuncDataTemplate<string>(x => new TextBlock { Width = 20, Height = 10 }),
|
|
|
SelectionMode = SelectionMode.Multiple,
|
|
|
};
|
|
|
|
|
|
@@ -806,6 +804,66 @@ namespace Avalonia.Controls.UnitTests
|
|
|
Assert.Equal(1, target.SelectedItems.Count);
|
|
|
}
|
|
|
|
|
|
+ [Fact]
|
|
|
+ public void Shift_Right_Click_Should_Not_Select_Mutiple()
|
|
|
+ {
|
|
|
+ var tree = CreateTestTreeData();
|
|
|
+ var target = new TreeView
|
|
|
+ {
|
|
|
+ Template = CreateTreeViewTemplate(),
|
|
|
+ Items = tree,
|
|
|
+ SelectionMode = SelectionMode.Multiple,
|
|
|
+ };
|
|
|
+
|
|
|
+ var visualRoot = new TestRoot();
|
|
|
+ visualRoot.Child = target;
|
|
|
+
|
|
|
+ CreateNodeDataTemplate(target);
|
|
|
+ ApplyTemplates(target);
|
|
|
+ target.ExpandSubTree((TreeViewItem)target.Presenter.Panel.Children[0]);
|
|
|
+
|
|
|
+ var rootNode = tree[0];
|
|
|
+ var from = rootNode.Children[0];
|
|
|
+ var to = rootNode.Children[1];
|
|
|
+ var fromContainer = (TreeViewItem)target.ItemContainerGenerator.Index.ContainerFromItem(from);
|
|
|
+ var toContainer = (TreeViewItem)target.ItemContainerGenerator.Index.ContainerFromItem(to);
|
|
|
+
|
|
|
+ _mouse.Click(fromContainer);
|
|
|
+ _mouse.Click(toContainer, MouseButton.Right, modifiers: InputModifiers.Shift);
|
|
|
+
|
|
|
+ Assert.Equal(1, target.SelectedItems.Count);
|
|
|
+ }
|
|
|
+
|
|
|
+ [Fact]
|
|
|
+ public void Ctrl_Right_Click_Should_Not_Select_Mutiple()
|
|
|
+ {
|
|
|
+ var tree = CreateTestTreeData();
|
|
|
+ var target = new TreeView
|
|
|
+ {
|
|
|
+ Template = CreateTreeViewTemplate(),
|
|
|
+ Items = tree,
|
|
|
+ SelectionMode = SelectionMode.Multiple,
|
|
|
+ };
|
|
|
+
|
|
|
+ var visualRoot = new TestRoot();
|
|
|
+ visualRoot.Child = target;
|
|
|
+
|
|
|
+ CreateNodeDataTemplate(target);
|
|
|
+ ApplyTemplates(target);
|
|
|
+ target.ExpandSubTree((TreeViewItem)target.Presenter.Panel.Children[0]);
|
|
|
+
|
|
|
+ var rootNode = tree[0];
|
|
|
+ var from = rootNode.Children[0];
|
|
|
+ var to = rootNode.Children[1];
|
|
|
+ var fromContainer = (TreeViewItem)target.ItemContainerGenerator.Index.ContainerFromItem(from);
|
|
|
+ var toContainer = (TreeViewItem)target.ItemContainerGenerator.Index.ContainerFromItem(to);
|
|
|
+
|
|
|
+ _mouse.Click(fromContainer);
|
|
|
+ _mouse.Click(toContainer, MouseButton.Right, modifiers: InputModifiers.Control);
|
|
|
+
|
|
|
+ Assert.Equal(1, target.SelectedItems.Count);
|
|
|
+ }
|
|
|
+
|
|
|
private void ApplyTemplates(TreeView tree)
|
|
|
{
|
|
|
tree.ApplyTemplate();
|