WIP fixing 3469

This commit is contained in:
Tig
2024-05-12 21:55:43 -06:00
parent bc40c9de22
commit ce28b2ab40
3 changed files with 12 additions and 2 deletions

View File

@@ -197,6 +197,8 @@ public class TextFormatter
{
_size = EnableNeedsFormat (value);
}
Debug.Assert (Size.Width >= 0);
Debug.Assert (Size.Height >= 0);
}
}

View File

@@ -191,12 +191,12 @@ public partial class View
if (widthAuto is null || !widthAuto._style.HasFlag (Dim.DimAutoStyle.Text))
{
size.Width = _width.Anchor (0);
size.Width = ContentSize.Value.Width;
}
if (heightAuto is null || !heightAuto._style.HasFlag (Dim.DimAutoStyle.Text))
{
size.Height = _height.Anchor (0);
size.Height = ContentSize.Value.Height;
}
// Whenever DimAutoStyle.Text is set, ContentSize will match TextFormatter.Size.

View File

@@ -303,4 +303,12 @@ public class PosAnchorEndTests (ITestOutputHelper output)
Assert.Equal (5, result);
}
[Fact]
public void PosAnchorEnd_MinusOne_Combine_Works ()
{
var pos = AnchorEnd () - 1;
var result = pos.Calculate (10, new DimAbsolute (2), null, Dimension.None);
Assert.Equal (7, result);
}
}