RelativeRectTests.cs 970 B

1234567891011121314151617181920212223242526272829
  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.Globalization;
  4. using Xunit;
  5. namespace Avalonia.Visuals.UnitTests
  6. {
  7. public class RelativeRectTests
  8. {
  9. private static readonly RelativeRectComparer Compare = new RelativeRectComparer();
  10. [Fact]
  11. public void Parse_Should_Accept_Absolute_Value()
  12. {
  13. var result = RelativeRect.Parse("4,5,50,60", CultureInfo.InvariantCulture);
  14. Assert.Equal(new RelativeRect(4, 5, 50, 60, RelativeUnit.Absolute), result, Compare);
  15. }
  16. [Fact]
  17. public void Parse_Should_Accept_Relative_Value()
  18. {
  19. var result = RelativeRect.Parse("10%, 20%, 40%, 70%", CultureInfo.InvariantCulture);
  20. Assert.Equal(new RelativeRect(0.1, 0.2, 0.4, 0.7, RelativeUnit.Relative), result, Compare);
  21. }
  22. }
  23. }