RelativeRectComparer.cs 885 B

12345678910111213141516171819202122232425
  1. // Copyright (c) The Avalonia Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using System;
  4. using System.Collections.Generic;
  5. namespace Avalonia.Visuals.UnitTests
  6. {
  7. public class RelativeRectComparer : IEqualityComparer<RelativeRect>
  8. {
  9. public bool Equals(RelativeRect a, RelativeRect b)
  10. {
  11. return a.Unit == b.Unit &&
  12. Math.Round(a.Rect.X, 3) == Math.Round(b.Rect.X, 3) &&
  13. Math.Round(a.Rect.Y, 3) == Math.Round(b.Rect.Y, 3) &&
  14. Math.Round(a.Rect.Width, 3) == Math.Round(b.Rect.Width, 3) &&
  15. Math.Round(a.Rect.Height, 3) == Math.Round(b.Rect.Height, 3);
  16. }
  17. public int GetHashCode(RelativeRect obj)
  18. {
  19. throw new NotImplementedException();
  20. }
  21. }
  22. }