diff --git a/tests/Avalonia.Controls.TreeDataGrid.Tests/FlatTreeDataGridSourceTests.cs b/tests/Avalonia.Controls.TreeDataGrid.Tests/FlatTreeDataGridSourceTests.cs index 86cd4534..4cb44c2b 100644 --- a/tests/Avalonia.Controls.TreeDataGrid.Tests/FlatTreeDataGridSourceTests.cs +++ b/tests/Avalonia.Controls.TreeDataGrid.Tests/FlatTreeDataGridSourceTests.cs @@ -3,6 +3,7 @@ using System.Collections.Specialized; using System.Linq; using Avalonia.Collections; +using Avalonia.Controls.Models; using Avalonia.Controls.Models.TreeDataGrid; using Avalonia.Diagnostics; using Xunit; @@ -119,6 +120,19 @@ public void Updates_Cells_For_Clear() AssertCells(target.Cells, data); } + [Fact] + public void Updates_Cells_On_Property_Change() + { + var data = CreateData(); + var target = CreateTarget(data); + + Assert.Equal("Row 0", target.Cells[1, 0].Value); + + data[0].Caption = "Modified"; + + Assert.Equal("Modified", target.Cells[1, 0].Value); + } + [Fact] public void Disposing_Releases_Listeners_On_Items() { @@ -278,7 +292,6 @@ private static void AssertCells(ICells cells, IList data) } } - private static FlatTreeDataGridSource CreateTarget(IEnumerable rows) { return new FlatTreeDataGridSource(rows) @@ -311,10 +324,22 @@ private static void AssertCells(ICells cells, IList data) } } - private class Row + private class Row : NotifyingBase { - public int Id { get; set; } - public string? Caption { get; set; } + private int _id; + private string? _caption; + + public int Id + { + get => _id; + set => RaiseAndSetIfChanged(ref _id, value); + } + + public string? Caption + { + get => _caption; + set => RaiseAndSetIfChanged(ref _caption, value); + } } } }