RotateTests.cs 973 B

123456789101112131415161718192021222324252627282930313233343536
  1. using NUnit.Framework;
  2. using QuestPDF.Elements;
  3. using QuestPDF.Fluent;
  4. using QuestPDF.Infrastructure;
  5. namespace QuestPDF.UnitTests;
  6. public class RotateTests
  7. {
  8. [Test]
  9. public void RotateIsCumulative()
  10. {
  11. var container = EmptyContainer.Create();
  12. container
  13. .Rotate(45)
  14. .Rotate(-15)
  15. .Rotate(20);
  16. var rotation = container.Child as Rotate;
  17. Assert.That(rotation?.Angle, Is.EqualTo(50));
  18. }
  19. [TestCase(0, ExpectedResult = "No rotation")]
  20. [TestCase(45, ExpectedResult = "45 deg clockwise")]
  21. [TestCase(-75, ExpectedResult = "75 deg counter-clockwise")]
  22. [TestCase(12.345f, ExpectedResult = "12.3 deg clockwise")]
  23. public string RotateCompanionHint(float angle)
  24. {
  25. var container = EmptyContainer.Create();
  26. container.Rotate(angle);
  27. var rotation = container.Child as Rotate;
  28. return rotation?.GetCompanionHint();
  29. }
  30. }