mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
added null value handle for image resizer size input (#4721)
* addle null value handle for image resizer size input * check for negative withd and height * check for negative withd and height * Update ImageSize.cs Co-authored-by: Lavius Motileng <laviusntk>
This commit is contained in:
@@ -183,5 +183,39 @@ namespace ViewModelTests
|
||||
Assert.AreEqual(viewModel.Sizes.Count, sizeOfOriginalArray - 1);
|
||||
Assert.IsFalse(viewModel.Sizes.Contains(deleteCandidate));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void UpdateWidthAndHeight_ShouldUpateSize_WhenCorrectValuesAreProvided()
|
||||
{
|
||||
// arrange
|
||||
ImageSize imageSize = new ImageSize()
|
||||
{
|
||||
Id = 0,
|
||||
Name = "Test",
|
||||
Fit = (int)ResizeFit.Fit,
|
||||
Width = 30,
|
||||
Height = 30,
|
||||
Unit = (int)ResizeUnit.Pixel,
|
||||
};
|
||||
|
||||
double negativeWidth = -2.0;
|
||||
double negativeHeight = -2.0;
|
||||
|
||||
// Act
|
||||
imageSize.Width = negativeWidth;
|
||||
imageSize.Height = negativeHeight;
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(0, imageSize.Width);
|
||||
Assert.AreEqual(0, imageSize.Height);
|
||||
|
||||
// Act
|
||||
imageSize.Width = 50;
|
||||
imageSize.Height = 50;
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(50, imageSize.Width);
|
||||
Assert.AreEqual(50, imageSize.Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user