You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling Rect.Intersect with a rect that has a width or height (but not both) of 0 erroneously results in an empty rect.
To Reproduce
[Fact]
public void Intersect_Should_Handle_Height_0()
{
var r1 = new Rect(0, 0, 100, 0);
var r2 = new Rect(0, 0, 50, 0);
var result = r1.Intersect(r2);
Assert.Equal(new Rect(0, 0, 50, 0), result);
}
[Fact]
public void Intersect_Should_Handle_Width_0()
{
var r1 = new Rect(0, 0, 0, 100);
var r2 = new Rect(0, 0, 0, 50);
var result = r1.Intersect(r2);
Assert.Equal(new Rect(0, 0, 0, 50), result);
}
Both fail because Intersect returns an empty rect.
Expected behavior
Should return a Rect with the intersection of the 0 width/height rect. Tested with WPF and this works correctly.
Avalonia version
all
OS
No response
Additional context
The code for Rect.Intersect was taken from SharpDX which also has this bug:
Describe the bug
Calling
Rect.Intersect
with a rect that has a width or height (but not both) of 0 erroneously results in an empty rect.To Reproduce
Both fail because
Intersect
returns an empty rect.Expected behavior
Should return a
Rect
with the intersection of the 0 width/height rect. Tested with WPF and this works correctly.Avalonia version
all
OS
No response
Additional context
The code for
Rect.Intersect
was taken from SharpDX which also has this bug:https://github.com/sharpdx/SharpDX/blob/master/Source/SharpDX.Mathematics/RectangleF.cs#L364-L378
Looks like the condition should use
>=
instead of>
The text was updated successfully, but these errors were encountered: