RelativeRectComparer.cs 716 B

12345678910111213141516171819202122
  1. using System;
  2. using System.Collections.Generic;
  3. namespace Avalonia.Base.UnitTests
  4. {
  5. public class RelativeRectComparer : IEqualityComparer<RelativeRect>
  6. {
  7. public bool Equals(RelativeRect a, RelativeRect b)
  8. {
  9. return a.Unit == b.Unit &&
  10. Math.Round(a.Rect.X, 3) == Math.Round(b.Rect.X, 3) &&
  11. Math.Round(a.Rect.Y, 3) == Math.Round(b.Rect.Y, 3) &&
  12. Math.Round(a.Rect.Width, 3) == Math.Round(b.Rect.Width, 3) &&
  13. Math.Round(a.Rect.Height, 3) == Math.Round(b.Rect.Height, 3);
  14. }
  15. public int GetHashCode(RelativeRect obj)
  16. {
  17. throw new NotImplementedException();
  18. }
  19. }
  20. }