SizeCalculatorTest.cs 686 B

12345678910111213141516171819
  1. using PixiEditor.Helpers;
  2. using Xunit;
  3. namespace PixiEditorTests.HelpersTests
  4. {
  5. public class SizeCalculatorTest
  6. {
  7. [Theory]
  8. [InlineData(50, 64, 64, 32, 32)]
  9. [InlineData(100, 64, 64, 64, 64)]
  10. [InlineData(200, 128, 128, 256, 256)]
  11. public void TestCalculationOfPercentsWorks(int percent, int currentWidth, int currentHeight, int expectedWidth, int expectedHeight)
  12. {
  13. var newSize = SizeCalculator.CalcAbsoluteFromPercentage(percent, new System.Drawing.Size(currentWidth, currentHeight));
  14. Assert.Equal(expectedWidth, newSize.Width);
  15. Assert.Equal(expectedHeight, newSize.Height);
  16. }
  17. }
  18. }