Follow suggestion by @BobLd, added 2 more test cases for if we want to

support more lenient page size parsing in the future.
This commit is contained in:
mvantzet 2023-03-14 12:33:21 +01:00
parent 048caedd64
commit a07fdb8d45
2 changed files with 4 additions and 2 deletions

View File

@ -1699,6 +1699,8 @@
[Theory] [Theory]
[InlineData(595, 842, PageSize.A4)] [InlineData(595, 842, PageSize.A4)]
[InlineData(594, 843, PageSize.Custom)]
[InlineData(596, 841, PageSize.Custom)]
[InlineData(842, 595, PageSize.A4)] [InlineData(842, 595, PageSize.A4)]
[InlineData(595.3, 841.5, PageSize.A4)] [InlineData(595.3, 841.5, PageSize.A4)]
[InlineData(841.5, 595.3, PageSize.A4)] [InlineData(841.5, 595.3, PageSize.A4)]

View File

@ -150,8 +150,8 @@
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
return obj is WidthHeight height && return obj is WidthHeight height &&
Math.Abs(Width - height.Width) < 1 && Math.Round(Width) == Math.Round(height.Width) &&
Math.Abs(Height - height.Height) < 1; Math.Round(Height) == Math.Round(height.Height);
} }
public override int GetHashCode() public override int GetHashCode()