Browse Source

issue: #3141 add failing tests for grid: when col/row are removed grid doesn't trigger layout update

Andrey Kunchev 6 years ago
parent
commit
b0eb2a1018
1 changed files with 22 additions and 0 deletions
  1. 22 0
      tests/Avalonia.Controls.UnitTests/GridTests.cs

+ 22 - 0
tests/Avalonia.Controls.UnitTests/GridTests.cs

@@ -1493,6 +1493,28 @@ namespace Avalonia.Controls.UnitTests
                 grid.RowDefinitions.Add(new RowDefinition(new GridLength(5)));
             });
         }
+
+        [Fact]
+        public void Remove_Column_Should_Invalidate_Grid()
+        {
+            var grid = new Grid { ColumnDefinitions = ColumnDefinitions.Parse("1*,1*") };
+
+            Change_Propery_And_Verify_Measure_Requested(grid, () =>
+            {
+                grid.ColumnDefinitions.RemoveAt(0);
+            });
+        }
+
+        [Fact]
+        public void Remove_Row_Should_Invalidate_Grid()
+        {
+            var grid = new Grid { RowDefinitions = RowDefinitions.Parse("1*,1*") };
+
+            Change_Propery_And_Verify_Measure_Requested(grid, () =>
+            {
+                grid.RowDefinitions.RemoveAt(0);
+            });
+        }
         private static void Change_Propery_And_Verify_Measure_Requested(Grid grid, Action change)
         {
             grid.Measure(new Size(100, 100));