RelativeRectTests.cs 856 B

123456789101112131415161718192021222324252627
  1. // Copyright (c) The Perspex 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 Perspex.SceneGraph.UnitTests
  6. {
  7. public class RelativeRectTests
  8. {
  9. [Fact]
  10. public void Parse_Should_Accept_Absolute_Value()
  11. {
  12. var result = RelativeRect.Parse("4,5,50,60", CultureInfo.InvariantCulture);
  13. Assert.Equal(new RelativeRect(4, 5, 50, 60, RelativeUnit.Absolute), result);
  14. }
  15. [Fact]
  16. public void Parse_Should_Accept_Relative_Value()
  17. {
  18. var result = RelativeRect.Parse("10%, 20%, 40%, 70%", CultureInfo.InvariantCulture);
  19. Assert.Equal(new RelativeRect(0.1, 0.2, 0.4, 0.7, RelativeUnit.Relative), result);
  20. }
  21. }
  22. }